Skip to main content
POST
Chat Completions

Create Chat Completion

Creates a model response for the given chat conversation. Requests are served through the attested TEE gateway, which does not retain request bodies. A confidential response additionally runs on a verified upstream enclave, confirmed per response from the receipt’s upstream.verified event. The response includes an x-receipt-id header for verification.
Try it now! Click the “Try it” button above to test the API in the playground. You’ll need:
  1. Your API key (add it when prompted)
  2. Fill in messages like: [{"role":"user","content":"Hello"}]

Request Body

string
default:"z-ai/glm-5.1"
required
Model ID to use for completionExamples: z-ai/glm-5.1, z-ai/glm-5, qwen/qwen3.5-27b, openai/gpt-5, anthropic/claude-sonnet-4.5
array
required
Array of message objects. Each message needs role and content.Example:
With system message:
number
Sampling temperature (0-2), default 1
integer
Maximum tokens to generateNote: Newer models (GPT-5, O3, O4) use max_completion_tokens instead. See note below.
integer
Maximum completion tokens (for GPT-5, O3, O4 models)Use this parameter instead of max_tokens for newer OpenAI models:
  • openai/gpt-5, openai/gpt-5-mini, openai/gpt-5-nano
  • openai/o3, openai/o4-mini
boolean
Stream responses, default false
number
Nucleus sampling (0-1)
integer
Number of completions, default 1
number
Presence penalty (-2 to 2)
number
Frequency penalty (-2 to 2)
object
Routing constraints for this request. Fields are applied together, and the request is served only by a provider that satisfies all of them.zdr (boolean): set true to route only to providers that operate under zero data retention, meaning they do not retain prompt or completion content after serving the request. false, or omitting the field, applies no retention constraint.
If no provider for the model satisfies the constraint, the request returns 404 and no prompt is sent. The constraint is enforced for the whole request, including failover, so a retry cannot fall back to a provider that does not satisfy it.Find models that can satisfy zdr ahead of time with GET /v1/models?zdr=true. See Zero data retention.aci_verified (boolean): set true to route only to an upstream the gateway verified inside the TEE before sending the prompt. false, or omitting the field, applies no attestation constraint.
If no upstream for the model is both classified as attested and currently verified, the request returns 503 and no prompt is sent. X-Upstream-Verification: none cannot relax this constraint.aci_session_ids (array of strings): restrict the request further to specific attested channels, identified by the session ids from GET /v1/aci/sessions. Any one of the listed ids may serve the request; if none matches a currently verified channel, the request returns 503.
Session ids imply aci_verified. Passing them with "aci_verified": false returns 400, as does an empty array or a non-string entry. Both fields are read by the gateway and removed before the request reaches a provider. See Attested routing.

Message Object

Example Requests

Response

Important: Parameter Difference for Newer ModelsGPT-5, O3, and O4 models require max_completion_tokens instead of max_tokens:
Affected models:
  • openai/gpt-5, openai/gpt-5-mini, openai/gpt-5-nano
  • openai/o3, openai/o4-mini
Other models (use max_tokens):
  • All GPT-4.1 models, Claude models, Gemini, DeepSeek, and GPU TEE models

Streaming

Enable stream: true for real-time responses:

Vision (Multimodal)

Use vision models with images:

Function Calling

Define tools/functions for the model to call:

Function Calling Guide

Learn more about function calling →

Error Handling

Supported Models

  • GPU TEE: z-ai/glm-5.1, z-ai/glm-5, qwen/qwen3.5-27b
  • OpenAI: openai/gpt-5, openai/gpt-5-mini, openai/o4-mini
  • Anthropic: anthropic/claude-sonnet-4.5, anthropic/claude-opus-4.1
  • Google: google/gemini-2.5-pro
  • Meta: meta-llama/llama-3.3-70b-instruct
  • A broad range of models

All Models

View all supported models →