Chat Completions
Call text models with an OpenAI Chat Completions compatible API.
POST /v1/chat/completions is for text models only, not image or video generation. Use a public model ID returned by GET /v1/models.
Overview
| Item | Description |
|---|---|
| Route | POST /v1/chat/completions |
| Authentication | Authorization: Bearer sk_yeehoo_xxx |
| Idempotency | Idempotency-Key recommended |
| Body | application/json |
| Response | 200 OK, or SSE when stream=true |
Text versus media
Text models use Chat Completions or Responses. Image and video tasks use asynchronous POST /v1/generations.
Request
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Public text model ID from /v1/models |
messages | array | Yes | Ordered multi-turn messages |
temperature | number | No | Sampling randomness, when supported by the model schema |
max_tokens / max_completion_tokens | integer | No | Output token limit |
stream | boolean | No | Return SSE deltas; defaults to false |
reasoning | object | No | Reasoning configuration such as { "effort": "high" } |
System instructions
Do not send a custom systemPrompt field. Put the system instruction in messages with role: "system":
{
"model": "gpt_5_6_luna",
"messages": [
{ "role": "system", "content": "You are a precise programming assistant." },
{ "role": "user", "content": "Write a Python example." }
]
}The system message is optional. For a continuing conversation, send prior user and assistant messages in order.
Streaming
Set stream to true to receive text/event-stream deltas, ending with [DONE]:
data: {"id":"chatcmpl_123","choices":[{"delta":{"content":"Here is"}}]}
data: {"id":"chatcmpl_123","choices":[{"delta":{"content":" a Python example."}}]}
data: [DONE]Common errors
- Model not found or not authorized.
- No available route.
- Unsupported parameter.
- Insufficient balance.
- Upstream failure.
Use asynchronous POST /v1/generations for image and video tasks.