Use Kimi (Moonshot) as a coding agent

Export MOONSHOT_API_KEY and run oharness -m moonshot/kimi-k2.7-code. A Kimi Code subscription is a separate provider, kimi-coding, with its own key variable.

Three commands

npm install -g oharness
export MOONSHOT_API_KEY="..."
oharness -m moonshot/kimi-k2.7-code

Which model

Model idContextInput / cached / output ($/M)
kimi-k2.7-code256K0.95 / 0.19 / 4.00
kimi-k2.6256K0.95 / 0.16 / 4.00
kimi-k31M3.00 / 0.30 / 15.00

List prices from the models.dev snapshot OHarness ships (2026-09-19).

Mainland accounts

The moonshot provider points at the international platform. A mainland account uses api.moonshot.cn — override the base URL:

{ "providers": { "moonshot": { "baseUrl": "https://api.moonshot.cn/v1" } } }

Kimi Code plan

export KIMI_CODING_API_KEY="..."

Then pick a model from the kimi-coding provider under /models. The plan key is refused on the pay-as-you-go host and vice versa, which is why the two are separate providers.

Common questions

Can I use Kimi with a Claude Code-style agent?

Yes. OHarness has Moonshot as a built-in provider: set MOONSHOT_API_KEY (or KIMI_API_KEY) and run oharness -m moonshot/kimi-k2.7-code.

What is the Kimi API base URL?

https://api.moonshot.ai/v1 for the international platform and https://api.moonshot.cn/v1 for mainland accounts. Both are OpenAI-compatible.

Moonshot (Kimi) reference

Provider idmoonshot
Base URLhttps://api.moonshot.ai/v1
ProtocolOpenAI-compatible chat completions
API keyMOONSHOT_API_KEY or KIMI_API_KEY
Model discoveryYes — the model list is asked of the endpoint rather than shipped.

Connecting it

The endpoint above is built in, so there is nothing to configure. Put the key in the environment and the provider appears in the model picker:

export MOONSHOT_API_KEY="..."

Keys are issued by Moonshot (Kimi) — where to get one.

Models on Moonshot (Kimi)

The newest models Moonshot (Kimi) serves that can call tools, from the models.dev snapshot OHarness ships. The harness also asks the endpoint for its live list, so a model released after this snapshot still appears in the picker.

Model idContext / output$/M in / cached / outReasoning
kimi-k31.05M / 131K3 / 0.3 / 15Yes
kimi-k2.7-code262K / 262K0.95 / 0.19 / 4Yes
kimi-k2.7-code-highspeed262K / 262K1.9 / 0.38 / 8Yes
kimi-k2.6262K / 262K0.95 / 0.16 / 4Yes

List prices in USD per million tokens, read from models.dev on 2026-09-19. Moonshot (Kimi) changes its prices and models; its own pricing page is the authority. Start a session on the newest:

oharness -m moonshot/kimi-k3

Worth knowing

The international platform. Mainland accounts use https://api.moonshot.cn/v1 — override baseUrl in a user catalog. A Kimi Code plan is a separate endpoint; see kimi-coding.

Pointing it somewhere else

A regional host, a gateway, or a server of your own. Overrides in ~/.oharness/config.json are field level, so changing the endpoint does not mean restating the rest of the provider — this is the whole block, shown holding the default so the shape is clear:

{
  "providers": {
    "moonshot": {
      "baseUrl": "https://api.moonshot.ai/v1"
    }
  }
}

What you get either way

The same agent loop, the same tools, the same MCP servers and the same permission rules, whichever provider is underneath — and switching between them mid-session converts nothing, because history is never stored in a vendor’s shape. What an agent harness is covers why that is the hard part, and the providers reference covers the catalogue itself.

All 34 providers · Install OHarness