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