Model providers

Using Moonshot AI with OpenClaw

5 min read

Browse more in Model providers.

All model providers guides →

This guide walks you through configuring Moonshot AI (Kimi) as a model provider in OpenClaw, including both the main Kimi K2 models and the Kimi Coding endpoint. ` models directly.

By the end, OpenClaw will be able to use Moonshot for chat, reasoning, code, and optional Kimi web search.

Setup flow

Prerequisites

  • Access to the Moonshot Open Platform with a valid `MOONSHOT_API_KEY` for Kimi K2 models.
  • Access to the Kimi Coding endpoint with a valid `KIMI_API_KEY` if you want code-focused models.
  • An existing OpenClaw project where you can edit the main config file and run `openclaw` CLI commands.
  • Network access from your OpenClaw environment to `https://api.moonshot.ai/v1` or `https://api.moonshot.cn/v1`.

Steps

  1. 1

    Choose your Moonshot API endpoint region

    Decide whether your OpenClaw deployment should talk to the international or China Moonshot endpoint, since this controls both the base URL and which auth choice you use. Picking the right region up front avoids onboarding the wrong auth profile and having to redo configuration.

    text
    | Auth choice | Endpoint | Region |
    | --- | --- | --- |
    | `moonshot-api-key` | `https://api.moonshot.ai/v1` | International |
    | `moonshot-api-key-cn` | `https://api.moonshot.cn/v1` | China |
  2. 2

    Run Moonshot onboarding for your region

    Use the OpenClaw CLI onboarding flow to register your Moonshot API key with the correct auth choice. ` can authenticate against the chosen endpoint.

    bash
    openclaw onboard --auth-choice moonshot-api-key
  3. 3

    Run Moonshot onboarding for the China endpoint when needed

    If your deployment must use the China region, run onboarding with the `moonshot-api-key-cn` auth choice instead. cn/v1` and uses the same `MOONSHOT_API_KEY` against the CN host.

    bash
    openclaw onboard --auth-choice moonshot-api-key-cn
  4. 4

    Set Moonshot Kimi K2 as the default agent model

    5 model so any agent without an explicit model uses Moonshot. ` model without touching agent code.

    json
    {
      agents: {
        defaults: {
          model: { primary: "moonshot/kimi-k2.5" },
        },
      },
    }
  5. 5

    Verify Moonshot models are available in OpenClaw

    List the models that OpenClaw sees for the Moonshot provider to confirm onboarding and config worked. If this command fails or returns nothing, fix that before wiring Moonshot into more agents.

    bash
    openclaw models list --provider moonshot
  6. 6

    Configure Moonshot provider, models, and aliases

    Add the full Moonshot provider block so OpenClaw knows the base URL, API type, and model metadata for the Kimi K2 family. moonshot` section defines capabilities like context window and reasoning support.

    json
    {
      env: { MOONSHOT_API_KEY: "sk-..." },
      agents: {
        defaults: {
          model: { primary: "moonshot/kimi-k2.5" },
          models: {
            // moonshot-kimi-k2-aliases:start
            "moonshot/kimi-k2.5": { alias: "Kimi K2.5" },
            "moonshot/kimi-k2-thinking": { alias: "Kimi K2 Thinking" },
            "moonshot/kimi-k2-thinking-turbo": { alias: "Kimi K2 Thinking Turbo" },
            "moonshot/kimi-k2-turbo": { alias: "Kimi K2 Turbo" },
            // 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-k2.5",
                name: "Kimi K2.5",
                reasoning: false,
                input: ["text", "image"],
                cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
                contextWindow: 262144,
                maxTokens: 262144,
              },
              {
                id: "kimi-k2-thinking",
                name: "Kimi K2 Thinking",
                reasoning: true,
                input: ["text"],
                cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
                contextWindow: 262144,
                maxTokens: 262144,
              },
              {
                id: "kimi-k2-thinking-turbo",
                name: "Kimi K2 Thinking Turbo",
                reasoning: true,
                input: ["text"],
                cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
                contextWindow: 262144,
                maxTokens: 262144,
              },
              {
                id: "kimi-k2-turbo",
                name: "Kimi K2 Turbo",
                reasoning: false,
                input: ["text"],
                cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
                contextWindow: 256000,
                maxTokens: 16384,
              },
              // moonshot-kimi-k2-models:end
            ],
          },
        },
      },
    }
  7. 7

    Onboard the Kimi Coding provider for code-focused tasks

    If you want a dedicated code model, run onboarding for the separate Kimi Coding provider. `) than the main Moonshot Kimi models, so keep the credentials distinct.

    bash
    openclaw onboard --auth-choice kimi-code-api-key
  8. 8

    Set Kimi Coding as the default model for code agents

    Point your defaults at `kimi/kimi-code` when you want code-heavy agents to use the Kimi Coding endpoint. ` provider.

    json
    {
      agents: {
        defaults: {
          model: { primary: "kimi/kimi-code" },
        },
      },
    }
  9. 9

    Verify Kimi Coding models are available

    List models for the `kimi` provider to confirm the Kimi Coding onboarding and config are wired correctly. If this command fails, fix the Kimi Coding auth before relying on `kimi/kimi-code` in production agents.

    bash
    openclaw models list --provider kimi
  10. 10

    Configure Kimi Coding defaults and API key

    Add the Kimi Coding env var and default model mapping so OpenClaw can authenticate and label the code model. ` models.

    json
    {
      env: { KIMI_API_KEY: "sk-..." },
      agents: {
        defaults: {
          model: { primary: "kimi/kimi-code" },
          models: {
            "kimi/kimi-code": { alias: "Kimi" },
          },
        },
      },
    }
  11. 11

    Enable Kimi web search as a web_search provider

    OpenClaw can use Kimi as a `web_search` provider backed by Moonshot web search. Run the interactive web configuration so it stores the correct region, model, and API key under the Moonshot plugin entry.

    bash
    openclaw configure --section web
  12. 12

    Configure Kimi web search region and model

    5`). webSearch` controls which Moonshot host and model your web tool uses.

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

    Tune Moonshot native thinking mode per model

    For Kimi K2 models that support native thinking, you can explicitly enable or disable it via model params. This is useful when you want deterministic behavior regardless of runtime `/think` commands.

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

Configuration

OptionDescriptionExample
MOONSHOT_API_KEYAPI key used to authenticate Moonshot Kimi K2 models against `https://api.moonshot.ai/v1` or `https://api.moonshot.cn/v1`.sk-...
KIMI_API_KEYAPI key used to authenticate the Kimi Coding endpoint and Kimi web search.sk-...
agents.defaults.model.primarySets the default model for agents, such as a Moonshot Kimi K2 or Kimi Coding model.moonshot/kimi-k2.5
agents.defaults.models."moonshot/kimi-k2.5".aliasHuman-friendly alias for the `moonshot/kimi-k2.5` model in agent configs.Kimi K2.5
models.providers.moonshot.baseUrlMoonshot API base URL for the Kimi K2 models.https://api.moonshot.ai/v1
models.providers.moonshot.apiKeyReference to the Moonshot API key used by the provider block.${MOONSHOT_API_KEY}
models.providers.moonshot.apiSpecifies the transport type used for Moonshot, compatible with OpenAI completions.openai-completions
plugins.entries.moonshot.config.webSearch.apiKeyAPI key used by the Kimi web search provider, can be `KIMI_API_KEY` or `MOONSHOT_API_KEY`.sk-...
plugins.entries.moonshot.config.webSearch.baseUrlBase URL for Kimi web search, matching the chosen Moonshot API region.https://api.moonshot.ai/v1
plugins.entries.moonshot.config.webSearch.modelModel used for Kimi web search queries.kimi-k2.5
tools.web.search.providerSelects Kimi as the web search provider in OpenClaw.kimi
agents.defaults.models."moonshot/kimi-k2.5".params.thinking.typeControls native thinking mode for the `moonshot/kimi-k2.5` model.disabled

Troubleshooting

Moonshot models do not appear when running `openclaw models list --provider moonshot`.

This usually means onboarding did not run with the correct auth choice or the Moonshot API key is missing. " }` is present in your config.

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

Kimi Coding models do not appear when running `openclaw models list --provider kimi`.

` models. model: { primary: "kimi/kimi-code" }` block.

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

Web search calls fail or do not use Kimi even after running `openclaw configure --section web`.

webSearch` block has a valid `apiKey`, `baseUrl`, and `model`. Re-run the interactive setup and confirm the generated config matches the documented webSearch example.

bash
openclaw configure --section web

Moonshot thinking behavior does not match the `/think` level you send.

type=enabled`, and it also normalizes incompatible `tool_choice` values to `auto`. thinking` explicitly in your config instead of relying only on runtime `/think`.

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

Frequently asked questions

Powered by Mem0

Add persistent memory to OpenClaw

Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.

More in Model providers