Skip to main content
OpenAI-compatible chat completions, routed through OpenRouter. The request body is OpenRouter’s (a superset of OpenAI’s) and is forwarded as-is — see OpenRouter’s API reference for every field. Set stream: true for Server-Sent Events.
model
string
required
Model id with provider prefix, e.g. anthropic/claude-sonnet-4.6, openai/gpt-5.2.
messages
array
OpenAI-style chat messages: [{ role, content }]. Either messages or prompt is required.
prompt
string
Plain-text prompt (alternative to messages).
models
string[]
Optional fallback chain — OpenRouter tries these in order if earlier models are unavailable.
provider
object
OpenRouter provider routing preferences (order, only, ignore, sort, allow_fallbacks, data_collection, …).
stream
boolean
default:"false"
Stream the response as SSE. The final chunk carries the usage (incl. cost).
temperature
number
Sampling temperature (0–2). top_p, max_tokens, stop, seed, tools, tool_choice, response_format, etc. are also forwarded.
curl -X POST https://api.usenaive.ai/v1/llm/chat/completions \
  -H "Authorization: Bearer nv_sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4.6",
    "messages": [{ "role": "user", "content": "Summarize REST in one line." }],
    "models": ["anthropic/claude-sonnet-4.6", "openai/gpt-5.2"],
    "provider": { "sort": "throughput" }
  }'
{
  "id": "gen-xxxxxxxx",
  "object": "chat.completion",
  "created": 1749600000,
  "model": "anthropic/claude-sonnet-4.6",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": { "role": "assistant", "content": "REST is a stateless, resource-oriented HTTP API style." }
    }
  ],
  "usage": { "prompt_tokens": 14, "completion_tokens": 16, "total_tokens": 30, "cost": 0.00012 },
  "credits_used": 0.0003,
  "credits_remaining": 99.9
}
Cost: per-token, derived from OpenRouter’s returned usage.cost × markup (see Credits). Charged after completion (after the final SSE chunk for streams).
Prefer to keep your existing OpenAI/OpenRouter SDK? Point its baseURL at https://api.usenaive.ai/v1/proxy/openrouter and authenticate with your Naive api key — a transparent, drop-in passthrough. See Use Naive instead of OpenRouter.