Moonshot AI Provider Setup and Model Catalog
Configure Moonshot Kimi models or the separate Kimi Coding provider, each with distinct keys and endpoints. Includes the built-in model catalog for Kimi K3 and K2.7 variants.
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 exposes the Kimi API through endpoints that match OpenAI's interface. When you first set up Moonshot, moonshot/kimi-k3 is chosen automatically; if you want the separate Kimi Coding provider, pick kimi/kimi-for-coding instead.
Warning
Treat Moonshot and Kimi Coding as distinct providers, each delivered as its own external plugin. API keys do not carry over between them, the endpoints are different, and the model references do not match (
moonshot/...versuskimi/...).
Built-in model catalog
| Model ref | Name | Reasoning | Input | Context | Max output |
|---|---|---|---|---|---|
moonshot/kimi-k3 | Kimi K3 | low / high / max | text, image, video | 1,048,576 | 1,048,576 |
moonshot/kimi-k2.7-code | Kimi K2.7 Code | Always on | text, image, video | 262,144 | 262,144 |
moonshot/kimi-k2.7-code-highspeed | Kimi K2.7 Code HighSpeed | Always on | text, image, video | 262,144 | 262,144 |
Catalog pricing estimates rely on Moonshot's advertised pay-as-you-go rates. Before you commit to any cost calculations, verify the current figures on the vendor's live pages for Kimi K3 and Kimi K2.7 Code.
Kimi K3 performs reasoning on every request and accepts reasoning_effort set to low, high, or max, with the last one being the default. OpenClaw surfaces these same three levels and translates /think xhigh into max; the K2-only thinking field is left out, and sampling controls (temperature, top_p, n, presence_penalty, and frequency_penalty) are stripped out because K3 pins them to provider defaults. Kimi K2.7 Code also relies on native thinking at all times, but it demands that both thinking and reasoning_effort be absent; the HighSpeed variant follows the same rules. New setups default to Kimi K3. Moonshot's Kimi K3 quickstart has more details.
Getting started
Moonshot and Kimi Coding are both external plugins, so install whichever one you need before onboarding.
Moonshot API
Best for: Kimi K3 and K2 models through the Moonshot Open Platform.
Install the plugin
openclaw plugins install @openclaw/moonshot-provider
openclaw gateway restart
Choose your endpoint region
| Auth choice | Endpoint | Region |
|---|---|---|
moonshot-api-key | https://api.moonshot.ai/v1 | International |
moonshot-api-key-cn | https://api.moonshot.cn/v1 | China |
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
A fresh setup picks Kimi K3 by default. If you already have an installation, you can switch to it 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 confirm model access and cost tracking without disturbing your regular sessions, run things in an isolated state directory:
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 output should indicate provider: "moonshot" and model: "kimi-k3". When Moonshot supplies usage metadata, the assistant transcript entry records normalized token counts plus an 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: 0 },
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: code-focused work through the Kimi Coding endpoint.
Note
Kimi Coding relies on a different API key and provider prefix (
kimi/...) than Moonshot does (moonshot/...). The current refs arekimi/k3for up to 1M context (subject to tier limits),kimi/k3-256kfor 256K context with reduced quota consumption,kimi/kimi-for-coding, andkimi/kimi-for-coding-highspeed. Older refskimi/kimi-codeandkimi/k2p5are mapped tokimi/kimi-for-coding, while legacykimi/k3[1m]resolves tokimi/k3.
The coding service works with both OpenAI-compatible https://api.kimi.com/coding/v1 and Anthropic-compatible https://api.kimi.com/coding/ clients. This plugin relies on Anthropic Messages. Membership keys are created in the Kimi Code Console; the latest membership pricing is listed on Kimi's pricing page.
| Model ref | Name | Reasoning | Input | Context | Max output |
|---|---|---|---|---|---|
kimi/k3 | Kimi K3 | adaptive; low / high / max effort | text, image | 1,048,576 | 131,072 |
kimi/k3-256k | Kimi K3 (256k) | adaptive; low / high / max effort | text, image | 262,144 | 131,072 |
The K3 catalog estimates $3/MTok input, $15/MTok output, $0.30/MTok cache reads, and $0/MTok cache writes. The catalog reports K3's maximum context; your Kimi membership may enforce a lower live limit.
Install the plugin
openclaw plugins install @openclaw/kimi-provider
openclaw gateway restart
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
Kimi Code K3 always uses adaptive thinking when reasoning is enabled and defaults to high effort. /think minimal|low maps to low effort, /think medium|high|adaptive maps to high effort, and /think xhigh|max maps to max effort. /think off sends thinking.type: "disabled".
See the official Kimi Code model table for current plan availability.
Config example
{
env: { vars: { KIMI_API_KEY: "sk-..." } },
agents: {
defaults: {
model: { primary: "kimi/kimi-for-coding" },
models: {
"kimi/kimi-for-coding": { alias: "Kimi" },
},
},
},
}
Kimi web search
The Moonshot plugin also registers Kimi as a web_search provider, backed by Moonshot web search.
Run interactive web search setup
openclaw configure --section web
Choose Kimi in the web-search section to store plugins.entries.moonshot.config.webSearch.*.
Configure the web search region and model
Interactive setup prompts for:
| Setting | Options |
|---|---|
| API region | https://api.moonshot.ai/v1 (international) or https://api.moonshot.cn/v1 (China) |
| Web search model | Defaults to kimi-k2.6 |
Config lives 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
Native thinking mode
Moonshot API Kimi K3 always reasons at maximum effort. OpenClaw exposes only /think max, sends reasoning_effort: "max", and ignores stale lower or off settings.
Kimi Code K3 exposes /think off|minimal|low|medium|high|adaptive|xhigh|max. Its Anthropic-compatible endpoint receives thinking.type: "disabled" for off. Every enabled level uses adaptive thinking; minimal/low maps to low effort, medium/high/adaptive maps to high effort, and xhigh/max maps to max effort. This applies to both kimi/k3 and kimi/k3-256k. Legacy kimi/k3[1m] normalizes to kimi/k3. Moonshot API K3 supports auto, none, required, and pinned tool choices, so OpenClaw preserves the requested tool_choice. For multi-turn tool use, OpenClaw preserves the assistant reasoning content required by Moonshot's replay contract.
Kimi K2.7 Code always uses native thinking. Moonshot requires clients to omit the thinking field for this model, so OpenClaw exposes only on and ignores stale off settings. K2.7 also fixes temperature, top_p, n, presence_penalty, and frequency_penalty; OpenClaw omits configured overrides for those fields.
Other Moonshot Kimi models support binary native thinking:
thinking: { type: "enabled" }thinking: { type: "disabled" }
Configure it per model via agents.defaults.models.<provider/model>.params:
{
agents: {
defaults: {
models: {
"moonshot/kimi-k2.6": {
params: {
thinking: { type: "disabled" },
},
},
},
},
},
}
OpenClaw translates runtime /think levels for these models as follows:
/think level | Moonshot behavior |
|---|---|
/think off | thinking.type=disabled |
| Any non-off level | thinking.type=enabled |
Warning
With Moonshot K2 thinking enabled,
tool_choicehas to be set toautoornone. A pinned tool choice (type: "tool"ortype: "function") reverts thinking todisabledinstead, which still lets the requested tool execute;tool_choice: "required"gets normalized toauto. Since Kimi K2.7 Code cannot turn thinking off, its incompatibletool_choiceis normalized toauto. Kimi K3 relies on its own reasoning-effort contract and keeps supported tool choices intact.
Kimi K2.6 additionally accepts an optional thinking.keep field that governs multi-turn retention of reasoning_content. Setting it to "all" preserves full reasoning across turns; leaving it out (or setting it to null) applies the server's default strategy. OpenClaw forwards thinking.keep only for moonshot/kimi-k2.6 and removes it for other models. Kimi K2.7 Code retains complete reasoning history by default, while OpenClaw drops the entire thinking field.
{
agents: {
defaults: {
models: {
"moonshot/kimi-k2.6": {
params: {
thinking: { type: "enabled", keep: "all" },
},
},
},
},
},
}
Tool call id sanitization
Native tool_call ids from Moonshot Kimi take the form functions.<name>:<index>. OpenClaw keeps the first occurrence of each native Kimi id and rewrites later duplicates into deterministic OpenAI-style call_* ids. Matching tool results are remapped with the same id, so replay stays unique without discarding Kimi's first native id. This behavior is built into the bundled Moonshot provider and cannot be changed by users.
Streaming usage compatibility
Native Moonshot endpoints (https://api.moonshot.ai/v1 and https://api.moonshot.cn/v1) declare streaming usage compatibility. OpenClaw determines this from the endpoint host rather than the provider id, so a custom provider id targeting the same native Moonshot host picks up the same streaming-usage behavior.
Under the catalog K3 pricing, streamed usage covering input, output, and cache-read tokens is also translated into local estimated USD cost for /status, /usage full, /usage cost, and transcript-backed session accounting.
Endpoint and model ref reference
| Provider | Model ref prefix | Endpoint | Auth env var |
|---|---|---|---|
| Moonshot | moonshot/ | https://api.moonshot.ai/v1 | MOONSHOT_API_KEY |
| Moonshot CN | moonshot/ | https://api.moonshot.cn/v1 | MOONSHOT_API_KEY |
| Kimi Coding | kimi/ | Kimi Coding endpoint | KIMI_API_KEY |
| Web search | N/A | Same as Moonshot API region | KIMI_API_KEY or MOONSHOT_API_KEY |
- Kimi web search relies on
KIMI_API_KEYorMOONSHOT_API_KEY, falling back tohttps://api.moonshot.ai/v1with modelkimi-k2.6. - When needed, override pricing and context metadata in
models.providers. - If Moonshot reports different context limits for a model, update
contextWindowto match.
Related
-
Model selection, Picking providers, model refs, and failover behavior.
-
Web search, Setting up web search providers, Kimi included.
-
Configuration reference, Complete config schema for providers, models, and plugins.
-
Moonshot Open Platform, Moonshot API key management and documentation.