API reference
Completion API
The Redrob completion API: an OpenAI-compatible chat completions endpoint, streaming, model ids, request and response fields, and status codes.
Endpoints
Base URL: https://console.redrob.ai/api/backend. Everything below takes an API key as Authorization: Bearer rrk_….
/v1/chat/completionsGenerate an answer from a conversation. OpenAI-compatible, streaming optional.
/v1/modelsList the model ids this gateway accepts.
/v1/completeGenerate an answer from a single prompt, in Redrob’s own shape.
/v1/complete/streamThe same as /v1/complete, delivered as named server-sent events.
POST /v1/chat/completions
OpenAI-compatible, so the official openai packages work against it with only a base URL and key change - see the quickstarts. Every parameter OpenAI accepts is accepted here. Sampling fields Redrob has no opinion on, such as top_p, stop, seed, response_format, are relayed to the serving vendor; a parameter that is not part of the API is refused with Unrecognized request argument supplied, as OpenAI refuses it.
messagesarray, required
The conversation, oldest first. Roles are system, developer, user, assistant, tool. Content is a string, an array of text parts, or tool_calls on an assistant turn carrying null. System and developer turns become the system prompt; if there are none, the API key’s default is used. The whole conversation is capped at 400,000 characters across all messages; no single message has a limit of its own, since a tool result is often a long document.
modelstring
auto is the default: a request that omits model is served by it, and it lets Redrob choose. Otherwise name one of the models listed by GET /v1/models. Any other id, and any model this deployment cannot serve, is a 404 with model_not_found.
toolsarray
Functions the model may ask to call, in OpenAI’s {type, function} shape. Relayed to the model; nothing is executed here. The legacy functions list is accepted and relayed the same way.
tool_choicestring or object
none, auto, required, or an object naming one function. parallel_tool_calls is relayed too.
cache_controlobject
Anthropic-style prompt caching. { "type": "ephemeral" } marks the end of the part of the request you want reused on the next call. See the note below for where it may go and what happens to it.
streamboolean
Emit chunks as they are produced instead of one response.
temperaturenumber, 0–2
Passed upstream when supported.
max_tokensinteger
Upper bound on the answer length. max_completion_tokens is treated as the same bound.
context_sizeshort or long
short uses the model’s standard context policy. long permits its full window. Price is based on actual input tokens, not this declaration: GPT-5.6 moves to its long-context rate only above 272,000 input tokens.
thinkinglow, medium, high, or max
Reasoning effort for models that advertise a non-empty thinkingLevels capability.
fastboolean
Uses the Bedrock Priority service tier where fastMode is supported. Its token rate is 1.75 times the standard rate.
provider_data_shareboolean
Must be true for claude-fable-5. The model provider may retain prompts and outputs under its data-sharing terms; Redrob still does not log that content.
{
"model": "auto",
"messages": [
{ "role": "system", "content": "Answer in one sentence." },
{ "role": "user", "content": "রোবট কী?" }
]
}{
"id": "chatcmpl-log_…",
"object": "chat.completion",
"created": 1775548800,
"model": "auto",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "রোবট হলো একটি যন্ত্র …" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 18, "completion_tokens": 74, "total_tokens": 92 },
"redrob": {
"requestId": "log_…",
"latencyMs": 812
}
}usage carries the token counts you are charged for. The redrob object is an addition to OpenAI’s shape: it carries the id of the matching request log row. SDKs ignore fields they do not know, so it is safe to leave in place.
Streaming
With stream: true the response is text/event-stream: one data: line per chunk, the first announcing the role, the last carrying finish_reason and usage , then the [DONE] sentinel the SDKs stop at.
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]}
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"রোবট "},"finish_reason":null}]}
data: {"id":"chatcmpl-…","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}],"usage":{"prompt_tokens":18,"completion_tokens":74,"total_tokens":92}}
data: [DONE]GET /v1/models
Returns the models this deployment serves, in OpenAI’s list shape, so client.models.list() works. A model is listed only when it can actually be served, which is the same thing OpenAI does with a model your key cannot reach.
autodefault
Redrob chooses, and falls through to another vendor when one is degraded. Pick this unless you have a reason not to: it is the only id whose routing improves without you changing anything.
gpt-5.6-terranamed
Along with gpt-5.6-sol. Both support a 1M-token context window and use a separate long-context price above 272,000 actual input tokens.
claude-opus-5named
Along with claude-sonnet-5 and claude-fable-5. All support tools, 1M context, configurable thinking effort, and Fast mode. Fable also requires an explicit provider-data-sharing acknowledgment on every request.
Naming a model pins the model, not the route. Redrob tries its global Bedrock profile, then the same model through OpenRouter if Bedrock is unconfigured or fails. What stays unexposed is which upstream endpoint served the request and what it cost us. Each model’s capabilities object tells a UI which context, thinking, Fast, and data-sharing controls apply.
POST /v1/complete
Redrob’s own shape, for a single prompt rather than a conversation. It takes prompt, an optional model and an optional systemPrompt , and answers with text plus token counts and latency.
{
"prompt": "রোবট কী?",
"systemPrompt": "Answer in one sentence."
}POST /v1/complete/stream takes the same body and emits named events - metadata, then delta, then done with the complete response, or error - which suits an EventSource-style reader. Prefer /v1/chat/completions for new work; this endpoint stays supported for integrations already using it.
Status codes
200The request succeeded.400The body is invalid: a missing message, an unknown language, an over-long prompt.401The API key is missing, malformed, or revoked.402The workspace is out of prepaid credit. Top up, or turn on automatic top-up.404The model id is not one this gateway serves.413The request body is larger than 2 MB.503No upstream provider could serve the request.Retry 5xx with exponential backoff and jitter. Do not retry 400, 402, 404 or 413; none of them changes without you changing something first.
Errors on the OpenAI-compatible endpoints use OpenAI’s envelope, so the SDKs raise the exception you would expect and error.code is populated:
{
"error": {
"message": "The model `gpt-4o` does not exist or you do not have access to it.",
"type": "invalid_request_error",
"param": null,
"code": "model_not_found"
}
}