Skip to main content

Create a chat completion

POST 

/v1/chat/completions

Routes an inference request to an AI provider via the Routing Service and returns a response.

With an Artemis option as the model, Artemis picks the model: it reads the prompt's task types, estimates each pool model's score for it and picks at that option's preset: artemis-cost (Cost), artemis-balanced (Balanced) or artemis-quality (Quality). "auto" is artemis-balanced, and "auto-artemis-task", "auto-v2" and "nuroute/artemis" mean the same as "auto". An option that is not enabled for your organization is a 400 naming the ones that are. When Artemis cannot decide, the fallback router decides and X-Router-Fallback says why. The fallback router cannot be chosen: "auto-apollo-tier" and "auto-v1" are a 400. Your region restrictions apply whichever router decides.

Responses carry these headers:

HeaderMeaning
X-Router-ModelThe model served
X-Router-VersionThe router that decided a model: "auto" request: v2 (Artemis) or v1 (the fallback router)
X-Router-Capability-VersionThe capability version Artemis decided with, e.g. cap-6
X-Router-FallbackWhy the fallback router decided instead of Artemis (see _routing.routerFallback)
X-Router-TierThe fallback router only: its predicted tier for the prompt (0 small, 1 medium, 2 large)
X-Router-ConfidenceThe fallback router only: its probability for that tier
X-Router-Tier-EscalatedThe fallback router only: the tier served, when it was higher than the predicted tier
X-Router-Estimated-SavingEstimated fraction saved versus the large-tier reference model, from the served model's price
X-Router-Reasoning-EffortThe reasoning_effort level the served model got, when you set one and its levels are known

Streamed responses carry the same headers.

For a specific model, pass its identifier (e.g. gpt-4o, claude-sonnet-4-6) — the Routing Service will select the appropriate provider automatically.

Use the optional provider field to pin a specific provider: no router runs. Combined with model: "auto", that provider serves its default model (the first it lists); name a model to choose it.

Set stream: true to receive a server-sent events (SSE) stream.

A project's policy and budget apply to its requests (those of a project-scoped API key, or naming the project with X-NuRoute-Project-ID). A model or provider its policy rules out is 403 policy_violation; with model: "auto" the routers pick only models, providers and regions it allows (422 no_available_model when none can serve). A max_tokens over the policy's limit is 400 invalid_request_error; without max_tokens the provider is asked for at most that limit. Once a hard-limited monthly budget is spent (UTC calendar month), requests are 402 budget_exceeded.

Requires Authorization: Bearer <token> where <token> is a JWT session token or an aicp-* API key.

Request​

Responses​

Default Response