Skip to main content
Send a list of messages, name a model, get a reply in the OpenAI chat-completions shape. The model ID carries the privacy level.

Endpoint

POST /v1/chat/completions accepts OpenAI-compatible requests. Unknown fields at gateway-owned objects are dropped for compatibility. A control the model cannot honor returns 400 invalid_request before any usage is reserved.

Request

Only messages is required. n: 1 and store: false are accepted as no-ops. n above 1, store: true, and audio output are rejected. The same feature sent twice (for example web_search as a field and as a tool) is rejected. A model’s supported optional controls are in supported_parameters on its catalog entry. The supports query can filter for controls such as json_mode; structured_outputs qualifies response_format rather than naming a top-level request field. See Model Discovery.

Messages

Each message has role and content. Roles: system, user, assistant, tool, developer. A tool message pairs with a tool_call_id. content is a string or an array of parts for multimodal input.

Suffixes on the Model ID

Clients that can only set model can carry a few controls in the ID: z-ai/glm-5.2?reasoning_effort=high, moonshotai/kimi-k3?web_search=auto. Suffix and body must agree when both are present. The suffix is stripped before routing. See Model ID Convention.

Example

For attested hardware, use a :confidential variant, for example "model": "moonshotai/kimi-k3:confidential". GET /v1/models lists their :confidential IDs. See Privacy Levels.

Response

  • Exactly one choice. Read choices[0].
  • finish_reason: stop, length, tool_calls, or error.
  • system_fingerprint is always null.
  • usage: prompt_tokens, completion_tokens, total_tokens, plus reasoning_tokens, server_tool_use, cached-token details, and customer_cost when relevant. See Check Usage.

Errors

Validation problems return 400 with {"error": {"message", "code", "param"}}. Non-POST requests return 405 with Allow. All responses carry Cache-Control: no-store. See the error reference.

Other Text Endpoints

Tool Calling

Function calls.

Reasoning

Think first.

Streaming

Token by token.

Privacy Levels

The four levels.

Chat Completions Endpoint

Schema reference.

Model ID Convention

IDs and suffixes.