Skip to content

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 APIRoute B: Kimi Coding
Who it's forPay-as-you-go API usersKimi Code members (subscription-based, monthly coding)
Official plugin@openclaw/moonshot-provider@openclaw/kimi-provider
Provider idmoonshotkimi
Authentication environment variableMOONSHOT_API_KEYKIMI_API_KEY
API endpointhttps://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 prefixmoonshot/...kimi/...
Default for fresh onboardingmoonshot/kimi-k3kimi/kimi-for-coding
Key management entryhttps://platform.moonshot.aihttps://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 situationChoose this
Pay-as-you-go, want the full K3 / K2.7 lineup, plus video inputMoonshot API (all five models in the catalog accept text + image + video)
Subscribed to Kimi Code membership and mainly use it for codingKimi Coding (within your plan quota, use kimi/kimi-for-coding, kimi/k3 series)
Want to use both routesInstall 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_KEY or KIMI_API_KEY into OpenClaw (either via onboarding or by manual configuration)
  • Understand the two model catalogs: where the moonshot/kimi-k3 family and the kimi/kimi-for-coding, kimi/k3 families 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: /think tier mapping and Kimi web search (web_search provider)

🎒 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/model reference convention
  • OpenClaw is installed and the Gateway is running: openclaw gateway status produces 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/.env is—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) ​

  1. Open the Moonshot Open Platform https://platform.moonshot.ai in your browser, and register / log in
  2. On the API Key management page, create a Key, copy it, and store it somewhere safe
  3. Note for users in mainland China: the China region uses moonshot-api-key-cn (endpoint https://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) ​

  1. Open the Kimi Code console https://www.kimi.com/code/console in your browser and log in
  2. Create a membership key, copy it, and store it somewhere safe
  3. 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 ​

bash
# 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:

bash
openclaw models list --provider moonshot

You should see: the kimi-k3, kimi-k3.1-pro, kimi-k2.7-code family of models listed.

Route B: Kimi Coding ​

bash
# 1. 装插件
openclaw plugins install @openclaw/kimi-provider

# 2. 跑 onboarding
openclaw onboard --auth-choice kimi-code-api-key

You should see: the Key is validated and saved; the default model is kimi/kimi-for-coding.

Optionally verify the catalog:

bash
openclaw models list --provider kimi

You 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 restart in 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 set from 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):

json5
{
  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):

json5
{
  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 referenceReasoningInputContextMax output
moonshot/kimi-k3low / high / maxtext, image, video1,048,5761,048,576
moonshot/kimi-k3.1-prolow / high / maxtext, image, video1,048,5761,048,576
moonshot/kimi-k3.1-pro-highspeedlow / high / maxtext, image, video1,048,5761,048,576
moonshot/kimi-k2.7-codealways ontext, image, video262,144262,144
moonshot/kimi-k2.7-code-highspeedalways ontext, image, video262,144262,144

Next, the Kimi Coding catalog (official docs table + plugin manifest):

ModelReasoningInputContextMax outputNotes
kimi/k3.1-proAlways on; low / high / maxText, images1,048,576131,072Thinking cannot be turned off
kimi/k3.1-pro-highspeedAlways on; low / high / maxText, images1,048,576131,072High-speed variant of K3.1 Pro
kimi/k3adaptive; low / high / maxText, images1,048,576131,0721M context is tier-gated by membership level
kimi/k3-256kadaptive; low / high / maxText, images262,144131,072Same weights, lower quota consumption variant
kimi/kimi-for-coding/think on only (low)Text, images262,14432,768Default model, consumes plan quota
kimi/kimi-for-coding-highspeed/think on only (low)Text, images262,14432,768High-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 needPick thisRationale
Moonshot pay-as-you-go, general tasks needing long contextmoonshot/kimi-k3Onboarding default, 1M context
Moonshot pay-as-you-go, cost-effective codingmoonshot/kimi-k2.7-code$0.95 / $4 per M, lower than K3's $3 / $15
Kimi Code member, everyday codingkimi/kimi-for-codingDefault model, not billed per token within plan quota
Kimi Code member, wanting K3 reasoning and long contextkimi/k3 (or kimi/k3-256k if quota is tight)K3 weights + membership quota

To change the default model:

bash
openclaw models set moonshot/kimi-k3      # 路线 A
openclaw models set kimi/kimi-for-coding  # 路线 B

You 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):

bash
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 \
  --json

You 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:

bash
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-coding catalog 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-k3 or kimi/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 KeyInstall this pluginUse this auth-choice
Moonshot Open Platform (pay-as-you-go)@openclaw/moonshot-providermoonshot-api-key / moonshot-api-key-cn
Kimi Code Console (membership)@openclaw/kimi-providerkimi-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 max and always sends reasoning_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 the thinking field, and OpenClaw only exposes on)
  • Kimi Coding route: kimi/k3.1-pro and kimi/k3.1-pro-highspeed cannot disable thinking (Kimi Code rejects disabled thinking), do not offer off, and default to high; only kimi/k3 and kimi/k3-256k support /think off (sending thinking.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:

bash
openclaw configure --section web

Select Kimi in the web-search section, and the config will be saved to plugins.entries.moonshot.config.webSearch.* (official example, verbatim):

json5
{
  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_KEY or MOONSHOT_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-provider installed

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 ​

RouteModel/think behavior
MoonshotK3 / K3.1 Pro / HighspeedOnly exposes /think max, fixed reasoning_effort: "max"
MoonshotK2.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 Codingk3 / k3-256koff sends thinking.type: "disabled"; minimal / low → low; medium / high / adaptive → high; xhigh / max → max (adaptive thinking, default high)
Kimi Codingk3.1-pro / k3.1-pro-highspeedCannot be turned off, defaults to high; other tiers map as above
Kimi Codingkimi-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 type for anyOf / oneOf branches 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-style call_*, 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:

json5
{
  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:

Related tutorials ​

gaodong.aiAboutPrivacyContact

Independent tutorials, not affiliated with any product mentioned. Product names and trademarks belong to their owners. Check official pages for prices and policies.