Chat Completions
POST /v1/chat/completions — 对话补全(OpenAI 兼容)。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | auto 或模型 ID |
| messages | array | 是 | OpenAI 消息数组 |
| stream | bool | 否 | 默认 false |
| temperature | number | 否 | 0-2 |
| max_tokens | int | 否 | 输出上限 |
| tools | array | 否 | 函数调用(支持模型) |
响应
与 OpenAI 格式一致:choices[0].message.content / usage(prompt_tokens, completion_tokens)。流式返回 delta。
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": "你好!"}],
"stream": true
}'