POST
https://nezhagate.com/v1/chat/completions
OpenAI 兼容的对话补全接口,支持流式输出(stream)、多轮对话与结构化任务。仅需更换 model 字段即可在不同对话模型间切换。
在 Playground 试用 →认证
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
在控制台创建 API Key 后即可调用。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型 ID,固定为 gpt-5.5。 |
| messages | array | 是 | 对话消息数组,每项含 role(system/user/assistant)与 content。 |
| stream | boolean | 否 | 是否以 SSE 流式返回。默认 false。 |
| temperature | number | 否 | 采样温度,0–2,越高越随机。 |
| max_tokens | integer | 否 | 最大生成 token 数。 |
请求示例
curl https://nezhagate.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [{"role": "user", "content": "Hello"}],
"stream": false
}'响应示例
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"model": "gpt-5.5",
"choices": [
{"index": 0, "message": {"role": "assistant", "content": "Hello!"}, "finish_reason": "stop"}
],
"usage": {"prompt_tokens": 11, "completion_tokens": 7, "total_tokens": 18}
}错误码
| Code | 说明 |
|---|---|
| 401 | Invalid or missing API key |
| 402 | Insufficient balance / key limit reached |
| 400 | Invalid parameters or model |
| 429 | Rate limited |
| 502 | All upstream providers failed |