Moonshot AI and Kimi Coding Provider Setup

Configure Moonshot Kimi models and the separate Kimi Coding provider, each with its own plugin, endpoint, and API key. Covers the built-in model catalog and model refs for both providers.

Read this when

  • You want Moonshot Kimi K3/K2 (Moonshot Open Platform) vs Kimi Coding setup
  • You need to understand separate endpoints, keys, and model refs
  • You want copy/paste config for either provider

Moonshot serves the Kimi API through endpoints that are OpenAI-compatible. A new Moonshot setup picks moonshot/kimi-k3; the separate Kimi Coding provider is reached with kimi/kimi-for-coding.

Warning

Moonshot and Kimi Coding are separate providers, and each one ships as its own external plugin. Keys cannot be swapped between them, the endpoints are different, and model refs also differ (moonshot/... vs kimi/...).

Built-in model catalog

Setting up Moonshot or Kimi Coding stores connection settings and aliases, and it does not copy generated catalog rows into your config. Catalog seeding stays on when you state models.mode: "replace" explicitly; rows for custom models are left untouched.

Model refNameReasoningInputContextMax output
moonshot/kimi-k3Kimi K3low / high / maxtext, image, video1,048,5761,048,576
moonshot/kimi-k2.7-codeKimi K2.7 CodeAlways ontext, image, video262,144262,144
moonshot/kimi-k2.7-code-highspeedKimi K2.7 Code HighSpeedAlways ontext, image, video262,144262,144

Cost estimates in the catalog are derived from Moonshot's published pay-as-you-go rates. Before you base cost decisions on them, consult the live vendor pages for Kimi K3 and Kimi K2.7 Code.

Kimi K3 always reasons, and it accepts the reasoning_effort values low, high, and max (the default). Through the direct Moonshot route, OpenClaw exposes only /think max and always sends reasoning_effort: "max". The K2-only thinking field is left out, and sampling overrides (temperature, top_p, n, presence_penalty, and frequency_penalty) are stripped, since K3 pins those to provider defaults. Kimi K2.7 Code likewise always uses native thinking, but it requires that both thinking and reasoning_effort be omitted; the HighSpeed variant follows the same contract. Onboarding defaults to Kimi K3. Consult Moonshot's Kimi K3 quickstart.

Getting started

Moonshot and Kimi Coding are both external plugins, so one must be installed before you onboard.

Moonshot API

Best for: K3 and K2 models accessed through the Moonshot Open Platform.

Install the plugin

openclaw plugins install @openclaw/moonshot-provider

A running Gateway picks up the installation on its own; if none is running, it applies at the next startup. See Apply changes and inspect.

Choose your endpoint region

Auth choiceEndpointRegion
moonshot-api-keyhttps://api.moonshot.ai/v1International
moonshot-api-key-cnhttps://api.moonshot.cn/v1China

Run onboarding

openclaw onboard --auth-choice moonshot-api-key

For the China endpoint, use this instead:

openclaw onboard --auth-choice moonshot-api-key-cn

Confirm the Kimi K3 default

New onboarding chooses Kimi K3. An existing installation can switch over explicitly:

openclaw models set moonshot/kimi-k3

Verify models are available

openclaw models list --provider moonshot

Run a live smoke test

When you want to check model access and cost tracking without disturbing your regular sessions, point at an isolated state dir:

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

The JSON response should report provider: "moonshot" and model: "kimi-k3". When Moonshot returns usage metadata, the assistant transcript entry records normalized token usage and the estimated cost under usage.cost.

Config example

