Browse documentation

Create a text completion (legacy prompt format).

Create a text completion (legacy prompt format).

POST
/v1/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

curl -X POST "https://example.com/v1/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "prompt": "string"  }'
{  "id": "cmpl-abc123",  "object": "text_completion",  "model": "gpt-4o-mini",  "choices": [    {      "text": " there!",      "index": 0,      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 2,    "completion_tokens": 2,    "total_tokens": 4  }}
Was this page helpful?