Skip to content

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/completions

Use 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

ModelDescription
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

NameTypeRequiredDescription
stringYesRequest authentication. Use a Bearer token, for example:
stringYesRequest content type; must be

Request body

NameTypeRequiredDescription
stringYesModel ID; default example . See Available models above
arrayYesConversation messages in chronological order
booleanNoWhether to stream the response; defaults to non-streaming
objectNoStreaming options; only effective when
integerNoUpper bound on generated tokens (visible output and reasoning tokens); recommended for reasoning models
integerNoMaximum generated tokens; deprecated, prefer
numberNoSampling temperature, range , default
numberNoNucleus sampling, range , default ; usually tune either or
integerNoNumber of candidate results, range , default
string | arrayNoUp to 4 stop sequences
numberNoRange , default
numberNoRange , default
objectNoBias map for token appearance probabilities
booleanNoWhether to return log probabilities for output tokens, default
integerNo; requires to be
integerNoRandom seed (Beta); best-effort deterministic sampling
objectNoOutput format; commonly used for JSON / structured output
arrayNoList of tools the model may call
string | objectNoControls tool calling: / / , or a specific function
booleanNoWhether to allow parallel tool calls, default
stringNoReasoning effort: / / / / / /
stringNoReply verbosity: / / ; supported by the GPT-5 series
arrayNoOutput modalities, default ; audio models may include
objectNoAudio output parameters; required when includes
objectNoPredicted outputs configuration; can reduce latency for predictable content
booleanNoWhether to store this output, default
objectNoUp to 16 key-value pairs of additional metadata
stringNoProcessing tier: / / / / /
objectNoWeb search options (search-capable models)
stringNoPrompt cache key
stringNoStable end-user identifier, max 64 characters
stringNoEnd-user identifier; deprecated, use /

messages items

NameTypeRequiredDescription
stringYes, , , , or
string | array | nullYesPlain text string, or a multimodal part array ( / / / , etc.); for tool calls, content may be
stringNoOptional participant name
arrayNo only: list of tool calls initiated by the model
stringConditionalRequired for messages: corresponding tool call ID

stream_options

NameTypeRequiredDescription
booleanNoPush an extra chunk containing before
booleanNoStream obfuscation; normalizes payload size

response_format

NameTypeRequiredDescription
stringNo (default), , or
objectConditionalProvide when is ; includes , , etc.

tools items

NameTypeRequiredDescription
stringYesFor function tools, always
objectYesIncludes , , (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

NameTypeDescription
stringResponse ID for this generation
string for non-streaming; for streaming
integerCreation timestamp (Unix seconds)
stringModel ID actually used
arrayArray of candidate results
objectNon-streaming: message generated by the model
string | nullText content; may be when tool calls are present
arrayFunction tools the model requested to call
objectStreaming: incremental content ( / / / )
stringFinish reason: , , , etc.
objectToken usage; for streaming, depends on upstream support and often
integerInput token count
integerOutput token count
integerTotal 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.