Integrating Kimi: The Moonshot and Kimi Coding Plugins
OpenClaw Integrating Kimi is the fourth stop on the domestic models page. Kimi is the model family from Moonshot AI, and it's a bit special in OpenClaw: the official setup splits it into two independent plugins — Moonshot API and Kimi Coding, with separate plugin installs, non-interchangeable Keys, and different model reference prefixes. The three-step "install plugin → configure credentials → select model" flow from DeepSeek, Qwen, and GLM applies fully in this lesson, but first you need to make the right route choice. The whole process takes about 10 minutes (platform registration not included).
Here's an overview table first — all configurations in this lesson start from it (properties and values are quoted verbatim from the official documentation):
| Route A: Moonshot API | Route B: Kimi Coding | |
|---|---|---|
| Who it's for | Pay-as-you-go API users | Kimi Code members (subscription-based, monthly coding) |
| Official plugin | @openclaw/moonshot-provider | @openclaw/kimi-provider |
| Provider id | moonshot | kimi |
| Authentication environment variable | MOONSHOT_API_KEY | KIMI_API_KEY |
| API endpoint | https://api.moonshot.ai/v1 (international) / https://api.moonshot.cn/v1 (China region) | https://api.kimi.com/coding/ (Anthropic-compatible, the plugin uses Anthropic Messages) |
| Model reference prefix | moonshot/... | kimi/... |
| Default for fresh onboarding | moonshot/kimi-k3 | kimi/kimi-for-coding |
| Key management entry | https://platform.moonshot.ai | https://www.kimi.com/code/console |
One thing you must remember first (the original meaning of the official Warning): Moonshot and Kimi Coding are separate providers and separate external plugins — their Keys are not interchangeable, their endpoints differ, and their model references differ too (moonshot/... vs kimi/...). Filling a Moonshot Key into Kimi Coding's onboarding (or vice versa) will only get you an authentication failure.
How to choose, in three sentences:
| Your situation | Choose this |
|---|---|
| Pay-as-you-go, want the full K3 / K2.7 lineup, plus video input | Moonshot API (all five models in the catalog accept text + image + video) |
| Subscribed to Kimi Code membership and mainly use it for coding | Kimi Coding (within your plan quota, use kimi/kimi-for-coding, kimi/k3 series) |
| Want to use both routes | Install both plugins and configure each with its own Key — different prefixes, no overlap |
💡 For visitors arriving from searches for "Kimi" or "Moonshot AI"
Kimi is the model family from Moonshot AI. To integrate it with OpenClaw, what you need is not a Kimi chat app account, but an API Key: pay-as-you-go goes through the Moonshot Open Platform, membership subscription goes through the Kimi Code console — the two Keys are not interchangeable, and this page covers both paths clearly.
This tutorial is based on OpenClaw v2026.10.9.
What You'll Be Able to Do After This Lesson
- Distinguish between the Moonshot API and Kimi Coding routes: two independent plugins, two Keys, two sets of model prefixes — no more mixing them up
- Install the right plugin and configure
MOONSHOT_API_KEYorKIMI_API_KEYinto OpenClaw (either via onboarding or by manual configuration) - Understand the two model catalogs: where the
moonshot/kimi-k3family and thekimi/kimi-for-coding,kimi/k3families each sit, their contexts, and their defaults - Don't panic when you hit Kimi Coding's weekly quota
HTTP 403: know to wait for the window to reset instead of switching Keys - Use Kimi's exclusive capabilities:
/thinktier mapping and Kimi web search (web_searchprovider)
🎒 Prerequisites
- Completed Connecting Models Overview: the provider system and model switching: you have a clear mental picture of the three steps "install plugin → configure credentials → pick a model" and the
provider/modelreference convention - OpenClaw is installed and the Gateway is running:
openclaw gateway statusproduces output (plugins take effect automatically on a running Gateway; if it isn't running, they take effect on the next startup) - You know whether what you have (or will have) is a pay-as-you-go Key from the Moonshot Open Platform or a Kimi Code membership Key—this determines which route to take
- If you go with server / daemon deployment, you know where
~/.openclaw/.envis—the Key will ultimately live there
Follow Along
Step 1: Confirm your route and get the corresponding API Key
Why: Kimi in OpenClaw comes in two independent routes, with Keys issued from different consoles and not interchangeable—pick the route first, then get the Key.
Route A: Moonshot API (pay-as-you-go)
- Open the Moonshot Open Platform
https://platform.moonshot.aiin your browser, and register / log in - On the API Key management page, create a Key, copy it, and store it somewhere safe
- Note for users in mainland China: the China region uses
moonshot-api-key-cn(endpointhttps://api.moonshot.cn/v1), and Keys are managed on Moonshot's domestic platform—the official docs only give a direct link to the international console; for the domestic site's entry point, refer to the Moonshot official website
Route B: Kimi Coding (Kimi Code membership)
- Open the Kimi Code console
https://www.kimi.com/code/consolein your browser and log in - Create a membership key, copy it, and store it somewhere safe
- Not subscribed yet? See membership pricing at
https://www.kimi.com/membership/pricing(the official website is authoritative)
You should see: a copyable API Key, and you know which route it belongs to—the plugin and commands in Step 2 must match it.
Step 2: OpenClaw connects to Kimi—install the plugin, run onboarding
Why: Both Moonshot and Kimi Coding are external official plugins (not bundled with the core), which adds an "install" step beyond what built-in plugins need; the two routes each have their own plugin package and auth-choice—if you mix them up, the Key won't match.
Route A: Moonshot API
# 1. 装插件
openclaw plugins install @openclaw/moonshot-provider
# 2. 跑 onboarding(二选一)
openclaw onboard --auth-choice moonshot-api-key # 国际站
openclaw onboard --auth-choice moonshot-api-key-cn # 中国区You should see: the Key is validated and saved; with a fresh onboarding, the default model lands on moonshot/kimi-k3.
Optionally verify the catalog:
openclaw models list --provider moonshotYou should see: the kimi-k3, kimi-k3.1-pro, kimi-k2.7-code family of models listed.
Route B: Kimi Coding
# 1. 装插件
openclaw plugins install @openclaw/kimi-provider
# 2. 跑 onboarding
openclaw onboard --auth-choice kimi-code-api-keyYou should see: the Key is validated and saved; the default model is kimi/kimi-for-coding.
Optionally verify the catalog:
openclaw models list --provider kimiYou should see: the kimi-for-coding, k3, k3-256k, k3.1-pro family of models listed.
Three reassurances common to both routes (explicitly stated in the official docs):
- Plugin installation takes effect automatically on a running Gateway; if the Gateway isn't running, it takes effect on the next startup (the kimi-provider README additionally includes
openclaw gateway restartin its install example—both approaches work) - Onboarding preserves your existing model entries—rerunning it won't wipe out other providers' configuration
- Adding new provider credentials will not change your existing default model—to switch the default, use
openclaw models setfrom Step 3
Manual configuration (if you don't want to run onboarding)
Official plugins normally don't need a models.providers entry—just install the plugin, set auth, and pick a model; only write one if you want to explicitly pin the endpoint / default model.
Route A (Moonshot API, official example as-is):
{
env: { vars: { MOONSHOT_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "moonshot/kimi-k3" },
models: {
"moonshot/kimi-k3": { alias: "Kimi K3" },
"moonshot/kimi-k2.7-code": { alias: "Kimi K2.7 Code" },
"moonshot/kimi-k2.7-code-highspeed": { alias: "Kimi K2.7 Code HighSpeed" },
},
},
},
}Route B (Kimi Coding, official example as-is):
{
env: { vars: { KIMI_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "kimi/kimi-for-coding" },
models: {
"kimi/kimi-for-coding": { alias: "Kimi" },
},
},
},
}Where to put the Key: in an interactive shell, export MOONSHOT_API_KEY="<你的 API Key>" (Route B uses KIMI_API_KEY), or write it into ~/.openclaw/.env (daemon deployments must go through this—see the warning below). The plugin manifest also accepts KIMICODE_API_KEY as an alternative variable name for Kimi Coding.
⚠️ Gateway running as a daemon? Don't put the Key in your interactive shell
When the Gateway runs as a launchd / systemd service, it can't see environment variables you export in your terminal. Write MOONSHOT_API_KEY / KIMI_API_KEY into ~/.openclaw/.env, or provide them to that process via env.shellEnv in the configuration.
- In
openclaw models status's credentials overview, you can see where the environment variable for your route comes from
Step 3: Choose a Kimi model and verify
Why: The default models on both routes are good enough (moonshot/kimi-k3 / kimi/kimi-for-coding), but the two catalogs have different focuses—the Moonshot side is the "K3 full family + K2.7 Code", while the Kimi Coding side is "membership-quota models + the K3 series"—take a look before deciding.
First, the Moonshot catalog (official docs as-is):
| Model reference | Reasoning | Input | Context | Max output |
|---|---|---|---|---|
moonshot/kimi-k3 | low / high / max | text, image, video | 1,048,576 | 1,048,576 |
moonshot/kimi-k3.1-pro | low / high / max | text, image, video | 1,048,576 | 1,048,576 |
moonshot/kimi-k3.1-pro-highspeed | low / high / max | text, image, video | 1,048,576 | 1,048,576 |
moonshot/kimi-k2.7-code | always on | text, image, video | 262,144 | 262,144 |
moonshot/kimi-k2.7-code-highspeed | always on | text, image, video | 262,144 | 262,144 |
Next, the Kimi Coding catalog (official docs table + plugin manifest):
| Model | Reasoning | Input | Context | Max output | Notes |
|---|---|---|---|---|---|
kimi/k3.1-pro | Always on; low / high / max | Text, images | 1,048,576 | 131,072 | Thinking cannot be turned off |
kimi/k3.1-pro-highspeed | Always on; low / high / max | Text, images | 1,048,576 | 131,072 | High-speed variant of K3.1 Pro |
kimi/k3 | adaptive; low / high / max | Text, images | 1,048,576 | 131,072 | 1M context is tier-gated by membership level |
kimi/k3-256k | adaptive; low / high / max | Text, images | 262,144 | 131,072 | Same weights, lower quota consumption variant |
kimi/kimi-for-coding | /think on only (low) | Text, images | 262,144 | 32,768 | Default model, consumes plan quota |
kimi/kimi-for-coding-highspeed | /think on only (low) | Text, images | 262,144 | 32,768 | High-speed variant |
One catalog behavior to know in advance: the setup for both routes only saves connection settings and aliases, it does not copy catalog rows into your configuration; catalog seeds are written only with an explicit models.mode: "replace", and your custom model rows are unaffected.
How to choose, in four sentences:
| Your need | Pick this | Rationale |
|---|---|---|
| Moonshot pay-as-you-go, general tasks needing long context | moonshot/kimi-k3 | Onboarding default, 1M context |
| Moonshot pay-as-you-go, cost-effective coding | moonshot/kimi-k2.7-code | $0.95 / $4 per M, lower than K3's $3 / $15 |
| Kimi Code member, everyday coding | kimi/kimi-for-coding | Default model, not billed per token within plan quota |
| Kimi Code member, wanting K3 reasoning and long context | kimi/k3 (or kimi/k3-256k if quota is tight) | K3 weights + membership quota |
To change the default model:
openclaw models set moonshot/kimi-k3 # 路线 A
openclaw models set kimi/kimi-for-coding # 路线 BYou can also switch temporarily in chat: /model moonshot/kimi-k3.1-pro only affects the current session; see Chat Commands Crash Course for the full command family.
Finally, verify. For the Moonshot route, use the official isolated smoke test (it won't touch your daily sessions):
OPENCLAW_CONFIG_PATH=/tmp/openclaw-kimi/openclaw.json \
OPENCLAW_STATE_DIR=/tmp/openclaw-kimi \
openclaw agent --local \
--session-id live-kimi-cost \
--message 'Reply exactly: KIMI_LIVE_OK' \
--thinking max \
--jsonYou should see: provider: "moonshot" and model: "kimi-k3" in the JSON response; when Moonshot returns usage metadata, the transcript also stores normalized token usage and estimated cost (usage.cost).
For the Kimi Coding route, just send an ordinary test message:
openclaw agent --agent main --model kimi/kimi-for-coding --message "用一句话介绍你自己"(openclaw agent requires at least one session selector; --agent main points to the default agent — installations that have completed onboarding have main by default; alternatively, run openclaw dashboard to open the Control UI and send directly in the chat box.)
You should see: the model replies normally, with no errors about missing credentials or nonexistent models. At this point, OpenClaw's Kimi integration is working.
Pricing in one sentence, by route:
- The Moonshot route is pay-as-you-go with built-in catalog estimates: K3 at $3 input / $15 output / $0.30 cache read / $3 cache write (per million tokens); K2.7 Code is $0.95 / $4 / $0.19 / 0; highspeed variants are double
- The Kimi Coding route consumes membership plan quota (
kimi-for-codingcatalog cost is 0); the K3 family's catalog estimates of $3 / $15 / $0.30 / 0 are used only for cost estimation, and the context limit actually in effect for members may be lower than the catalog's stated value
Before deciding, refer to the official pricing pages: Kimi K3 pricing, Kimi K2.7 Code pricing, Kimi membership pricing.
- The test message got a reply, and the provider and model match
Checkpoint ✅
- The installed plugin matches the key: Moonshot key →
@openclaw/moonshot-provider; Kimi Code key →@openclaw/kimi-provider - In
openclaw models status's credentials overview, you can see the source of the corresponding environment variables (MOONSHOT_API_KEY/KIMI_API_KEY) openclaw models list --provider moonshot(or--provider kimi) lists the corresponding catalog- The default model matches the route:
moonshot/kimi-k3orkimi/kimi-for-coding - The test message got a reply, and no
moonshot/model reference was routed to the kimi plugin (or vice versa)
Pitfall Reminders
❌ Mixing the two keys
Symptoms: the key is rejected during onboarding, or an authentication error occurs at runtime.
Reason: The official Warning says it clearly — Moonshot and Kimi Coding are separate providers. Keys are not interchangeable, endpoints differ, and model references differ. A pay-as-you-go Key from the Moonshot Open Platform cannot access the Kimi Coding endpoint, and a Kimi Code membership Key cannot drive the moonshot/ catalog either.
The right approach: match each one to its slot —
| Your Key | Install this plugin | Use this auth-choice |
|---|---|---|
| Moonshot Open Platform (pay-as-you-go) | @openclaw/moonshot-provider | moonshot-api-key / moonshot-api-key-cn |
| Kimi Code Console (membership) | @openclaw/kimi-provider | kimi-code-api-key |
❌ Kimi Coding returns HTTP 403, and you think the Key is broken
Reason: Kimi returns HTTP 403 when the weekly quota is exhausted. OpenClaw treats explicit weekly / seven-day / quota-reset errors as rate limiting — this is a quota issue, not an authentication issue. The official README also specifically warns: switching to another valid Key will not restore the quota.
The right approach: wait for the quota window to reset, or temporarily switch to another configured provider. Errors like invalid Key or restricted access should still be handled as authentication errors — only take the "wait for the window" path when the error is about quota.
❌ /think off cannot turn off thinking for the K3 family
Reason (by route):
- Moonshot route: K3, K3.1 Pro, and K3.1 Pro Highspeed always reason at maximum effort — OpenClaw only exposes
/think maxand always sendsreasoning_effort: "max", so the old low-tier / off settings are simply ignored; K2.7 Code also always thinks natively (Moonshot requires the client to omit thethinkingfield, and OpenClaw only exposes on) - Kimi Coding route:
kimi/k3.1-proandkimi/k3.1-pro-highspeedcannot disable thinking (Kimi Code rejects disabled thinking), do not offer off, and default to high; onlykimi/k3andkimi/k3-256ksupport/think off(sendingthinking.type: "disabled")
The right approach: if you need a model whose thinking can be turned off, pick the kimi/k3 family on the Kimi Coding route. On the Moonshot route, all five models in the built-in catalog cannot disable it (K3 family fixed at max, K2.7 family fixed at on) — the disableable example given in the docs is moonshot/kimi-k2.6, which is outside the catalog (two-tier thinking, requires manually configuring params; see the dedicated capabilities below).
❌ After disabling thinking for kimi/kimi-for-coding, "raw reasoning text" leaks into the replies
Reason: this is the behavior of the K2 backend — when thinking is disabled, raw reasoning may leak directly into the visible reply. That's why OpenClaw only exposes /think on (low tier) for kimi/kimi-for-coding (including highspeed variants) and enables it by default, with a thinking budget of 1024 tokens; old configs that saved an off preference are also parsed as on, so the conversation won't fail.
The right approach: don't fight it — keep the default on. An explicit params.thinking override will still be respected (including turning it off), but turning it off means you may see leaked reasoning text.
❌ Still using the old references kimi/kimi-code, kimi/k2p5, kimi/k3[1m]
Reason: these three are legacy references, and the plugin normalizes them automatically: kimi/kimi-code, kimi/k2p5 → kimi/kimi-for-coding; kimi/k3[1m] → kimi/k3 (k3[1m] has been retired upstream).
The right approach: write the new references directly in your config instead of relying on normalization — kimi/kimi-for-coding or kimi/k3.
❌ After installing the Gateway as a daemon, the exported Key "doesn't take effect"
Reason: launchd / systemd services cannot see the environment variables of your interactive shell — each provider's documentation stresses this repeatedly.
The right approach: write MOONSHOT_API_KEY / KIMI_API_KEY into ~/.openclaw/.env, or provide them via env.shellEnv in the config; restart the Gateway service after changing the Key.
🔧 Kimi-specific capabilities (optional)
Once the plugin is installed, three Kimi-specific capabilities come along with it.
Kimi web search: make web_search go through Kimi
The Moonshot plugin registers Kimi as a web_search provider (via POST /tools/search, returning structured results, no chat model needed). To have Claw use Kimi for web searches:
openclaw configure --section webSelect Kimi in the web-search section, and the config will be saved to plugins.entries.moonshot.config.webSearch.* (official example, verbatim):
{
plugins: {
entries: {
moonshot: {
config: {
webSearch: {
apiKey: "sk-...", // 或用 KIMI_API_KEY / MOONSHOT_API_KEY
baseUrl: "https://api.moonshot.ai/v1",
model: "kimi-k2.6",
},
},
},
},
},
tools: {
web: {
search: {
provider: "kimi",
},
},
},
}Three details:
- Authentication works with either
KIMI_API_KEYorMOONSHOT_API_KEY; the region defaults to the international site (https://api.moonshot.ai/v1), and the China region can be configured - The
model: "kimi-k2.6"in the example has been deprecated and is ignored — search does not depend on a chat model, so keeping it is harmless, though removing it is cleaner - This capability is registered by the Moonshot plugin — pure Kimi Coding users who want web search must also have
@openclaw/moonshot-providerinstalled
For usage of web_search together with other web tools, see Browser Control: Let Claw Browse and Operate the Web for You.
/think tier mapping quick reference
| Route | Model | /think behavior |
|---|---|---|
| Moonshot | K3 / K3.1 Pro / Highspeed | Only exposes /think max, fixed reasoning_effort: "max" |
| Moonshot | K2.7 Code (including Highspeed) | Only exposes on; the thinking field must be omitted, sampling parameters (temperature, top_p, etc.) are fixed by K2.7, and configured overrides are ignored |
| Kimi Coding | k3 / k3-256k | off sends thinking.type: "disabled"; minimal / low → low; medium / high / adaptive → high; xhigh / max → max (adaptive thinking, default high) |
| Kimi Coding | k3.1-pro / k3.1-pro-highspeed | Cannot be turned off, defaults to high; other tiers map as above |
| Kimi Coding | kimi-for-coding (including highspeed) | only exposes /think on (low) and it is on by default; turning it off will leak reasoning text (see the pitfall reminder) |
Caching, cost estimation, and compatibility details
- Prefix caching: Moonshot automatically caches matching prompt prefixes; K3 defaults to a five-minute cache, with cache write and cache read metered separately (official background: Kimi context caching)
- Cost estimation: catalog prices are fed into
/status,/usage cost, and session accounting; Moonshot native endpoints (.ai/.cn) support streaming usage, identified by endpoint host — a custom provider id pointing to the same host also works - Tool schema compatibility: the Moonshot family's OpenAI-compatible route fills in the missing
typeforanyOf/oneOfbranches where a single type can be inferred, preventing common MCP schemas from being rejected - tool_call id sanitization: Kimi native tool call ids look like
functions.<name>:<index>; OpenClaw keeps the first occurrence of each native id and rewrites subsequent duplicates to OpenAI-stylecall_*, keeping replays unique
::: Details advanced: configuring two-level thinking for Kimi models outside the catalog Documentation example (as-is) — models like moonshot/kimi-k2.6 that support enabled / disabled two-level thinking, configure params per model:
{
agents: {
defaults: {
models: {
"moonshot/kimi-k2.6": {
params: {
thinking: { type: "disabled" },
},
},
},
},
},
}/think off → thinking.type=disabled, any other level → thinking.type=enabled. K2.6 also accepts the optional thinking.keep: "all" (keeps the full reasoning_content across turns). Note: when K2 thinking is enabled, tool_choice can only be auto / none — pinning a tool forces thinking back to disabled, and required gets normalized to auto. :::
Next steps
OpenClaw integration with Kimi is now complete. Continue with the domestic models pages:
- Next lesson Connecting MiniMax: the M3 series and Coding Plan: MiniMax's OAuth dual provider and official Coding Plan
- Other model pages (Doubao, Hunyuan / Qianfan, relays, and local models) start from the course schedule in Connecting models overview
- Models configured? For daily use, start from Daily use: getting along efficiently with your Claw — Control UI, chat commands, and the memory system are all in that chapter