Chat completions
Request fields, message roles and response shape.
Draft format · Execution not enabled
POST /v1/chat/completions
A valid inference key currently receives 503 operation_not_enabled; an invalid key receives 401. The route does not validate the draft body or reserve funds yet.
Minimal body
This describes the current draft request format. Paid chat is not enabled; these examples do not generate a completion today.
{
"model": "MODEL_ID",
"messages": [
{
"role": "user",
"content": "Explain what an API is in one sentence."
}
],
"max_tokens": 256
}Fields
Use the exact model ID. These are draft schema bounds, not a guarantee that every model accepts every value. Unknown fields are excluded from this schema.
| Field | Type / bounds | Purpose |
|---|---|---|
model | string, 1–150 characters | Required public model ID. |
messages | array, 1–500 items | Required conversation history. |
max_tokens / max_completion_tokens | integer, 1–131072 | Output ceiling. Use one; model-specific limits can be lower. |
temperature | number, 0–2 | Sampling temperature. |
top_p | number, 0–1 | Nucleus sampling. |
stop | string or up to 8 strings | Each string up to 200 characters. |
stream | boolean | Request event-stream output. |
stream_options.include_usage | boolean | Request usage in the stream. |
tools, tool_choice | function definitions / selection | See Parameters & tools. |
response_format | text, json_object or json_schema | See Parameters & tools. |
reasoning_effort, reasoning | model-dependent | See Parameters & tools. |
Messages
Each message has role and content. Content is a string, null, or 1–100 text/image parts. Text strings are limited to 1,000,000 characters in the draft schema; token context limits still apply.
| Role | Use |
|---|---|
system, developer | Instructions. Model-specific handling must be checked. |
user | User input, optionally with image parts. |
assistant | Prior output, including tool_calls when needed. |
tool | Tool result with the matching tool_call_id. |
Completion shape
The draft response uses choices[].message and finish_reason, with optional token usage. Tool calls may have null text content. A uRouter accounting extension records request_id, nullable cost_usd, and accounting (pending or settled). This shape is not yet returned by the public route.