Kimi K3 is Moonshot's flagship model with a 1M-token context, always-on thinking, built for long-horizon coding and end-to-end knowledge work. OpenAI-compatible /v1/chat/completions.
POST /v1/chat/completions
## Kimi K3 Kimi K3 is Moonshot's flagship model for long-horizon coding and end-to-end knowledge work, with a **1M (1,048,576) token** context window. - **Always-on thinking**: K3 emits `reasoning_content` by default; these reasoning tokens **count toward output token usage**, so real output usage is higher than the visible final answer alone. - Supports **tool calling (tools / tool_choice)**, **JSON Mode / structured output (response_format)**, **web search**, **Partial Mode**, and **dynamic tool loading**. - Configure reasoning depth via the top-level `reasoning_effort` (currently only `max`). - Automatic context caching: cache-hit input tokens are reported in `usage.prompt_tokens_details.cached_tokens`. ### Endpoint ``` 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"
}'