Theme
Chat Completions
Call GPT models with the OpenAI Chat Completions–compatible format. Supports a single complete response or SSE streaming. See Available models below for options.
http
POST /v1/chat/completionsUse the unified chat message format to call GPT and related upstream models. stream controls how results are returned: omit it or set false for a single complete chat.completion object (good for background jobs, structured output, and short Q&A); set true for SSE incremental chunks (good for live chat, agents, and long-form generation).
When stream is omitted, the request is treated as non-streaming. To require streaming, pass "stream": true explicitly.
The default model is .
Available models
| Model | Description |
|---|---|
| Flagship latest in the 5.6 series | |
| High-spec 5.5 series | |
| General-purpose 5.4 series | |
| Lightweight 5.4 | |
| Code-focused 5.3 | |
| Smaller 5-series variant | |
| General multimodal model | |
| General text / tool-calling model |
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| string | Yes | Request authentication. Use a Bearer token, for example: | |
| string | Yes | Request content type; must be |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| string | Yes | Model ID; default example . See Available models above | |
| array | Yes | Conversation messages in chronological order | |
| boolean | No | Whether to stream the response; defaults to non-streaming | |
| object | No | Streaming options; only effective when | |
| integer | No | Upper bound on generated tokens (visible output and reasoning tokens); recommended for reasoning models | |
| integer | No | Maximum generated tokens; deprecated, prefer | |
| number | No | Sampling temperature, range –, default | |
| number | No | Nucleus sampling, range –, default ; usually tune either or | |
| integer | No | Number of candidate results, range –, default | |
| string | array | No | Up to 4 stop sequences | |
| number | No | Range –, default | |
| number | No | Range –, default | |
| object | No | Bias map for token appearance probabilities | |
| boolean | No | Whether to return log probabilities for output tokens, default | |
| integer | No | –; requires to be | |
| integer | No | Random seed (Beta); best-effort deterministic sampling | |
| object | No | Output format; commonly used for JSON / structured output | |
| array | No | List of tools the model may call | |
| string | object | No | Controls tool calling: / / , or a specific function | |
| boolean | No | Whether to allow parallel tool calls, default | |
| string | No | Reasoning effort: / / / / / / | |
| string | No | Reply verbosity: / / ; supported by the GPT-5 series | |
| array | No | Output modalities, default ; audio models may include | |
| object | No | Audio output parameters; required when includes | |
| object | No | Predicted outputs configuration; can reduce latency for predictable content | |
| boolean | No | Whether to store this output, default | |
| object | No | Up to 16 key-value pairs of additional metadata | |
| string | No | Processing tier: / / / / / | |
| object | No | Web search options (search-capable models) | |
| string | No | Prompt cache key | |
| string | No | Stable end-user identifier, max 64 characters | |
| string | No | End-user identifier; deprecated, use / |
messages items
| Name | Type | Required | Description |
|---|---|---|---|
| string | Yes | , , , , or | |
| string | array | null | Yes | Plain text string, or a multimodal part array ( / / / , etc.); for tool calls, content may be | |
| string | No | Optional participant name | |
| array | No | only: list of tool calls initiated by the model | |
| string | Conditional | Required for messages: corresponding tool call ID |
stream_options
| Name | Type | Required | Description |
|---|---|---|---|
| boolean | No | Push an extra chunk containing before | |
| boolean | No | Stream obfuscation; normalizes payload size |
response_format
| Name | Type | Required | Description |
|---|---|---|---|
| string | No | (default), , or | |
| object | Conditional | Provide when is ; includes , , etc. |
tools items
| Name | Type | Required | Description |
|---|---|---|---|
| string | Yes | For function tools, always | |
| object | Yes | Includes , , (JSON Schema), and optional |
Request example
bash
curl -X POST https://octopusx.ai/v1/chat/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{ "role": "system", "content": "You are an API documentation assistant." },
{ "role": "user", "content": "Generate a short endpoint summary." }
],
"stream": false
}'bash
curl -X POST https://octopusx.ai/v1/chat/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{ "role": "user", "content": "Introduce Chat Completions in one sentence." }
],
"stream": true,
"stream_options": {
"include_usage": true
}
}'bash
curl -X POST https://octopusx.ai/v1/chat/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "Describe this image." },
{
"type": "image_url",
"image_url": { "url": "https://example.com/image.png" }
}
]
}
]
}'bash
curl -X POST https://octopusx.ai/v1/chat/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-terra",
"messages": [
{ "role": "user", "content": "Extract the contact name and email." }
],
"response_format": {
"type": "json_schema",
"json_schema": {
"name": "contact",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": { "type": "string" },
"email": { "type": "string" }
},
"required": ["name", "email"],
"additionalProperties": false
}
}
}
}'Response example
Non-streaming success
json
{
"id": "chatcmpl_abc123",
"object": "chat.completion",
"created": 1735689600,
"model": "gpt-5.6-terra",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This endpoint accepts unified chat messages and returns a single complete reply from the model."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 31,
"completion_tokens": 24,
"total_tokens": 55
}
}Streaming chunks (illustrative)
text
data: {"id":"chatcmpl_abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"This"},"finish_reason":null}]}
data: {"id":"chatcmpl_abc123","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" endpoint"},"finish_reason":null}]}
data: [DONE]Response fields
| Name | Type | Description |
|---|---|---|
| string | Response ID for this generation | |
| string | for non-streaming; for streaming | |
| integer | Creation timestamp (Unix seconds) | |
| string | Model ID actually used | |
| array | Array of candidate results | |
| object | Non-streaming: message generated by the model | |
| string | null | Text content; may be when tool calls are present | |
| array | Function tools the model requested to call | |
| object | Streaming: incremental content ( / / / ) | |
| string | Finish reason: , , , etc. | |
| object | Token usage; for streaming, depends on upstream support and often | |
| integer | Input token count | |
| integer | Output token count | |
| integer | Total token count |
Notes
TIP
Parameters marked as optional on this page are not necessarily supported by every model. Whether a field is forwarded and takes effect depends on the capabilities of the model that ultimately handles the request.
WARNING
Streaming responses use text/event-stream. Clients must parse SSE data: lines and treat data: [DONE] as the end marker.