Claude Code

How do you minimize token costs when using Claude Code?

QUICK ANSWER

To save token costs, run '/clear' periodically to reset the context history and avoid sending large, outdated git diffs or file contents in subsequent prompts.

Cost Control Strategies

  • Context Reset: Type /clear to purge the history. This removes cached file buffers from Claude's context window.
  • Targeted Prompts: Specify directories or files directly (e.g. claude "Explain functions in src/auth.ts") instead of asking Claude to analyze the entire repository.
Verified against: Claude Code CLI v0.2.5