{
  env: { vars: { MOONSHOT_API_KEY: "sk-..." } },
  agents: {
    defaults: {
      model: { primary: "moonshot/kimi-k3" },
      models: {
        // moonshot-kimi-k2-aliases:start
        "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" },
        // moonshot-kimi-k2-aliases:end
      },
    },
  },
  models: {
    mode: "merge",
    providers: {
      moonshot: {
        baseUrl: "https://api.moonshot.ai/v1",
        apiKey: "${MOONSHOT_API_KEY}",
        api: "openai-completions",
        models: [
          // moonshot-kimi-k2-models:start
          {
            id: "kimi-k3",
            name: "Kimi K3",
            reasoning: true,
            thinkingLevelMap: {
              off: null,
              minimal: null,
              low: "low",
              medium: null,
              high: "high",
              xhigh: "max",
              max: "max",
            },
            input: ["text", "image", "video"],
            cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3 },
            contextWindow: 1048576,
            maxTokens: 1048576,
          },
          {
            id: "kimi-k2.7-code",
            name: "Kimi K2.7 Code",
            reasoning: true,
            input: ["text", "image", "video"],
            cost: { input: 0.95, output: 4, cacheRead: 0.19, cacheWrite: 0 },
            contextWindow: 262144,
            maxTokens: 262144,
          },
          {
            id: "kimi-k2.7-code-highspeed",
            name: "Kimi K2.7 Code HighSpeed",
            reasoning: true,
            input: ["text", "image", "video"],
            cost: { input: 1.9, output: 8, cacheRead: 0.38, cacheWrite: 0 },
            contextWindow: 262144,
            maxTokens: 262144,
          },
          // moonshot-kimi-k2-models:end
        ],
      },
    },
  },
}

Kimi Coding

Best for: tasks centered on code, served by the Kimi Coding endpoint.

Note

Kimi Coding relies on an API key and provider prefix (kimi/...) that differ from Moonshot's (moonshot/...). The current refs are kimi/k3 for up to 1M context (tier-gated), kimi/k3-256k for 256K context with lower quota consumption, kimi/kimi-for-coding, and kimi/kimi-for-coding-highspeed. The legacy refs kimi/kimi-code and kimi/k2p5 normalize to kimi/kimi-for-coding; legacy kimi/k3[1m] normalizes to kimi/k3.

