Create Chat Completion
Create a chat completion on the OpenAI Chat Completions-compatible endpoint: one base URL for 30+ models, streaming or not, model: auto picks a model by tier.
When model is auto, Router One selects from a server-owned candidate set under the active gateway policy.
A long stream: false call is held open (as of 2026-10-09): after about 25 seconds the gateway commits HTTP 200 and writes JSON leading whitespace until the completion is ready, so a failure after that point arrives as HTTP 200 with a top-level error object — check for error before reading choices; use stream: true for generations that take minutes.
Full reference for every endpoint: Markdown · OpenAPI 3.1 JSON
Authenticate with your API Key. Get your API Key in the Router One console; the format is sk-xxx.
In: header
Model ID. Set to auto to use the server-owned candidate set under gateway policy, or specify a model such as openai/gpt-5.6-sol or anthropic/claude-sonnet-5 (copy IDs from the model catalog). Most official bare names (for example gpt-5.6-sol or claude-sonnet-5) are accepted as aliases of the catalog id; copy the catalog id from /models to be safe.
Chat messages, in chronological order.
1 <= itemsWhether to enable streaming response. When enabled, returns an SSE event stream.
falseSampling temperature, range 0-2. Higher values (e.g. 0.8) make output more random; lower values (e.g. 0.2) make it more deterministic.
10 <= value <= 2Maximum number of tokens to generate. On reasoning models, thinking tokens count toward this limit, so leave headroom.
1 <= valueOpenAI's current name for max_tokens, accepted with the same meaning; send either one. When both are sent, max_completion_tokens wins.
1 <= valueNucleus sampling parameter. The model considers tokens with the top top_p mass of the probability distribution.
10 <= value <= 1Reasoning-effort hint such as low, medium or high. Router One does not validate the value; on Claude Opus 5.5 (claude-opus-5-5 or anthropic/claude-opus-5.5) and Claude Sonnet 5.5 (claude-sonnet-5-5 or anthropic/claude-sonnet-5.5; observed 2026-10-31) it is mapped to Anthropic's output_config.effort: none and minimal become low, low through max pass through, and other values are ignored. Support varies by model — a model without a reasoning-effort control ignores it or rejects the request with 400 invalid_request, so check the model page before relying on it.
Streaming response options. Only valid when stream: true.
Hosted web search, accepted on google/gemini-3-flash only: send {} (or the equivalent tools: [{"type": "google_search"}] with tool_choice: "auto") and the model decides whether to search; the sources it grounded on come back as url_citation annotations (choices[0].message.annotations, or choices[0].delta.annotations when streaming), billed at the model's token rates. On every other model the field is forwarded as sent and the model's own validation applies.
Tool (function) declarations the model may call. Support varies by model — check the model's catalog entry before relying on it. On google/gemini-3-flash the array may also carry {"type": "google_search"} (hosted search; see web_search_options).
How the model picks a tool. auto lets the model decide, none disables tool calling, required forces some tool call, and an object naming one function forces that call. Whether a model accepts a forced choice is up to its vendor; for Claude Opus 5.5 (claude-opus-5-5 or anthropic/claude-opus-5.5) and Claude Sonnet 5.5 (claude-sonnet-5-5 or anthropic/claude-sonnet-5.5; observed 2026-10-31) Router One sends required or a named function as auto, so these models may answer in text; for JSON from them use output_config.format on /v1/messages.
Response format hint forwarded to the model. json_object asks for a JSON reply; json_schema additionally sends a JSON Schema. Router One validates the request shape only — a json_schema request without json_schema.name or json_schema.schema is rejected with 400 invalid_request before reaching the model — and does not validate or repair the model's output. Schema enforcement is the model's; support varies by model, so test with your target model. For Claude ids this field is not a reliable way to get JSON — use output_config.format on /v1/messages instead. See the structured outputs guide.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.router.one/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "auto", "messages": [ { "role": "user", "content": "Hello" } ] }'{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1700000000,
"model": "anthropic/claude-sonnet-4.6",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}{
"error": {
"message": "response_format.json_schema.name is required",
"type": "invalid_request_error",
"code": "INVALID_REQUEST",
"request_id": "290dd478f91d8aec68f7535e871376eb"
}
}{
"error": {
"message": "invalid api key",
"type": "authentication_error",
"code": "AUTH_INVALID_API_KEY",
"request_id": "290dd478f91d8aec68f7535e871376eb"
}
}{
"error": {
"message": "insufficient balance: top up at https://router.one/deposit",
"type": "billing_error",
"code": "INSUFFICIENT_BALANCE",
"request_id": "290dd478f91d8aec68f7535e871376eb"
}
}{
"error": {
"message": "rate limit exceeded",
"type": "rate_limit_error",
"code": "RATE_LIMIT_EXCEEDED",
"request_id": "290dd478f91d8aec68f7535e871376eb"
}
}{
"error": {
"message": "internal error",
"type": "api_error",
"code": "INTERNAL_ERROR",
"request_id": "290dd478f91d8aec68f7535e871376eb"
}
}