Kimi K3 是月之暗面旗舰模型, 1M token 上下文, 始终开启思考模式, 面向长程编程与端到端知识工作. OpenAI 兼容 /v1/chat/completions.
POST /v1/chat/completions
## Kimi K3 Kimi K3 是月之暗面 (Moonshot) 面向长程编程与端到端知识工作的旗舰模型, 支持 **1M (1,048,576) token** 上下文, 综合智能领先. - **始终开启思考**: K3 默认产生 `reasoning_content` 推理内容, 这部分推理 token **计入输出 token 消耗**, 因此实际输出用量会高于最终可见回答的文字量. - 支持 **工具调用 (tools / tool_choice)**、**JSON Mode / 结构化输出 (response_format)**、**联网搜索**、**Partial Mode**、**动态加载工具**. - 通过顶层 `reasoning_effort` 配置推理力度 (当前仅 `max` 档位). - 自动上下文缓存: 命中的输入 token 会在 `usage.prompt_tokens_details.cached_tokens` 中返回. ### 调用地址 ``` POST https://api.router.ai/v1/chat/completions Authorization: Bearer sk-your-api-key Content-Type: application/json ```
model | string | required | 模型 ID, 固定 `kimi-k3` |
messages | array | required | OpenAI 兼容多轮对话数组, 每个元素含 `role` (system/user/assistant/tool) + `content` (string 或多模态数组), 按时间顺序传入 |
reasoning_effort | string | 推理力度, 当前仅支持 `max`. 省略则使用默认思考行为 | |
max_tokens | integer | 输出 token 上限 (含推理过程 token + 可见回答 token). 省略则不限制 | |
tools | array | 工具 (函数) 定义数组, OpenAI 兼容格式 | |
tool_choice | string | object | 工具选择策略: `auto` / `none` / `required` / `{type:'function',function:{name:'X'}}` | |
response_format | object | 结构化输出: `{"type":"json_object"}` (JSON Mode) 或 `{"type":"json_schema","json_schema":{...}}` (JSON Schema) | |
stream | boolean | 是否流式返回 (SSE). 默认 false | |
temperature | number | 采样温度, 越大越随机 | |
top_p | number | 核采样阈值 | |
n | integer | 候选回复数量, 默认 1 |
200 — 成功. `choices[].message.reasoning_content` 为推理内容, `content` 为最终回答; `usage.completion_tokens` 已包含推理 token.400 — 请求参数错误. 常见: `messages` 缺失或格式错误 / `model` 不存在 / `response_format` JSON Schema 不合法.curl https://api.router.ai/v1/chat/completions \
-H "Authorization: Bearer sk-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"messages": [
{"role": "user", "content": "用一句话介绍你自己"}
],
"reasoning_effort": "max"
}'