Browse documentation

Create a chat completion (streaming or not).

Create a chat completion (streaming or not).

POST
/v1/chat/completions

Authorization

NRouterApiKey
AuthorizationBearer <token>

Your nRouter virtual key (sk-nrouter-…). Sent as Authorization: Bearer sk-nrouter-….

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "messages": [      {        "role": "system",        "content": "string"      }    ]  }'
{  "id": "chatcmpl-abc123",  "object": "chat.completion",  "model": "gpt-4o",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "Hello!"      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 9,    "completion_tokens": 2,    "total_tokens": 11  }}
Was this page helpful?