Ir al contenido principal
Claude Code + Kimi API: Work Without Limits for Free

Claude Code + Kimi API: Work Without Limits for Free

AI Integration
4 min readPor Daily Miranda Pardo

I hit my token limit mid-project. Here's what I did.

It's 11am. You've been coding with Claude Code for three hours, you're in the zone, and suddenly the message nobody wants to see appears: you've reached your subscription limit. The counter resets in 4 hours. Do you stop? Switch to the browser? Upgrade your plan?

I found a fourth option: connect Claude Code directly to the Kimi API and keep working as if nothing happened. Same tool, same project context, zero extra cost.

This article explains exactly how I did it, step by step.


The real problem: Anthropic's subscription cap

Claude Pro costs around $20/month and has a usage limit that, if you work intensively with Claude Code throughout the day, you can hit within a few hours. Once the quota is exhausted, Claude Code simply stops responding until the counter resets (typically every 5 hours).

For a developer who uses AI as a core part of their daily workflow, that waiting time is pure lost productivity.

The solution lies in understanding how Claude Code works under the hood: it's just a client making API calls. And that API endpoint is configurable.


What is Kimi API and why does it work here?

Kimi is the large language model developed by Moonshot AI, a company with one of the best quality-to-price ratios in 2026. Its API is OpenAI-compatible, which means any tool that can talk to OpenAI can be redirected to Kimi with minimal changes.

Why it's a great fallback option:

  • Generous free tier: more than enough to cover several hours of work while you wait for the reset
  • Huge context window (up to 128K tokens in some models)
  • Low latency for code generation tasks
  • OpenAI SDK compatible: the bridge to Claude Code is straightforward

How to connect Claude Code to Kimi API

Claude Code defaults to the Anthropic API, but it exposes environment variables that let you redirect its calls. The trick is using LiteLLM as a local proxy: a local intermediary server that receives Claude Code's requests (in Anthropic format) and translates them into Kimi's format.

Step 1: Get your Kimi API key

Sign up at platform.moonshot.cn and generate an API key. The free tier gives you enough credits for several hours of work.

Step 2: Install LiteLLM

pip install litellm[proxy]

Step 3: Create the configuration file

Create a litellm-config.yaml file in your working directory:

model_list:
  - model_name: claude-3-5-sonnet-20241022
    litellm_params:
      model: moonshot/moonshot-v1-128k
      api_key: "sk-your-kimi-api-key"
      api_base: "https://api.moonshot.cn/v1"

The key trick is in model_name: we tell LiteLLM that when Claude Code requests claude-3-5-sonnet-20241022, it should actually call moonshot-v1-128k. Claude Code never notices the swap.

Step 4: Start the proxy

litellm --config litellm-config.yaml --port 4000

Step 5: Redirect Claude Code to the proxy

In your terminal (or in your .bashrc / .zshrc):

export ANTHROPIC_BASE_URL=http://localhost:4000
export ANTHROPIC_API_KEY=any-non-empty-string

Now launch Claude Code as usual:

claude

Claude Code will connect to the local proxy, which will forward requests to Kimi. Same workflow, different model under the hood.


Real results from my daily workflow

I used this setup for the first time on a Friday afternoon after running out of quota mid-refactor. Setup took under 10 minutes. After several weeks of using it as a fallback, here's what I found:

  • For routine coding tasks (refactoring, tests, documentation): Kimi performs at Claude Sonnet level without issues
  • For complex reasoning (architecture decisions, tricky debugging): Claude is still superior, but Kimi gets you moving until the reset happens
  • Actual cost: Kimi's free tier covered all my "waiting time" hours for an entire month with zero additional spend
  • Full transparency: Claude Code shows no warning or visible behavior change

The only workflow adjustment I make: I save the most complex tasks for when Claude access returns, and use Kimi time for direct implementation work.

If you want to explore more ways to get the most out of Claude Code, check out cloud sessions and scheduled tasks and the full Claude Channels setup guide.


Conclusion

Hitting your Anthropic quota doesn't have to mean stopping. With Claude Code + LiteLLM + Kimi API you have a plan B that takes 10 minutes to set up and is practically invisible in day-to-day use.

It's one of those tricks that, once you try it, you can't imagine working without.

Want to integrate this kind of AI workflow into your development stack? Tell me about your use case and let's figure it out together: chat on WhatsApp

Compartir artículo

LinkedInXWhatsApp

Escrito por Daily Miranda Pardo

Consultora especializada en integración de IA en frontend y desarrollo web moderno.