Chat
Create chat completion
Generate a model response for a conversation, as one JSON object or as a stream of Server-Sent Events.
https://api.numes.ai/api/v1/chat/completionsThe OpenAI Chat Completions shape, routed across provider endpoints. Conversation fields, reasoning state and ordinary generation extensions are forwarded to the upstream provider. Routing, cache isolation, privacy, execution and billing controls remain validated. Native adapters can reject conversation shapes they cannot translate. Send a fresh X-Request-Id on every request, or omit it; a reused ID returns 400 (see Request and generation IDs). Models qualified with :e2ee need the encrypted route; this route rejects them.
Guides: Parameters · Streaming · Tool calling · Structured outputs · Reasoning · Provider routing.
store may be omitted or set to boolean false; true, null and other types return 400. It doesn't require a provider capability and isn't forwarded. It doesn't change metadata retention or provider data policies; see Data retention.
Authorization
AuthorizationheaderRequired
Bearer inference key. Charges settle in the key's billing currency. Authorization: Bearer $NUMES_API_KEY
Headers
X-Request-IdstringCorrelation ID, not an idempotency key. Inference request IDs recorded with a generation are unique per account. A traffic-admitted request reusing a recorded ID returns 400 invalid_request. Traffic admission rejection takes precedence over this conflict, including for reused IDs; it performs no generation lookup and writes no generation, result or attempt. Rate-limit rejection returns 429 rate_limited with Retry-After; an inference limiter outage retains 500 server.
Length1–128
Request body
application/jsonThe contract declares a 10 MiB body limit. The size the service enforces is listed in Limits.
modelsarray<string>Phase 1 accepts one model through either model or models; alternative-model fallback is rejected.
Items1–1Itemlength ≤ 393Itempattern ^[a-z0-9][a-z0-9._-]{0,99}/[A-Za-z0-9][A-Za-z0-9._:-]{0,291}$messagesarray<object>ShowHide9 child attributes
storeenum<boolean>Only false is accepted, equivalent to omission. Stored completions are unsupported. This field is not forwarded and does not change billing metadata or provider retention policies; use provider.zdr and provider.data_collection for provider privacy requirements.
DefaultfalseValuefalseninteger | nullOnly one response choice is supported. Omit or send 1; larger counts are rejected before dispatch.
Range1–1usageobjectDeprecatedLegacy usage opt-in accepted for OpenRouter SDK clients. Usage is always returned regardless of include.
prompt_cache_keystringPrivacy-sensitive cache affinity input. The gateway forwards only its keyed digest.
Length1–256stopstring | array<string> | any | nullOne of 2 shapes
ShowHideOption 1string
A string value.
ShowHideOption 2array<string>
A array<string> value.
toolsarray<object>One of 3 shapes
ShowHidetype: "function"object
ShowHideCommon Hosted Toolobject
ShowHidetype: "hosted"object
idenum<string>Required- One of
openrouter.web_search@1openrouter.web_fetch@1openrouter.datetime@1openrouter.image_generation@1openrouter.apply_patch@1openrouter.fusion@1openrouter.advisor@1openrouter.subagent@1openai.web_search@1openai.file_search@1openai.code_interpreter@1openai.image_generation@1openai.shell@1openai.mcp@1openai.connectors@1openai.tool_search@1openai.skills@1anthropic.web_search@1anthropic.web_fetch@1anthropic.code_execution@1anthropic.advisor@1anthropic.tool_search@1anthropic.mcp@1google.search@1google.maps@1google.url_context@1google.file_search@1google.code_execution@1
tool_choiceenum<string> | objectEnforced by the gateway and not forwarded as an Ollama generation option.
parallel_tool_callsbooleanEnforced by the gateway; false rejects a response containing multiple calls.
include_reasoningbooleanDeprecatedDeprecated compatibility alias for the inverse of reasoning.exclude.
providerobjectShowHide11 child attributes
Responses
200JSON completion when stream is false, otherwise SSE chunks followed by data colon space bracket DONE bracket.application/jsontext/event-stream
Headers
BodyChatCompletionResponseapplication/json
usageobjectRequiredShowHide16 child attributes
costnumberRequiredSettled cost in the inference key's immutable billing currency. For BTC keys, 1 is one satoshi and precision is one micro-satoshi.
Range≥ 0usage_meterstringOpaque identifier of the billing basis this request was charged under. Treat it as a label; the charged amounts are in the cost fields.
gateway_billing_unitsobjectHistorical gateway billing quantities; absent for current native-meter inference.
native_tokensobjectValidated upstream native-token usage. Current native meters price these counts; reasoning partitions completion and cache partitions prompt.
text/event-stream — SSE frames containing ChatCompletionChunk JSON and a terminal data colon space bracket DONE bracket frame.
503No eligible provider can serve the request. Unknown, unpublished, currency-mismatched and unauthorized shared model IDs receive the same bounded response (`error.code` 503, `error.metadata.error_type` "provider_unavailable", message "no provider is available"). Inference and encrypted resolution do not classify model existence after routing fails. Earlier validation and authorization errors remain unchanged. An interrupted server execution while the original HTTP caller remains connected also uses 503 provider_unavailable with the fixed message "service temporarily unavailable". Once streaming has started, the error is in-band and the HTTP status remains 200. If an otherwise eligible USD-indexed Bitcoin offer is blocked by an unavailable market reference, or its reference expires before dispatch, the response instead uses 503 with error_type "bitcoin_reference_price_unavailable" and message "Bitcoin pricing is unavailable. Try again shortly."application/json
ErrorCompatible error envelopeapplication/json
Headers