Clients compatible with OpenAI (https://api.kimi.com/coding/v1) and with Anthropic (https://api.kimi.com/coding/) are both accepted by the coding service. Anthropic Messages is what this plugin uses. Membership keys are created in the Kimi Code Console; current membership pricing is listed on Kimi's pricing page.

Model refNameReasoningInputContextMax output
kimi/k3Kimi K3adaptive; low / high / max efforttext, image1,048,576131,072
kimi/k3-256kKimi K3 (256k)adaptive; low / high / max efforttext, image262,144131,072

Pricing in the K3 catalog is estimated at $3/MTok for input, $15/MTok for output, $0.30/MTok for cache reads, and $0/MTok for cache writes. The maximum context reported by the catalog is K3's; a lower live limit may be enforced by your Kimi membership.

Install the plugin

openclaw plugins install @openclaw/kimi-provider

When the Gateway is running, installation is applied automatically; if not, it takes effect at the next startup. See Apply changes and inspect.

Run onboarding

openclaw onboard --auth-choice kimi-code-api-key

Set a default model

{
  agents: {
    defaults: {
      model: { primary: "kimi/kimi-for-coding" },
    },
  },
}

Verify the model is available

openclaw models list --provider kimi

The default model for Kimi Coding, kimi/kimi-for-coding, and its kimi/kimi-for-coding-highspeed variant expose only /think on (level low) and use it by default. With thinking disabled, their K2 backend can leak raw reasoning into visible replies. OpenClaw leaves thinking on with a 1024-token budget; stored off preferences resolve to on without failing the turn. The effort levels of K3 are not exposed by these models. Explicit params.thinking model overrides are still honored, including turning thinking off, though doing so can expose raw reasoning in replies.

When reasoning is enabled, Kimi Coding K3 always uses adaptive thinking and defaults to high effort. Low effort is selected by /think minimal|low, high effort by /think medium|high|adaptive, and max effort by /think xhigh|max. /think off sends thinking.type: "disabled".

Current plan availability is listed in the official Kimi Code model table.

Config example

{
  env: { vars: { KIMI_API_KEY: "sk-..." } },
  agents: {
    defaults: {
      model: { primary: "kimi/kimi-for-coding" },
      models: {
        "kimi/kimi-for-coding": { alias: "Kimi" },
      },
    },
  },
}

Kimi is also registered by the Moonshot plugin as a web_search provider, with Moonshot web search behind it.

Run interactive web search setup

openclaw configure --section web

Pick Kimi in the web-search section to store plugins.entries.moonshot.config.webSearch.*.

Configure the web search region and model

Interactive setup asks for:

SettingOptions
API regionhttps://api.moonshot.ai/v1 (international) or https://api.moonshot.cn/v1 (China)
Web search modelDefaults to kimi-k2.6

Configuration is stored under plugins.entries.moonshot.config.webSearch:

{
  plugins: {
    entries: {
      moonshot: {
        config: {
          webSearch: {
            apiKey: "sk-...", // or use KIMI_API_KEY / MOONSHOT_API_KEY
            baseUrl: "https://api.moonshot.ai/v1",
            model: "kimi-k2.6",
          },
        },
      },
    },
  },
  tools: {
    web: {
      search: {
        provider: "kimi",
      },
    },
  },
}

Advanced configuration

Matching prompt prefixes are cached automatically by Moonshot. A five-minute cache is the default for Kimi K3, and cache writes are reported apart from cache reads. OpenClaw's default cost estimate prices cache writes at $3 per million tokens and cache reads at $0.30 per million tokens. See Kimi context caching.

Native thinking mode

Kimi K3 on the Moonshot API always reasons at maximum effort. Only /think max is exposed by OpenClaw, which sends reasoning_effort: "max" and ignores stale lower or off settings.

Kimi Coding K3 exposes /think off|minimal|low|medium|high|adaptive|xhigh|max. To turn it off, its Anthropic-compatible endpoint accepts thinking.type: "disabled". Whenever a level is enabled, adaptive thinking is used: minimal/low correspond to low effort, medium/high/adaptive correspond to high effort, and xhigh/max correspond to max effort. Both kimi/k3 and kimi/k3-256k are covered by this. The legacy kimi/k3[1m] is normalized to kimi/k3.

Self-hosted K3 registrations made under kimi with model ID kimi-k3 or Kimi-K3 and api: "openai-completions" offer the same thinking choices. By default they stay off, and that includes existing configurations that carry no explicit thinking preference. Enabled levels follow the mapping described above and send a top-level reasoning_effort; off sends thinking: { type: "disabled" } with no effort attached. Explicit model mappings and params.extra_body overrides still take effect. A configured params.chat_template_kwargs.reasoning_effort is not shadowed by a generated top-level effort. Whether a self-hosted endpoint honors disabling is up to its serving configuration; the hosted Moonshot API's always-on policy is unaffected by this.

Moonshot API K3 supports auto, none, required, and pinned tool choices, so the tool_choice that was requested is preserved by OpenClaw. When tools are used across multiple turns, OpenClaw keeps the assistant reasoning content that Moonshot's replay contract requires.

Kimi K2.7 Code always uses native thinking. For this model Moonshot requires clients to omit the thinking field, so OpenClaw exposes only on and ignores stale off settings. K2.7 also fixes temperature, top_p, n, presence_penalty, and frequency_penalty; for those fields, any configured overrides are omitted by OpenClaw.

Binary native thinking is supported by other Moonshot Kimi models:

  • thinking: { type: "enabled" }
  • thinking: { type: "disabled" }

Set it for each model through agents.defaults.models.<provider/model>.params:

{
  agents: {
    defaults: {
      models: {
        "moonshot/kimi-k2.6": {
          params: {
            thinking: { type: "disabled" },
          },
        },
      },
    },
  },
}

For those models, OpenClaw maps runtime /think levels as follows:

/think levelMoonshot behavior
/think offthinking.type=disabled
Any non-off levelthinking.type=enabled

Warning

With Moonshot K2 thinking enabled, tool_choice has to be auto or none. If a tool choice is pinned (type: "tool" or type: "function"), thinking is forced back to disabled so the requested tool still runs; tool_choice: "required" is normalized to auto instead. Thinking cannot be disabled on Kimi K2.7 Code, so its incompatible tool_choice is normalized to auto. Kimi K3 follows its own separate reasoning-effort contract and keeps supported tool choices.

An optional thinking.keep field is also accepted by Kimi K2.6, and it controls how reasoning_content is retained across multiple turns. Set it to "all" to keep full reasoning across turns; omit it (or leave it null) to use the server's default strategy. OpenClaw forwards thinking.keep only for moonshot/kimi-k2.6 and strips it from other models. Kimi K2.7 Code keeps full reasoning history by default, while OpenClaw omits the entire thinking field.

{
  agents: {
    defaults: {
      models: {
        "moonshot/kimi-k2.6": {
          params: {
            thinking: { type: "enabled", keep: "all" },
          },
        },
      },
    },
  },
}

Tool schema compatibility

On Moonshot-family OpenAI-compatible routes, OpenClaw adds missing type fields to the anyOf and oneOf tool-schema branches when a single type can be identified from their literal values or constraints. This keeps Moonshot from rejecting common MCP schemas that have untyped branches. Explicit types and ambiguous branches are left as they are; no other provider receives this rewrite.

Tool call id sanitization

Native tool_call ids served by Moonshot Kimi look like functions.<name>:<index>. The first occurrence of each native Kimi id is preserved by OpenClaw, and later duplicates are rewritten to stable OpenAI-style call_* ids. Tool results that match are remapped with the same id, so replay stays unique without stripping Kimi's first native id. This behavior is built into the bundled Moonshot provider and cannot be configured by users.

Streaming usage compatibility

The native Moonshot endpoints (https://api.moonshot.ai/v1 and https://api.moonshot.cn/v1) declare support for usage data in streaming responses. OpenClaw decides this by looking at the endpoint host rather than the provider id, so a custom provider id that targets the same native Moonshot host gets the same streaming-usage behavior.

When catalog K3 pricing is in place, streamed usage covering input, output, and cache-read tokens is also turned into a locally estimated USD cost for /status, /usage full, /usage cost, and for session accounting backed by the transcript.

Endpoint and model ref reference

ProviderModel ref prefixEndpointAuth env var
Moonshotmoonshot/https://api.moonshot.ai/v1MOONSHOT_API_KEY
Moonshot CNmoonshot/https://api.moonshot.cn/v1MOONSHOT_API_KEY
Kimi Codingkimi/Kimi Coding endpointKIMI_API_KEY
Web searchN/ASame as Moonshot API regionKIMI_API_KEY or MOONSHOT_API_KEY
  • Kimi web search takes KIMI_API_KEY or MOONSHOT_API_KEY together with POST /tools/search, and falls back to https://api.moonshot.ai/v1 by default. Results come back structured and no chat model is involved; plugins.entries.moonshot.config.webSearch.model is deprecated and has no effect. See Kimi search.
  • Pricing and context metadata can be overridden in models.providers when needed.
  • Should Moonshot publish different context limits for a model, update contextWindow to match.
  • Model selection, How to pick providers and model refs, plus failover behavior.

  • Web search, Setting up web search providers, Kimi included.

  • Configuration reference, The complete config schema covering providers, models, and plugins.

  • Fireworks, Running Kimi models on Fireworks, including how they behave with thinking turned off.

  • Moonshot Open Platform, Documentation and API key management for Moonshot.

2,349 words · updated Oct 25, 2026