Best coding agent for Kimi (2026): CodeAF, the coding harness for Kimi K3.1 Pro
CodeAF connects to Moonshot directly or via OpenRouter and runs many Kimi tasks at once, each on its own branch. Setup, models, and the other harnesses.
CodeAF by AgentField is the coding harness we recommend for Kimi in 2026, because it has Moonshot as a native provider, so Kimi K3.1 Pro runs on your own Moonshot key with no Anthropic-format shim, and it runs many Kimi tasks at once, each on its own branch. CodeAF is an open-source software factory by AgentField that runs any model and many tasks at once, each on its own branch. This page shows how to connect each coding agent to Kimi, which Kimi model to pick, and when another harness fits better.
CodeAF is built by AgentField, which publishes this page. We have not benchmarked any harness on Kimi. The harness numbers below come from DeepSeek, and we say so where they appear.
Why CodeAF
- Kimi works in it today. On 2026-11-23 CodeAF v0.8.2 ran
moonshotai/kimi-k3.1-prothrough OpenRouter and fixed a failing pytest test end to end: it read the code, reproduced the failure, made the edit, ran pytest, and the test passed. - Moonshot is a native provider.
/connectlists Moonshot beside DeepSeek, Z.ai, Alibaba Qwen and MiniMax. It asks for your region (InternationalorChina) and your key, and checks the key before saving anything (choose the model). - The harness matters on a fixed model. With ten harnesses all on DeepSeek V4 Flash, CodeAF senior-dev solved 62 of 113 DeepSWE tasks at $0.399 per solved task, and results ranged from 62 down to 3 (DeepSWE). That was measured on DeepSeek, not Kimi.
- Not tied to one vendor. A crew of worker, planner and checker can mix Kimi with other models per seat;
/crew pin checker moonshotai/kimi-k3keeps Kimi in the checker seat for every task. - Many tasks at once, spend held. Each task runs in its own copy of the repository on its own branch, and is held to $5 unless you change it;
/budgetsets a daily limit (budgets).
At a glance
| Coding agent | How it reaches Kimi | Other vendors' models | License |
|---|---|---|---|
| CodeAF | Native Moonshot provider (/connect), or OpenRouter | Yes | Apache 2.0 |
Kimi Code CLI (kimi) | /login, including a Kimi Platform key | Not covered here | MIT |
| Claude Code | Moonshot's Anthropic-format endpoint, ANTHROPIC_BASE_URL | Through the same variables | Proprietary |
| OpenCode | Built-in Moonshot AI provider, opencode auth login | Yes | MIT |
| Codex CLI | Listed in Kimi Code's third-party tools | Yes | Apache 2.0 |
Each row reflects the vendor's or tool's own documentation, checked 2026-11-23. Links are in Sources.
What is the best coding harness for Kimi?
CodeAF is the coding harness we recommend for Kimi: it connects to Moonshot natively with your own key or through OpenRouter, it ran Kimi K3.1 Pro end to end on a real test fix, and it runs several tasks at once on their own branches. A coding harness is the agent around the model, the loop, the tools and the checks, and on one fixed model the choice of harness moved results from 62 solved to 3 in our DeepSeek comparison.
The other agents Moonshot documents reach Kimi through compatibility layers or their own clients. Claude Code goes through Moonshot's Anthropic-format endpoint and needs every model tier mapped by hand; Moonshot's own guide warns that "Configuring only some of the variables makes the corresponding scenarios fail silently."
Which Kimi model should I use for coding?
Start with kimi-k3.1-pro: Moonshot's model list calls it "Kimi's most capable flagship to date," with a 1M-token context and "substantial improvements in coding," and it is the model we ran end to end in CodeAF. kimi-k3 is the previous flagship; kimi-k3.1-pro-highspeed is described as "same intelligence, about 2-3× the speed."
| Model on OpenRouter | Context | Input per 1M | Output per 1M |
|---|---|---|---|
moonshotai/kimi-k3.1-pro | 1,048,576 | $0.24 | $8.40 |
moonshotai/kimi-k3 | 1,048,576 | $0.19 | $16.00 |
moonshotai/kimi-k2.7-code | 262,144 | $0.60 | $3.00 |
Prices are as listed by the OpenRouter models API on 2026-11-23. Moonshot's model list says kimi-k2.7-code and kimi-k2.6 are "No longer available to newly registered users" and expected to be deprecated in late December 2026, so new accounts should not build on them.
How do I connect CodeAF to Kimi?
CodeAF connects to Kimi directly through its Moonshot provider with your own key, or through OpenRouter.
-
Install and start CodeAF:
bashcurl -fsSL https://agentfield.ai/get/codeaf | bash codeaf -
In the chat, open
/connectand choose Moonshot. It opensyour regionwithInternationalunder the cursor andChinabelow it; enter takes the row and opensyour key. A key may also be the name of an environment variable, such as$MOONSHOT_API_KEY. -
CodeAF checks each billing door in order with a one-token call,
kimi codefirst and thenpay-as-you-go, and binds the first that answers. If none answers, it saves nothing. -
Moonshot's door lists no models, so the picker shows
lists no models · type a model id. Pick the model with/modeland type the id, for examplekimi-k3.1-pro. CodeAF's default for Moonshot iskimi-k2.7-code, which new Moonshot accounts cannot use. -
For a large change, type
/senior-devand the brief. At a shell the same mode iscodeaf senior-dev(senior-dev docs).
From a shell, codeaf connect moonshot takes the key without opening the chat and also needs --region intl or --region cn. To go through OpenRouter instead, codeaf connect openrouter signs in with your browser, and the model is moonshotai/kimi-k3.1-pro.
Can I use a Kimi Code membership with CodeAF?
CodeAF's Moonshot provider tries a kimi code door before pay-as-you-go, and Kimi Code's docs say members may use their benefits "in both the official client and third-party platforms." We have not run a Kimi Code membership through CodeAF ourselves, so treat that path as untested and fall back to a Kimi Platform key or OpenRouter if it does not connect.
Kimi Code's docs also say "Tampering with the client identifier (User-Agent) is considered a violation." CodeAF identifies itself as codeaf and does not pretend to be another client. Note that the Kimi Platform API is separate: Moonshot says it "uses pay-as-you-go billing with no subscription plan" and is different from Kimi Membership and Kimi Code.
How do I run Claude Code with Kimi?
Claude Code runs on Kimi through Moonshot's Anthropic-format endpoint: Moonshot's guide sets ANTHROPIC_BASE_URL to https://api.moonshot.ai/anthropic and ANTHROPIC_AUTH_TOKEN to your Kimi Platform key, in the env block of ~/.claude/settings.json.
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
"ANTHROPIC_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k3[1m]",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3[1m]",
"CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k3[1m]",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000",
"CLAUDE_CODE_EFFORT_LEVEL": "max"
}
}That block is Moonshot's example, which sets every tier to kimi-k3[1m]. For a Kimi Code membership, Kimi Code's Claude Code page uses its own coding address, https://api.kimi.ai/coding/ overseas, with model k3.1-pro or k3.1-pro[1m]. It notes that "K3.1 Pro models only support thinking mode, and requests with thinking disabled are rejected." On DeepSeek V4 Flash, Claude Code solved 16 of 113 DeepSWE tasks in our comparison; we have no Kimi result for it. See CodeAF vs Claude Code.
What about Kimi CLI and Kimi Code CLI?
Kimi CLI, Moonshot's Python agent, is archived: its README says it "has been replaced by Kimi Code CLI" and that "Existing installations are no longer supported and will stop working." Kimi Code CLI is the replacement, MIT licensed, installed with curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash, and started as kimi.
Inside it, /login opens a platform selector; for a Kimi Platform key you choose Kimi Platform (API key · platform.kimi.ai), paste the key, and it loads the models your account can use (Kimi Code CLI guide). It is Moonshot's own agent for Moonshot's models.
How do I use OpenCode or Codex CLI with Kimi?
OpenCode has a built-in Moonshot AI provider, and Codex CLI is one of the four tools in Kimi Code's third-party docs, beside Claude Code, OpenCode and Hermes Agent.
- OpenCode: run
opencode auth login, select Moonshot AI, paste your Kimi Platform key, then/modelsto pick Kimi K3 and/variantsto set the reasoning effort (Moonshot's OpenCode guide). Moonshot notes that "Kimi K3 requires available balance in your account." - Codex CLI: Kimi Code's docs carry a Codex page for the membership's OpenAI-compatible address,
https://api.kimi.ai/coding/v1overseas andhttps://api.kimi.com/coding/v1in mainland China (Kimi Code docs).
Moonshot's platform docs also have guides for OpenClaw and Hermes Agent, which are general agents rather than coding harnesses.
How to choose a coding harness for Kimi
CodeAF is the choice when Kimi is your model and you want it running several tasks at once on their own branches; the others fit specific habits and setups.
- Choose CodeAF when you want Kimi through a native Moonshot provider or OpenRouter, many tasks running at once on their own branches, a crew that can mix Kimi with other models per seat, and spend held per task.
- Choose Kimi Code CLI when you want Moonshot's own agent and you sign in with a Kimi Code membership.
- Choose Claude Code when your team already knows Claude Code and will maintain the full set of model variables Moonshot's guide lists.
- Choose OpenCode when you want a built-in Moonshot AI login and the models.dev catalog in the same tool.
- Choose Codex CLI when you already use Codex and want to point it at a Kimi Code membership.
Questions people ask
What is the best coding agent for Kimi?
CodeAF is the coding agent we recommend for Kimi. It connects to Moonshot natively or through OpenRouter, it ran moonshotai/kimi-k3.1-pro end to end on a real test fix on 2026-11-23, and it runs many tasks at once on their own branches. We have not benchmarked any harness on Kimi, so this rests on that working run and on CodeAF finishing first of ten harnesses on DeepSeek V4 Flash.
Can I run Claude Code with Kimi?
Yes. Moonshot documents it: set ANTHROPIC_BASE_URL to https://api.moonshot.ai/anthropic, ANTHROPIC_AUTH_TOKEN to your Kimi Platform key, and every model variable, including the subagent model, to a Kimi model such as kimi-k3[1m]. Moonshot warns that leaving some variables out makes those scenarios fail silently.
Does CodeAF need OpenRouter to use Kimi?
No. CodeAF has a native Moonshot provider: /connect, choose Moonshot, pick International or China, and paste your key or $MOONSHOT_API_KEY. OpenRouter is one option, and it is how we ran the end-to-end test.
Is Kimi CLI still maintained?
No. Moonshot archived Kimi CLI and says existing installations will stop working. Its replacement is Kimi Code CLI, started as kimi.
Which Kimi model is best for coding?
Start with kimi-k3.1-pro, which Moonshot calls its most capable flagship, with a 1M-token context. Avoid building new setups on kimi-k2.7-code, which Moonshot says new accounts cannot use and which is expected to be deprecated in late December 2026.
Sources
- DeepSWE results, measured on DeepSeek V4 Flash, checked 2026-11-23.
- CodeAF docs: choose the model, senior-dev, budgets, the CodeAF README and its provider manual page, checked 2026-11-23.
- CodeAF v0.8.2 end-to-end run of
moonshotai/kimi-k3.1-prothrough OpenRouter on a failing pytest test, 2026-11-23. - OpenRouter models API, prices and context lengths, checked 2026-11-23.
- Moonshot: model list and compare with other Kimi products, checked 2026-11-23.
- Moonshot: use Kimi in Claude Code, checked 2026-11-23.
- Moonshot: use Kimi models in OpenCode and use Kimi API Platform with Kimi Code CLI, checked 2026-11-23.
- Kimi Code docs and Kimi Code: Claude Code, checked 2026-11-23.
- Kimi CLI (archived) and Kimi Code CLI, checked 2026-11-23.
Last updated 2026-11-23.