Short answer
For the Moonshot API route, OpenClaw’s Moonshot provider plugin connects to Kimi. The setup guide used here is based on OpenClaw 2026.7.1 and selects moonshot/kimi-k3.1-pro; check your installed model catalog before choosing a model. Kimi’s guide says its hosted Kimi K2.5 offering was sunset on August 31, 2026, so K2.5 is not the model used in this walkthrough. That statement concerns Kimi’s hosted platform; it does not establish availability through every independent gateway or local deployment. (Kimi’s OpenClaw guide, OpenClaw Moonshot guide)
Moonshot API and Kimi Coding are separate providers. Use a Moonshot API key with a moonshot/... model reference; don’t substitute Kimi Coding credentials or model IDs. (OpenClaw Moonshot guide)
Prerequisites
- OpenClaw 2026.7.1, the version named by Kimi’s setup guide. If you use another release, check its provider and onboarding documentation before applying these commands.
- A Kimi API key for the China-platform route shown below. Use the option matching your account’s region; don’t enter a key from a different region into this route.
- A shell on the Gateway host. The credential workflow below is specifically for running the Gateway in the foreground from that same shell; it does not configure a separately installed background service.
Connect Kimi to OpenClaw
-
Install the Moonshot provider plugin and restart the Gateway:
openclaw plugins install @openclaw/moonshot-provider openclaw gateway restartThe plugin reference identifies
@openclaw/moonshot-provideras the package. Kimi’s guide gives the install-and-restart sequence. (Plugin reference, Kimi’s setup guide) -
Supply the key to onboarding and the foreground Gateway without putting its value in a command. In the shell you will use to launch the Gateway, read the key without echoing it and export it for child processes:
read -r -s -p 'Moonshot API key: ' MOONSHOT_API_KEY export MOONSHOT_API_KEY printf '\n'Then run onboarding in that shell:
openclaw onboard --auth-choice moonshot-api-key-cn --secret-input-mode refWhen prompted for credential handling, choose an environment-backed reference for
MOONSHOT_API_KEY, not plaintext key storage. OpenClaw documents reference mode as writing environment-backed references; Kimi’s API quickstart namesMOONSHOT_API_KEY. Prompt wording can vary by release, so if onboarding does not offer that reference choice, stop and check the documentation for your installed version rather than entering the key as plaintext. (Onboarding reference, Kimi API quickstart)Keep this Gateway in the foreground. If onboarding offers to install or run a background service, decline that option for this workflow. Start the Gateway from the same shell that holds the exported variable:
openclaw gateway runA Gateway launched from a different shell or as a service will not automatically inherit this shell’s environment. This procedure does not cover how to inject the variable into a particular service manager. (Run the Gateway, Environment variables)
-
In another terminal, inspect the catalog and choose an available model:
openclaw models list --provider moonshot openclaw models set moonshot/kimi-k3.1-proUse the Kimi guide’s model ID only if it appears in your installed catalog. If it does not, check the plugin and release documentation for your installation rather than guessing an ID. (Kimi’s setup guide, OpenClaw models CLI)
Protect the API key
Run the secrets audit after onboarding:
openclaw secrets audit --check
A clean check reports no findings in the surfaces it scans; it does not prove that no other copy of the key exists. The documented exit codes distinguish findings (1) from unresolved references (2). OpenClaw warns that plaintext credentials in files an agent can inspect may remain agent-readable. (Secrets CLI, Secrets management)
If you replace the key, stop the foreground Gateway with Ctrl+C, read and export the replacement in the shell you will use to launch it, then run openclaw gateway run again. This starts a new Gateway process with the updated environment. If a key is exposed, revoke it in the Kimi platform and create a replacement before relaunching; Kimi documents revocation for inference API keys. (Kimi key-revocation documentation)
Verify the connection
Use an agent ID that already exists in your OpenClaw configuration. main is an example; replace it if your configured agent has another ID. Send a test turn through the Gateway:
openclaw agent --agent main --message "Reply with exactly: Kimi is connected."
A completed response and a successful command exit show that the turn completed; the requested words alone do not prove which model answered. The --agent main selector targets that agent’s main session. Open the Control UI, select the same agent and its main conversation, and enter:
/model status
That session-level status lets you inspect the model selected for the conversation. Separately, check the configuration for the same agent:
openclaw models status --agent main --json
This reports that agent’s configured default and fallbacks; it is not upstream Moonshot telemetry, and a fallback may have served a completed turn. (Agent CLI, Models CLI, Model selection)
Troubleshoot common problems
- Model not found: Run
openclaw models list --provider moonshotand use an exact listed ID. - Authentication failure: Check that the key matches the China-platform onboarding choice and that
MOONSHOT_API_KEYis available in the environment inherited by the foreground Gateway. Moonshot and Kimi Coding credentials are not interchangeable. - Plugin not recognized: Confirm installation completed, then restart the Gateway.
- Secrets audit reports findings: Review its reported locations and resolve plaintext findings or unresolved references; rerun
openclaw secrets audit --check. A clean audit covers only the surfaces it scans. - A reply arrives but the route is uncertain: Check
/model statusin the same agent’s main conversation and compare it withopenclaw models status --agent <agent-id> --json, including configured fallbacks. A completed turn by itself does not identify the upstream model.
Bottom line: Install the Moonshot plugin, use reference mode for the API key, launch the foreground Gateway from the environment that provides that key, and verify both turn completion and the selected model in the same agent session. This walkthrough uses Kimi K3.1 Pro when it appears in your catalog; it does not use Kimi K2.5.
Sources
在 OpenClaw 中连接 Kimi — Kimi API 开放平台
Moonshot plugin reference — OpenClaw
CLI setup reference — OpenClaw
Quickstart — Kimi API Platform
Environment variables — OpenClaw
