PineRouterDocs
GuidesModelsAPI referenceApps

Chat completions

POST
/v1/chat/completions

Authorization

BearerAuth

AuthorizationBearer <token>

Bearer token authentication. Format: Authorization: Bearer sk-xxxxxx

In: header

Request Body

application/json

model*string

Model id

messages*

Conversation messages

temperature?number

Sampling temperature

Default1
Range0 <= value <= 2
top_p?number

Nucleus sampling (top_p)

Default1
Range0 <= value <= 1
n?integer

Number of results

Default1
Range1 <= value
stream?boolean

Stream the response

Defaultfalse
stream_options?
stop?string|

Stop sequences

max_tokens?integer

Maximum tokens to generate

max_completion_tokens?integer

Maximum completion tokens

presence_penalty?number
Default0
Range-2 <= value <= 2
frequency_penalty?number
Default0
Range-2 <= value <= 2
logit_bias?
user?string
tools?
tool_choice?string|
response_format?
seed?integer
reasoning_effort?string

Reasoning effort (for reasoning models)

Value in"low" | "medium" | "high"
modalities?array<string>
audio?

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://pinerouter.ai/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "gpt-5-2",    "messages": [      {        "role": "user",        "content": "Explain DNS in one sentence."      }    ],    "max_tokens": 200  }'
{
  "id": "string",
  "object": "chat.completion",
  "created": 0,
  "model": "string",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "system",
        "content": "string",
        "name": "string",
        "tool_calls": [
          {
            "id": "string",
            "type": "function",
            "function": {
              "name": "string",
              "arguments": "string"
            }
          }
        ],
        "tool_call_id": "string",
        "reasoning_content": "string"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  },
  "system_fingerprint": "string"
}
{
  "error": {
    "message": "string",
    "type": "string",
    "param": "string",
    "code": "string"
  }
}
{
  "error": {
    "code": "",
    "message": "Invalid token (request id: 20261102053704107200635868d9d6m7EOL5JK)",
    "type": "api_error"
  }
}
{
  "error": {
    "code": "",
    "message": "This token has no access to model gpt-5-2 (request id: 20261102053704107200635868d9d6m7EOL5JK)",
    "type": "api_error"
  }
}
{
  "error": {
    "code": "",
    "message": "You have reached the request limit: maximum 60 requests in 1 minutes (request id: 20261102053704107200635868d9d6m7EOL5JK)",
    "type": "api_error"
  }
}
{
  "error": {
    "code": "bad_response_status_code",
    "message": "bad response status code 500 (request id: 20261102053704107200635868d9d6m7EOL5JK)",
    "type": "api_error",
    "param": ""
  }
}