Skip to content

Chat Completions

/v1/chat/completions is the OpenAI Chat Completions compatible entrypoint. OpenAI groups use the OpenAI-compatible path; other groups are converted by the gateway when supported.

Interface

ItemValue
MethodPOST
Path/v1/chat/completions
Content-Typeapplication/json
AuthenticationAuthorization: Bearer YOUR_API_KEY

Request Parameters

ParameterTypeRequiredDescription
modelstringYesRequested model.
messagesarrayYesOpenAI Chat Completions message array.
streambooleanNoWhether to stream the response.
temperaturenumberNoSampling temperature. Availability depends on the selected model.
max_tokensintegerNoMaximum output tokens. Availability depends on the selected model.

Request Example

bash
curl https://api.llmapi.site/v1/chat/completions \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gpt-5.1",
    "messages": [
      { "role": "user", "content": "Hello" }
    ]
  }'

Response — 200 OK

json
{
  "id": "chatcmpl_123",
  "object": "chat.completion",
  "model": "gpt-5.1",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 4,
    "total_tokens": 16
  }
}

When stream is true, the response uses OpenAI Chat Completions-compatible SSE chunks.

Compatible Path

Some clients use the path without /v1:

text
POST /chat/completions

This path points to the same gateway capability as /v1/chat/completions.

Errors

StatusCause
400Request body, model, or messages payload is invalid.
401API key is missing or invalid.
403Balance, quota, group, or subscription check failed.
404Requested model or chat-compatible route is unavailable.
429Rate limit or concurrency limit was reached.
500 / 502 / 503Gateway or upstream provider failed.