Skip to content
Agents tracked: 504 Releases (7d): 733 Agent status: 2 with issuesSince last limit reset: Claude 12d · Codex 10d For AI agents: Markdown Updated Nov 23, 2026

How to Cut Token Usage in Claude Code and Cursor (2026)

Practical ways to spend fewer tokens with Claude Code and Cursor: measure first, keep context small, match the model to the task, filter what the agent reads, and the open-source tools that help.

How to Cut Token Usage in Claude Code and Cursor (2026)

Coding agents get expensive in a way that is easy to miss: you pay for what the model reads, and an agent reads a lot. Every request carries the whole conversation so far, plus every file, log and tool result the agent pulled in. A one-line question at the end of a long session can cost more than the first hour of work.

For scale, Anthropic says that across enterprise deployments Claude Code averages about $13 per developer per active day and $150–250 per developer per month, with 90% of users below $30 a day (Claude Code docs, as reported). Cursor says daily Agent users typically spend $60–100 a month and power users $200 or more (Cursor pricing docs). Most of the savings below come from the same few habits in both tools.

1. Measure before you change anything

  • Claude Code: /usage shows the session's token use, cost estimate and prompt-cache hit rate; on Pro, Max, Team and Enterprise plans it also breaks recent usage down by skills, subagents, plugins and MCP servers. /context shows what is filling the context window right now.
  • Cursor: the usage page in your Cursor dashboard shows spend per model and request.
  • Teams on the API: route traffic through a gateway such as LiteLLM to track spend per key, or trace runs with Langfuse. Anthropic's docs mention that several large enterprises use LiteLLM for exactly this.

Look for the obvious culprits first: one session left open all day, a huge instructions file, or tool output (test runs, logs) that dwarfs everything else.

2. Keep the context small

  • Clear between unrelated tasks. In Claude Code, /clear starts fresh and costs nothing; /rename first if you want to /resume later. In Cursor, start a new chat instead of continuing an old thread.
  • Compact with intent. /compact Focus on the failing test and the code changes keeps what matters. Note that compacting a large session is itself a large request.
  • Trim your instructions file. CLAUDE.md loads into every session. Anthropic suggests keeping it under about 200 lines and moving workflow-specific instructions (PR reviews, migrations) into skills, which load only when used. In Cursor, keep "always apply" rules short and let the rest apply only when relevant.
  • Hide what the agent should never read. In Cursor, list build output, data dumps and vendored code in .cursorignore.
  • Mind idle time. Coming back after the prompt cache has expired reprocesses the whole conversation at full price. The cache lasts an hour on a Claude subscription and five minutes by default on an API key, so a long break is a good moment to /clear or resume from a summary.

3. Match the model and effort to the task

  • Use the mid-size model by default. Anthropic's guidance is that Sonnet handles most coding tasks and costs less than Opus; keep Opus for hard architecture and multi-step reasoning. Switch with /model.
  • Lower the effort for simple work. Thinking tokens are billed as output tokens. /effort lowers the reasoning effort for routine edits.
  • Give subagents a small model. Set model: haiku in a subagent's configuration for simple, repetitive jobs.
  • In Cursor, Cursor's own models come with much more included usage than third-party models, which are billed at their API rates plus, on Teams and Enterprise, a Cursor Token Rate of $0.25 per million tokens (also when Auto routes to a third-party model; Cursor's own models such as Composer and Grok are exempt). On Teams and Enterprise, Auto mode has a Cost setting that routes to cheaper models.

4. Shrink what the agent reads

