Kimi K3 (Long-horizon Coding / Reasoning)

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

Request body

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

Responses

Example

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 reference