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
| Item | Value |
|---|---|
| Method | POST |
| Path | /v1/chat/completions |
| Content-Type | application/json |
| Authentication | Authorization: Bearer YOUR_API_KEY |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Requested model. |
messages | array | Yes | OpenAI Chat Completions message array. |
stream | boolean | No | Whether to stream the response. |
temperature | number | No | Sampling temperature. Availability depends on the selected model. |
max_tokens | integer | No | Maximum 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/completionsThis path points to the same gateway capability as /v1/chat/completions.
Errors
| Status | Cause |
|---|---|
400 | Request body, model, or messages payload is invalid. |
401 | API key is missing or invalid. |
403 | Balance, quota, group, or subscription check failed. |
404 | Requested model or chat-compatible route is unavailable. |
429 | Rate limit or concurrency limit was reached. |
500 / 502 / 503 | Gateway or upstream provider failed. |