POST https://nanorouter-wcg9d.ondigitalocean.app/v1/chat/completions

Generates a completion. Requires an API key; a Privy session will not work here.
The request body is capped at 2 MB.

Body

string
default:"gpt-5.6-terra"
One of the ids from GET /v1/models. An unknown name is a 404, not a fallback.
array
required
Non-empty. Each entry needs a role of system, developer, user, assistant, or tool.content must be a string or an array of {"type": "text", "text": "…"} parts. Image and audio parts are refused.Leading system / developer messages become the model’s instructions; later ones keep their position in the conversation. An assistant message may carry tool_calls; a tool message requires tool_call_id.
integer
default:"8192"
Clamped to the model’s ceiling — see Pricing.
This is what you are quoted. The hold against your balance is priced at max_tokens, not at what the model writes. Name a real ceiling.
boolean
default:"false"
Server-Sent Events, terminated by data: [DONE]. See Streaming.
object
{"include_usage": true} appends a final chunk carrying token counts.
array
Standard OpenAI function definitions.Sending your own tools suppresses the router’s web_search and web_fetch injection, unless you re-enable them explicitly.
string | object
default:"auto"
auto, none, required, or {"type": "function", "function": {"name": "…"}}.
boolean
Passed upstream when set.
object
{"type": "text"}, {"type": "json_object"}, or {"type": "json_schema", "json_schema": {"name": "…", "schema": {…}, "strict": true}}.Any other type is a 400.
string
default:"low"
none · minimal · low · medium · high · xhigh.Defaults to low because the upstream’s own default spends seconds thinking before the first token on trivial prompts — and reasoning is billed as output tokens.Reasoning summaries stream as delta.reasoning_content.
number
Passed upstream when set.
string
Truncated to 128 characters. When absent the router sets a per-request key of its own, so multi-round tool requests hit the upstream prompt cache.
Non-standard. Defaults to on when you send no tools of your own, and off when you do. Requires a configured provider. See Web search.
boolean
Non-standard. Same default as web_search.
n must be 1 or absent. n > 1 is a 400.top_p, presence_penalty, frequency_penalty, seed, logprobs, stop, logit_bias and user are accepted by the parser but not forwarded upstream. Do not rely on them taking effect.

Response

finish_reason is stop, length, tool_calls, or content_filter.

Headers

string
The ledger row for this call. Resolve it at GET /api/requests/{id} for the settled cost, the token counts, and the inference-versus-search split.
string
What was held up front, in atomic USDC — 6 decimal places, so 2400 is $0.0024.
string
What it actually cost. Non-streaming responses only, and only when the response finishes inside 45 seconds — on a stream the figure is not known until the last token, and on a slow buffered request the keepalive has already committed the headers. Absent in both cases.
All three are exposed via CORS, so browser JavaScript can read them.

Errors

The envelope is OpenAI’s:

Full error reference

What each one means and whether to retry.