POST
https://nezhagate.com/v1/chat/completions
OpenAI 兼容的对话补全接口,承载 Moonshot Kimi K3 —— 擅长长文本、多文档分析与 Agent 的新一代旗舰。始终开启思考,思考过程在 message.reasoning_content 返回,思考 token 按输出价计入 usage.completion_tokens。采样温度由模型固定,temperature / top_p 会被忽略。支持工具调用、流式输出与提示缓存。只需把 model 设为 kimi-k3;目前仅提供 /v1/chat/completions。
在 Playground 试用 →认证
Authorization: Bearer YOUR_API_KEY Content-Type: application/json
在控制台创建 API Key 后即可调用。
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| model | string | 是 | 模型 ID,此处为 kimi-k3。 |
| messages | array | 是 | 对话消息数组,每项含 role(system/user/assistant)与 content。content 可为字符串,或由 {type:text} 与 {type:image_url} 组成的数组以识别图片(多模态/Vision)。 |
| stream | boolean | 否 | 是否以 SSE 流式返回。默认 false。 |
| temperature | number | 否 | Kimi K3 的采样温度由模型固定,此参数会被网关忽略(不会报错)。 |
| max_tokens | integer | 否 | 最大生成 token 数。 |
| web_search | boolean | 否 | 设为 true 开启联网搜索:网关会先用实时搜索补充资料、再让模型作答并附来源链接(也可在 tools 里传 {"type":"web_search"} 触发)。 |
请求示例
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "kimi-k3", "messages": [{"role": "user", "content": "Hello"}], "stream": false}'响应示例
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"model": "kimi-k3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"reasoning_content": "The user is greeting me, so a short friendly reply fits...",
"content": "Hello! How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 42,
"total_tokens": 51,
"completion_tokens_details": {"reasoning_tokens": 31}
}
}图片识别(Vision)
在 messages 的 content 数组里传入图片,即可让模型识别图片内容(看图问答、读图中文字/OCR 等)。image_url 支持公网图片链接,或 base64 内联(data:image/png;base64,...)。多模态模型可用(gpt-5.5、gemini 系列等)。
curl https://nezhagate.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model": "kimi-k3", "messages": [{"role": "user", "content": [{"type": "text", "text": "这张图里有什么?"}, {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}]}]}'错误码
错误体统一为 error.message / error.type / error.code / error.param;请按 code 分支,完整清单见接入指南。
| HTTP | code | 说明 |
|---|---|---|
| 401 | invalid_api_key | API Key 缺失或无效 |
| 402 | insufficient_quota | 余额不足或 Key 超出限额 |
| 400 | invalid_request | 模型或参数不支持 |
| 429 | rate_limit_exceeded | 上游限流 |
| 502 | upstream_error | 所有上游线路失败 |