This is where the biggest wins usually are, because tool output is often most of the context.

  • Filter command output with a hook. A Claude Code PreToolUse hook can rewrite npm test or pytest so only failures come back; Anthropic's docs include a ready-made script. The same idea works for logs: return the ERROR lines, not the whole file.
  • Send noisy work to a subagent. Test runs, log digging and documentation lookups can run in a subagent, so only a summary returns to the main conversation.
  • Prefer CLI tools to MCP servers where both exist. gh, aws or gcloud add nothing to the context until they run. Disable MCP servers you are not using with /mcp.
  • Compress tool output. Headroom sits between the agent and the model and compresses logs, JSON, search results and files, keeping the originals locally in case the model needs them. Its authors report about 20% fewer tokens for coding agents and 60–95% fewer on repetitive JSON; their four published agent scenarios save 21–57%. Treat these as vendor numbers and run its savings report on your own traffic.
  • Fetch exact docs instead of whole web pages. Context7 gives the agent version-specific library documentation through MCP, which is both shorter and more accurate than browsing.
  • Pack only what matters when you paste code into a chat model. Repomix builds one file from the parts of a repository you choose and shows the token count per file.
Tool What it does for your bill GitHub stars Price
Headroom Compresses tool outputs, logs and files before they reach the model, so each run uses fewer tokens. 80.6K Free (OSS)
Repomix Packs a repository into one AI-friendly file with token counts per file. 29.4K Free (OSS)
LiteLLM One gateway for 100+ models with spend tracking, budgets, rate limits and fallbacks. 63.7K Free (OSS)
Langfuse Traces every model and tool call with its cost and latency, and runs evaluations. 37.7K Free + $29/mo

5. Work habits that avoid wasted runs

  • Be specific. "Add input validation to the login function in auth.ts" reads two files; "improve this codebase" reads everything.
  • Plan first on big changes. Plan mode (Shift+Tab in Claude Code) agrees on the approach before any expensive edits.
  • Stop early. Press Escape as soon as the agent heads the wrong way, and /rewind to a checkpoint instead of arguing it back.
  • Give it a way to check itself. Tests or an expected output let the agent catch its own mistakes instead of you paying for another round.
  • Be careful with parallel agents. Anthropic notes that agent teams use about 7 times more tokens than a standard session when teammates run in plan mode, because each one has its own context.

Quick checklist

Habit Claude Code Cursor
See where tokens go /usage, /context Usage dashboard
Fresh start between tasks /clear New chat
Smaller default model /model, /effort Pick the model; Auto in Cost mode on Teams
Keep instructions lean CLAUDE.md under ~200 lines, skills for workflows Short always-apply rules
Keep files out of context Hooks, subagents .cursorignore
Compress tool output Headroom (headroom wrap claude) Headroom (headroom wrap cursor)

More tools that make agents cheaper or more capable are in agent tooling. For what each coding agent charges in the first place, see AI coding agent pricing.

Two viral token-saving lists, checked

On October 17, 2026 two posts on X pushed tools that cut Claude Code spend. Brij Pandey presented Headroom as the work of "a Netflix engineer" with "up to 95% fewer tokens". Skunzu listed nine repositories with "465K stars" between them. We read each project's own README and compared it with AgentGid's data.

Headroom. The project belongs to Headroom Labs. Neither its README nor headroomlabs.ai says a Netflix engineer built it: Netflix appears only in the homepage's "trusted by engineers at" strip, among dozens of company names, and the homepage says the company is part of Foundation Capital Build, the Vercel Accelerator and the Berkeley Xcelerator. "Up to 95%" is the top of the 60-95% the authors report for repetitive JSON; for coding agents they report about 20%, and their four published scenarios save 21-57% (as reported). Their accuracy table shows the same GSM8K score, 0.870, with and without compression on 100 questions. Compression does run on your machine, but an anonymous telemetry beacon is on by default, so "everything runs locally" needs that footnote. headroom wrap claude also installs Serena for code navigation. GitHub shows 75,813 stars; the homepage still says 24.9k.

The nine repositories. The per-repo star counts in the post are close. By our calculation the nine add up to 472,146 stars as of October 18, 2026, a little more than the post says.

