03 — Documentation
Chat Completions
POST /v1/chat/completions — the core endpoint, OpenAI-compatible.
Endpoint
POST /v1/chat/completions. Auth: Bearer API key. Content-Type: application/json.
Model field
Use "provider-slug/model-id" (for example "vialera/claude-fable-5.1") or just "model-id" when it is unambiguous. The gateway routes to the provider that serves that model. Unknown models return 404.
Response
A successful response follows the OpenAI shape: an object with id, object "chat.completion", created, model, choices (each with index, message {role, content}, finish_reason), and usage {prompt_tokens, completion_tokens, total_tokens}. The usage block comes from the provider; if the provider reports no usage, tokens are recorded as 0 and no charge is made.
Billing
Cost = input_tokens / 1,000,000 × input price + output_tokens / 1,000,000 × output price, using the model's published pricing. The amount is deducted from your wallet after a successful response. Before forwarding, the gateway checks your balance is at least the $0.0001 estimated minimum.
Fallback
If a fallback model is configured for your model and the provider fails with a 5xx error or a timeout, the gateway retries once on the fallback and discloses it in the X-Nexora-Fallback response header. It never silently swaps models.