May 5, 2026 · 4 min read

How to Save Claude Code Tokens

Claude Code is powerful but expensive. Input tokens are 85-95% of your bill. Here's how to cut them by 94%.

Why Claude Code costs so much

Every time Claude Code needs context about your codebase, it reads entire files. Ask about one function? It reads the whole 800-line file. Ask about a payment flow? It reads every file that might be relevant.

A typical session on a medium project costs $0.14 on Sonnet or $0.70 on Opus. Most of that is input tokens, and most input tokens are wasted on code Claude didn't need.

The fix: index your codebase

Code Context Engine (CCE) indexes your codebase locally using tree-sitter AST parsing and vector embeddings. When Claude needs context, it searches the index and gets only the relevant functions, not entire files.

uv tool install code-context-engine
cd /path/to/your/project
cce init

That's it. Three commands. Claude now searches instead of reading. Everything stays local on your machine.

How much does it save?

MetricWithout CCEWith CCE
Tokens per query83,6814,927
Cost per session (Sonnet)$0.14$0.04
Cost per session (Opus)$0.70$0.21

Benchmarked on FastAPI (53 files, 180K tokens, 20 real queries). 94% fewer input tokens. Reproducible in 2 commands.

Works with more than Claude Code

CCE works with any MCP-compatible editor:

EditorSetup
Claude CodeAuto-detected by cce init
CursorAuto-detected
VS Code / CopilotAuto-detected
Gemini CLIAuto-detected
Codex CLIAuto-detected
OpenCodeAuto-detected

One index. All editors. Same savings.

What about quality?

Recall@10 = 0.90 on FastAPI. Nine out of ten times, CCE finds the right code. When it doesn't, Claude falls back to reading the full file normally. You lose nothing on the 10% miss rate, you save 94% on the 90% hit rate.

Track your actual savings

Run cce savings to see exactly how many tokens and dollars CCE saved you. Not estimates. Actual numbers, per query, with dollar amounts from live Anthropic pricing.

Start saving tokens now

Free, open source, MIT licensed. Your code never leaves your machine.

uv tool install code-context-engine && cce init
View on GitHub