Chat Completions
POST /v1/chat/completions — chat completion, OpenAI-compatible.
Request parameters
| Param | Type | Required | Notes |
|---|---|---|---|
| model | string | yes | auto, or a model ID |
| messages | array | yes | Standard OpenAI message array |
| stream | bool | no | Defaults to false |
| temperature | number | no | 0–2 |
| max_tokens | int | no | Output cap |
| tools | array | no | Function 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
}'