Skip to main content
POST
Direct Chat Completions

Error Reference: Direct Completions

Common errors: unknown model, missing messages, context window exceeded, provider rate limit, provider timeout, provider unavailable.

Authorizations

Authorization
string
header
default:<api-key>
required

Bearer authentication header of the form Bearer <api-key>, where <api-key> is your API key.

Headers

X-Cache-TTL
string | null

Body

application/json

OpenAI-compatible chat completion request. Both messages and model are required; all other fields are optional and forwarded to the selected provider as-is.

messages
Messages · object[]
required

Chat messages array

model
string
required

Gloo model ID (e.g. 'gloo-anthropic-claude-opus-5.5')

stream
boolean | null
default:false

Enable streaming

max_tokens
integer | null

Maximum tokens to generate

temperature
number | null

Sampling temperature

top_p
number | null

Nucleus sampling parameter

frequency_penalty
number | null

Frequency penalty

presence_penalty
number | null

Presence penalty

stop
any | null

Stop sequences

tools
Tools · object[] | null

Tool definitions. Supported tool types: 'function' (custom function tools), native web search (any 'web_search'-prefixed type), and 'image_generation'; other tool types are rejected with a validation error.

tool_choice
any | null

Tool choice strategy

response_format
Response Format · object | null

Response format

stream_options
Stream Options · object | null

Streaming options, e.g. {include_usage: true} to receive a usage SSE chunk at the end of the stream.

parallel_tool_calls
boolean | null

Whether to enable parallel function calling. Stripped automatically when tools is missing, null, or empty.

reasoning_effort
enum<string> | null

How much a reasoning model thinks before it answers, from least to most. The levels a given model takes are in its reasoning.effort_levels on GET /platform/v2/models. A level the model does not take normally runs at the nearest level it does; on Gemini 2.5 models xhigh and max can be refused with a 400, so send high. See the Reasoning guide (/api-guides/reasoning).

Available options:
none,
minimal,
low,
medium,
high,
xhigh,
max
prompt_cache_key
string | null

OpenAI Responses API cache key. Enables persistent prompt caching.

Response

Successful direct Chat Completion. If stream is false or omitted, the response is JSON. If stream=true, the response is a Server-Sent Events stream.

A non-streaming OpenAI-compatible Chat Completion returned by the selected model.

id
string
required

Unique completion identifier.

object
string
default:chat.completion
required

Object type, always chat.completion.

Allowed value: "chat.completion"
created
integer
required

Unix timestamp when the completion was created.

model
string
required

Model that generated the completion.

choices
Completion Choice · object[]
required

Completions generated by the model.

usage
Usage · object | null

Token usage when supplied by the provider.

service_tier
string | null
system_fingerprint
string | null
ignored_params
Ignored Parameters · object

Parameters that were ignored or not applied as sent, such as sampling parameters the selected model does not take. The request still succeeds.