🎁 New Sign up free, 10 calls on us. Up to $1, no card needed.

Chat Completions

POST /v1/chat/completions

Creates a model response for the given chat conversation. Compatible with the OpenAI Chat Completions API.

Request Body

ParameterTypeDescription
model*stringID of the model to use (e.g. gpt-5.4, qwen3.5-flash, gemini-2.5-flash).
messages*arrayList of messages in the conversation. Each item has role and content.
streambooleanIf true, return a stream of SSE events. Default: false.
temperaturenumberSampling temperature 0–2. Higher = more random. Default: 1.
max_tokensintegerMax tokens to generate. Model-dependent ceiling.
top_pnumberNucleus sampling probability. 0–1. Default: 1.
stopstring[]Up to 4 sequences where generation will stop.
nintegerNumber of completion choices to generate. Default: 1.

Example Request

POST /v1/chat/completions
Authorization: Bearer YOUR_API_KEY

{
  "model": "gpt-5.4-mini",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user",   "content": "What is the capital of France?"}
  ],
  "temperature": 0.7,
  "max_tokens": 256
}

Example Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1714000000,
  "model": "qwen3.5-flash",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 26,
    "completion_tokens": 9,
    "total_tokens": 35
  }
}

This endpoint routes to every provider behind the gateway — pick a model from the model price comparison to see per-token pricing side by side.