Kimi K3 (长程编程 / 推理)

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 ```

请求体

modelstringrequired模型 ID, 固定 `kimi-k3`
messagesarrayrequiredOpenAI 兼容多轮对话数组, 每个元素含 `role` (system/user/assistant/tool) + `content` (string 或多模态数组), 按时间顺序传入
reasoning_effortstring推理力度, 当前仅支持 `max`. 省略则使用默认思考行为
max_tokensinteger输出 token 上限 (含推理过程 token + 可见回答 token). 省略则不限制
toolsarray工具 (函数) 定义数组, OpenAI 兼容格式
tool_choicestring | object工具选择策略: `auto` / `none` / `required` / `{type:'function',function:{name:'X'}}`
response_formatobject结构化输出: `{"type":"json_object"}` (JSON Mode) 或 `{"type":"json_schema","json_schema":{...}}` (JSON Schema)
streamboolean是否流式返回 (SSE). 默认 false
temperaturenumber采样温度, 越大越随机
top_pnumber核采样阈值
ninteger候选回复数量, 默认 1

响应

调用示例

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"
  }'

API 文档