Chat Completions

POST /v1/chat/completions — chat completion, OpenAI-compatible.

Request parameters

ParamTypeRequiredNotes
modelstringyesauto, or a model ID
messagesarrayyesStandard OpenAI message array
streamboolnoDefaults to false
temperaturenumberno0–2
max_tokensintnoOutput cap
toolsarraynoFunction calling (on models that support it)

Response

Identical to the OpenAI shape: choices[0].message.content and usage (prompt_tokens, completion_tokens). Streaming returns deltas.

curl https://api.aigateway.ltd/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${AIGATEWAY_API_KEY}" \
  -d '{
    "model": "auto",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'