From 4a987c836d439f335b4296f1de785362439c6689 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 17 Jan 2026 17:35:40 +0000 Subject: [PATCH] fix: add Kimi Code docs + defaults (#1085) (thanks @dan-dr) --- CHANGELOG.md | 1 + docs/concepts/model-providers.md | 28 +++++++++++++++++ docs/gateway/configuration.md | 43 +++++++++++++++++++++++++++ docs/providers/index.md | 2 +- docs/providers/models.md | 2 +- docs/start/wizard.md | 3 +- src/agents/models-config.providers.ts | 8 ++++- 7 files changed, 83 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4baf10ea1..c1ad871b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Docs: https://docs.clawd.bot ### Changes - macOS: strip prerelease/build suffixes when parsing gateway semver patches. (#1110) — thanks @zerone0x. +- Models: add Kimi Code provider onboarding and docs. (#1085) — thanks @dan-dr. ## 2026.1.16-2 diff --git a/docs/concepts/model-providers.md b/docs/concepts/model-providers.md index 6c94d379e..3de8f236b 100644 --- a/docs/concepts/model-providers.md +++ b/docs/concepts/model-providers.md @@ -155,6 +155,34 @@ Moonshot uses OpenAI-compatible endpoints, so configure it as a custom provider: } ``` +### Kimi Code + +Kimi Code uses a dedicated endpoint and key (separate from Moonshot): + +- Provider: `kimi-code` +- Auth: `KIMICODE_API_KEY` +- Example model: `kimi-code/kimi-for-coding` + +```json5 +{ + env: { KIMICODE_API_KEY: "sk-..." }, + agents: { + defaults: { model: { primary: "kimi-code/kimi-for-coding" } } + }, + models: { + mode: "merge", + providers: { + "kimi-code": { + baseUrl: "https://api.kimi.com/coding/v1", + apiKey: "${KIMICODE_API_KEY}", + api: "openai-completions", + models: [{ id: "kimi-for-coding", name: "Kimi For Coding" }] + } + } + } +} +``` + ### Synthetic Synthetic provides Anthropic-compatible models behind the `synthetic` provider: diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index e9fe9b6e7..ef73fb705 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -2234,6 +2234,49 @@ Notes: - Model ref: `moonshot/kimi-k2-0905-preview`. - Use `https://api.moonshot.cn/v1` if you need the China endpoint. +### Kimi Code + +Use Kimi Code's dedicated OpenAI-compatible endpoint (separate from Moonshot): + +```json5 +{ + env: { KIMICODE_API_KEY: "sk-..." }, + agents: { + defaults: { + model: { primary: "kimi-code/kimi-for-coding" }, + models: { "kimi-code/kimi-for-coding": { alias: "Kimi Code" } } + } + }, + models: { + mode: "merge", + providers: { + "kimi-code": { + baseUrl: "https://api.kimi.com/coding/v1", + apiKey: "${KIMICODE_API_KEY}", + api: "openai-completions", + models: [ + { + id: "kimi-for-coding", + name: "Kimi For Coding", + reasoning: true, + input: ["text"], + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, + contextWindow: 262144, + maxTokens: 32768, + headers: { "User-Agent": "KimiCLI/0.77" }, + compat: { supportsDeveloperRole: false } + } + ] + } + } + } +} +``` + +Notes: +- Set `KIMICODE_API_KEY` in the environment or use `clawdbot onboard --auth-choice kimi-code-api-key`. +- Model ref: `kimi-code/kimi-for-coding`. + ### Synthetic (Anthropic-compatible) Use Synthetic's Anthropic-compatible endpoint: diff --git a/docs/providers/index.md b/docs/providers/index.md index 3bda0ee4c..e241be252 100644 --- a/docs/providers/index.md +++ b/docs/providers/index.md @@ -28,7 +28,7 @@ Looking for chat channel docs (WhatsApp/Telegram/Discord/Slack/etc.)? See [Chann - [Anthropic (API + Claude Code CLI)](/providers/anthropic) - [OpenRouter](/providers/openrouter) - [Vercel AI Gateway](/providers/vercel-ai-gateway) -- [Moonshot AI (Kimi)](/providers/moonshot) +- [Moonshot AI (Kimi + Kimi Code)](/providers/moonshot) - [OpenCode Zen](/providers/opencode) - [Z.AI](/providers/zai) - [GLM models](/providers/glm) diff --git a/docs/providers/models.md b/docs/providers/models.md index d88747cc3..0a50b0d5b 100644 --- a/docs/providers/models.md +++ b/docs/providers/models.md @@ -26,7 +26,7 @@ model as `provider/model`. - [Anthropic (API + Claude Code CLI)](/providers/anthropic) - [OpenRouter](/providers/openrouter) - [Vercel AI Gateway](/providers/vercel-ai-gateway) -- [Moonshot AI (Kimi)](/providers/moonshot) +- [Moonshot AI (Kimi + Kimi Code)](/providers/moonshot) - [Synthetic](/providers/synthetic) - [OpenCode Zen](/providers/opencode) - [Z.AI](/providers/zai) diff --git a/docs/start/wizard.md b/docs/start/wizard.md index 761ef5a59..ed964e74f 100644 --- a/docs/start/wizard.md +++ b/docs/start/wizard.md @@ -95,7 +95,8 @@ Tip: `--json` does **not** imply non-interactive mode. Use `--non-interactive` ( - **Synthetic (Anthropic-compatible)**: prompts for `SYNTHETIC_API_KEY`. - More detail: [Synthetic](/providers/synthetic) - **Moonshot (Kimi K2)**: config is auto-written. - - More detail: [Moonshot AI](/providers/moonshot) + - **Kimi Code**: config is auto-written. + - More detail: [Moonshot AI (Kimi + Kimi Code)](/providers/moonshot) - **Skip**: no auth configured yet. - Pick a default model from detected options (or enter provider/model manually). - Wizard runs a model check and warns if the configured model is unknown or missing auth. diff --git a/src/agents/models-config.providers.ts b/src/agents/models-config.providers.ts index 633bf5579..0188362cd 100644 --- a/src/agents/models-config.providers.ts +++ b/src/agents/models-config.providers.ts @@ -43,6 +43,12 @@ const KIMI_CODE_CONTEXT_WINDOW = 262144; const KIMI_CODE_MAX_TOKENS = 32768; const KIMI_CODE_HEADERS = { "User-Agent": "KimiCLI/0.77" } as const; const KIMI_CODE_COMPAT = { supportsDeveloperRole: false } as const; +const KIMI_CODE_DEFAULT_COST = { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, +}; function normalizeApiKeyConfig(value: string): string { const trimmed = value.trim(); @@ -200,7 +206,7 @@ function buildKimiCodeProvider(): ProviderConfig { name: "Kimi For Coding", reasoning: true, input: ["text"], - cost: MOONSHOT_DEFAULT_COST, + cost: KIMI_CODE_DEFAULT_COST, contextWindow: KIMI_CODE_CONTEXT_WINDOW, maxTokens: KIMI_CODE_MAX_TOKENS, headers: KIMI_CODE_HEADERS,