Chat Completions
/v1/chat/completions 是 OpenAI Chat Completions 兼容入口。OpenAI 分组会走 OpenAI 兼容链路,其他分组会按网关能力做协议转换。
接口说明
| 项目 | 值 |
|---|---|
| Method | POST |
| Path | /v1/chat/completions |
| Content-Type | application/json |
| 认证 | Authorization: Bearer YOUR_API_KEY |
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 请求模型。 |
messages | array | 是 | OpenAI Chat Completions 消息数组。 |
stream | boolean | 否 | 是否流式响应。 |
temperature | number | 否 | 采样温度,按上游支持情况透传。 |
max_tokens | integer | 否 | 最大输出 token,按上游支持情况透传。 |
请求示例
bash
curl https://llmapi.site/v1/chat/completions \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-5.1",
"messages": [
{ "role": "user", "content": "Hello" }
]
}'兼容路径
部分客户端使用无 /v1 前缀路径:
text
POST /chat/completions该路径与 /v1/chat/completions 指向同一类网关能力。