Skip to content

How to Stop Burning Through Your Claude Code Weekly Limit — The Token Routing Strategy That Works

Claude Code's weekly token limit runs out fast when it reads every file in your codebase. This practical routing strategy delegates file reads and boilerplate to cheaper models — cutting Claude usage by up to 85% while maintaining full output quality on complex engineering work.

Summary · 30 sec

Claude Code's weekly token limit runs out fast when it reads every file in your codebase. This practical routing strategy delegates file reads and boilerplate to cheaper models — cutting Claude usage by up to 85% while maintaining full output quality on complex engineering work.

If you use Claude Code seriously, you have probably hit the weekly token wall faster than expected. Heavy files, boilerplate generation, documentation passes — they stack up. The fix is not to use Claude less. It is to use Claude smarter, by routing the right tasks to the right models.

Here is a practical system that separates expensive reasoning work from cheap input/output work — keeping Claude for the thinking and delegating the grunt work to budget-friendly alternatives like Kimi K2. The result: weekly usage that used to run dry in three days now stretches across the entire month, with near-zero quality loss.

The Core Problem: Claude Reads Everything

When you work on a large codebase, Claude Code often reads entire files before making a small change. A single debugging session might consume 8,000 tokens just on file reads — before Claude has written a single line of new code. Multiply that across a day of active development and you see why limits disappear so fast.

The uncomfortable truth is that not every task requires Claude’s reasoning ability. Reading a 600-line config file to answer “what port is the server running on?” does not need GPT-4-level intelligence. A fast, cheap model does it for a fraction of the cost.

The Two-Tier Model Routing Strategy

The strategy splits every coding task into one of two buckets:

Task TypeWho Does ItWhy
Reasoning, debugging, architecture, code reviewClaude CodeNeeds real intelligence — worth the token cost
File reading, boilerplate generation, doc updates, summarisationCheaper model (Kimi K2, etc.)Mechanical I/O — any model handles it fine

The implementation requires three small tools and one routing instruction file. No plugins. No complex infrastructure. About 180 lines of Python total.

Tool 1 — ask-kimi: The Bulk File Reader

This is where the biggest savings come from. ask-kimi is a small Python CLI (~60 lines) that accepts file paths and a question, sends them to a cheaper OpenAI-compatible model, and returns the answer — without Claude ever touching those files.

What it replaces: Any time Claude needs to read large files to answer a factual question — “what does this function return?”, “does this file import X?”, “what are all the environment variables?”. These queries were costing 5,000–8,000 tokens per session. With ask-kimi, the same query costs under 400 tokens.

How to build it: Use the OpenAI Python SDK pointed at the Kimi API endpoint. The script takes --files and --question arguments, reads the files locally, stuffs them into the context window, and returns the answer. Kimi K2’s context window is large enough to handle even sprawling codebases in a single shot.

Token saving: Roughly 95% reduction on file-reading tasks.

Tool 2 — kimi-write: The Boilerplate Generator

Writing tests, config stubs, docstrings, and scaffolding code is repetitive. It follows patterns. It does not require Claude’s reasoning depth — it requires speed and accuracy on mechanical templates.

kimi-write handles exactly this. Give it a description of what you need generated, point it at the relevant source files for context, and it produces the boilerplate. Claude then steps in only at the review-and-edit stage — a surgical pass rather than a full generation cycle.

Why this works: Claude reviewing 40 lines of generated code costs about 200 tokens. Claude generating those same 40 lines from scratch — plus reading the context files needed to do it — costs 3,000–5,000 tokens. The output quality difference is negligible for boilerplate.

Tool 3 — extract-chat: Documentation From Session Transcripts

After a long Claude Code session, your conversation transcript often contains exactly the information that should go into your project documentation — decisions made, approaches rejected, architecture explained. Extracting and formatting that into docs is pure I/O work.

extract-chat reads a Claude session transcript, identifies the key decisions and explanations, and formats them into a documentation update. Claude never needs to re-read the session. The cheaper model does all the processing and hands Claude a clean diff to review.

The Routing Rules File (CLAUDE.md)

All three tools are useless unless Claude knows when to reach for them. The routing rules live in a CLAUDE.md file at the project root — a markdown document that Claude reads at the start of every session as its operating instructions.

The rules section looks something like this:

## Model Routing Rules

Before reading any file larger than 200 lines, use ask-kimi.
Before generating tests or boilerplate, use kimi-write.
Before updating documentation from session history, use extract-chat.
Reserve direct file reads for files you will immediately edit.
Reserve direct generation for logic-heavy or context-sensitive code only.

The instructions are explicit and simple. Claude follows routing instructions reliably when they are written clearly in the project context. Vague instructions (“use cheaper models when possible”) get ignored. Specific triggers (“before reading any file larger than 200 lines”) get followed consistently.

Two Technical Details That Actually Matter

1. Kimi’s thinking mode needs higher token budgets. When using Kimi K2 in reasoning/thinking mode (rather than standard completion mode), you need to set a higher max_tokens budget than you might expect — the model uses internal chain-of-thought tokens that count against the budget before the actual response begins. Set it too low and you get truncated outputs. A budget of 8,000–16,000 tokens covers most tasks safely.

2. Prefix caching multiplies your savings. When ask-kimi queries the same set of files multiple times in a session, the API’s prefix caching kicks in — the file content is cached and not re-billed at full rate. If you structure your tool to send the same files as a consistent prefix before the question, repeated queries on the same codebase become extremely cheap. One cached prefix can serve dozens of follow-up questions.

What the Numbers Look Like in Practice

On a typical development week involving architecture decisions, debugging, test writing, and documentation updates across a mid-size codebase:

  • Before routing: Full Claude Pro weekly limit consumed in 3 days
  • After routing: Claude usage drops to roughly 15–20% of previous level — the same week’s work now fits comfortably within the limit
  • Cost of cheaper model API calls: Under $1 per week for equivalent I/O volume
  • Quality impact on final output: Negligible — Claude still handles all the decisions; it just stops doing the filing

The ratio improves further for codebases with many large files, heavy documentation requirements, or extensive test suites — anywhere the I/O work dwarfs the reasoning work.

Who This Setup Is For

This approach makes sense if you are hitting the Claude Code limit regularly and your workflow involves at least some of: reading large files for answers, generating repetitive code (tests, configs, scaffolding), or documenting sessions after the fact. If your work is mostly small files and high-judgment coding, the overhead of setting up routing tools probably is not worth it — Claude’s context handling will be efficient enough.

But for anyone working on a substantial codebase — particularly engineers dealing with complex systems, large datasets, or heavy documentation requirements — the two-tier model approach can turn a weekly limit that felt like a ceiling into one you rarely notice.

Getting Started in an Afternoon

The minimum viable version of this system requires:

  1. A Kimi API key (or any cheap OpenAI-compatible provider you prefer)
  2. A Python script for ask-kimi — the file reader tool (~60 lines)
  3. A CLAUDE.md file with explicit routing rules at the project root

Add kimi-write and extract-chat once you have confirmed the core routing is working and you understand where your biggest token spends are coming from. The tools are worth nothing if Claude is not actually following the routing rules — so get the instructions working reliably first, then expand the toolset.

The goal is not to reduce how much you use AI. It is to match the intelligence level of the task to the model doing the work — and stop paying premium rates for file reading.

0 comments

Be the first to respond

Your email address will not be published. Required fields are marked *

Markdown supported. Be kind.