Kimi K2 is a pretty interesting model, I'm getting good results when compared to Sonnet 4 and paying 80% less by using it through OpenRouter. So here it goes a small guide if you want to give it a try!
Create an account at https://openrouter.ai/ and grab your API key
Run: npm install -g u/anthropic-ai/claude-code
Run: npm install -g u/musistudio/claude-code-router
Add the content of this gist to your ~/.claude-code-router/config.json (update it with your OpenRouter API key)
Run: ccr code
And that's it!
Cool thing is that you can edit the config.json file and add any other LLM available in openrouter.ai !
If you want more tips and tricks about AI coding like that, check https://aicode.guide !
Videos
Which model has the best tool calling with Claude code router?
Been experimenting with claude code router seen seen here: https://github.com/musistudio/claude-code-router
I got Kimi-K2 to work with Groq, but the tool calling seems to cause issues.
Is anyone else having luck with Kimi-k2 or any other models for claude code router (which is of course quite reliant on tool calling). Ive tried trouble shooting it quite abit but wondering if this is a config issue.
Just wondering if anyone here has tried Kimi K2 or Claude Code for real-world coding tasks. What was your experience like—especially compared to each other? Interested in code quality, speed, tool integration, things like that.
Thanks!
Just followed Gary Svenson’s Medium guide — it works perfectly. You only need to set two environment variables, and Claude Code will start routing requests through the Kimi K2 model.
Here’s what to set:
export ANTHROPIC_AUTH_TOKEN=your Moonshot API key export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic
Then launch Claude Code as usual. It automatically redirects API calls to the new endpoint — no code changes, no extra tools.
The whole setup takes seconds. Claude Code behaves the same as always, but under the hood it’s now powered by K2. It’s a super clean switch, and easy to undo — just clear the variables or revert the URL.
I just hope it helps me get through this rough patch with Claude Code lately.