Documentation

POST /v1/chat/completions in the NexoRouter documentation.

POST /v1/chat/completions

Status: Stable public endpoint.

Creates one OpenAI-compatible chat completion.

Endpoint

POST https://api.nexorouter.com/v1/chat/completions
Authorization: Bearer YOUR_NEXOROUTER_API_KEY
Content-Type: application/json

Request body

FieldTypeRequiredNotes
modelstringyesCopy the exact ID from Models or GET /v1/models.
messagesarrayyesNon-empty OpenAI-compatible message list.
temperaturenumberno0 to 2.
top_pnumberno0 to 1.
max_tokensintegernoPositive integer.

Minimal curl

curl https://api.nexorouter.com/v1/chat/completions \
  -H "Authorization: Bearer $NEXOROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      { "role": "user", "content": "Write one short launch checklist." }
    ],
    "max_tokens": 256
  }'

Response shape

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Create an API key, choose a model, test in Playground, and monitor usage logs."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 18,
    "total_tokens": 38
  }
}

Verify in Usage Logs

After a request succeeds or fails, confirm the log entry includes the API key name, model ID, status, token counts, cost, latency, and request ID.

POST /v1/chat/completions — NexoRouter