Repo What its README says it does Stars On AgentGid
claude-code-router A local gateway where you choose providers and write routing rules, retries and fallbacks. It does not pick the cheapest capable model by itself, as the post implies 37,738 not tracked
rtk One Rust binary that compresses the output of git, test runners and 100+ other commands; 60-90% less, as reported 83,851 RTK
claude-mem Records sessions, summarizes them with a model and feeds the useful part into later sessions. The engine is free; hosted CMEM Pro is $30 a month 101,579 Claude Mem
context-mode MCP server that keeps raw tool output in a sandbox and session events in SQLite. Its license is the Elastic License 2.0, which is source-available rather than open source, and hosted plans start at $20 a month 30,679 Context Mode
caveman A skill that makes replies terse, plus a proxy that now also compresses what the agent reads; 65% fewer tokens, as reported 113,430 Caveman
ccusage Reports token use and cost from local logs of Claude Code and many other agent CLIs. The post links ryoppippi/ccusage; the repository now lives at ccusage/ccusage 19,057 not tracked
serena MCP toolkit for symbol-level code lookup and editing through language servers 30,365 not tracked
code-review-graph Tree-sitter graph of the codebase served over MCP, so the agent reads only the files a change touches 32,238 code-review-graph
jev-ultrafast A browser agent, not a Claude Code saver: TypeSafe's hosted Jev model picks each action, and it needs a TypeSafe key plus a text-model key. The README calls it an MVP 23,209 not tracked; see Browser Use

The Opus price. AgentGid's model page lists Claude Opus 5.5 at $4 per million input tokens and $20 per million output tokens, so the post's $20 is right and output costs 5 times as much as input, by our calculation. An agent still re-sends its whole context on every request, so shrinking what it reads usually moves the bill more than shorter answers.

What to take from both posts. Headroom, rtk, context-mode and caveman's proxy all compress tool output, so stacking them mostly adds moving parts; pick one. The best line in the second post is to run ccusage (or /usage) before and after, and keep only what shows a saving on your own sessions.

Tool What it does for your bill GitHub stars Price
RTK RTK is a single Rust binary that intercepts shell commands run by coding agents and compresses their output (git, ls, grep, test runners and 100+ other commands) before it reaches the LLM context, reducing input tokens. 87.5K Free
Claude Mem Memory plugin built for Claude Code: it captures what the agent does during a session, compresses it into AI-written summaries and injects the relevant context into later sessions, so work continues after a session ends. It also installs for Codex, Gemini, OpenCode, Copilot, OpenClaw and other agents. The engine runs locally for free; CMEM Pro adds a hosted observer, cloud sync across machines and a private MCP link. 119K Free + $12/mo
Caveman Skill, local proxy and SDK that reduce the tokens coding agents write and read: the skill makes replies terse and the proxy compresses logs, JSON, test output and web pages before they reach the model. It works with Claude Code, Codex, Gemini CLI and other agents. 122K Free + $20/mo
Was this useful?

Agents mentioned in this guide

# Agent Gid Score Downloads 7d 7d 30d Stars Latest release
1
Claude CodeAnthropic
89 22.2M up 26.5% up 18.0% 157K+145/day 2.1.3303d ago
6
CursorAnysphere (owned by SpaceX)
74 — — — 33.4K+4/day —
1
LiteLLMBerriAI
72 25.9M up 9.3% up 3.5% 63.7K+65/day 1.108.152d ago
2
LangfuseLangfuse
69 14.9M up 1.2% up 25.2% 37.7K+40/day 4.83.04d ago
10
HeadroomHeadroom Labs
49 117K down 7.4% down 6.3% 80.6K+122/day 0.45.0yesterday
17
RepomixRepomix
44 165K up 29.4% up 19.4% 29.4K+18/day 1.19.015d ago

Live table, updated daily (figures as of Nov 23, 2026); numbers in the text above are as of the dates given there. "#" is the rank among products of the same kind by Gid Score, our 0-100 composite of adoption, community, attention and momentum (how it is calculated); a dash means no public data.