Skip to content
Router One
Skip to content
Router One

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` for smart routing. When `model` is `auto`, Router One selects from a server-owned candidate set under the active gateway policy.

POST
/v1/chat/completions
AuthorizationBearer <token>

Authenticate with your API Key. Get your API Key in the Router One console; the format is sk-xxx.

In: header

modelstring

Model ID. Set to auto to use the server-owned candidate set under gateway policy, or specify a model such as openai/gpt-5.5 or anthropic/claude-sonnet-5 (copy IDs from the model catalog). Most official bare names (for example gpt-5.5 or claude-sonnet-5) are accepted as aliases of the catalog id; copy the catalog id from /models to be safe.

messages

Chat messages, in chronological order.

Items1 <= items
stream?boolean

Whether to enable streaming response. When enabled, returns an SSE event stream.

Defaultfalse
temperature?number

Sampling temperature, range 0-2. Higher values (e.g. 0.8) make output more random; lower values (e.g. 0.2) make it more deterministic.

Default1
Range0 <= value <= 2
max_tokens?integer

Maximum number of tokens to generate.

Range1 <= value
top_p?number

Nucleus sampling parameter. The model considers tokens with the top top_p mass of the probability distribution.

Default1
Range0 <= value <= 1
reasoning_effort?string

Reasoning-effort hint such as low, medium or high. Forwarded to the model exactly as sent; Router One does not validate or remap the value. 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.

stream_options?

Streaming response options. Only valid when stream: true.

web_search_options?object

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.

tools?

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).

tool_choice?string|

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.

response_format?

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. 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": "Request blocked: sexual content involving minors violates the model provider's acceptable use policy. The request was not sent to the model and was not billed. If you believe this is an error, contact support with the request id.",
    "type": "invalid_request_error",
    "code": "CONTENT_FILTERED",
    "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"
  }
}