Feature request: Warn before high-token operations (e.g. batch image reads)
Problem
When Claude Code reads images using the Read tool, each image consumes thousands of tokens (since the model processes them visually). There is currently no mechanism to warn the user or self-regulate before performing operations that will consume a large amount of tokens in a short time.
Real-world example
A session needed to find portrait photos of people appearing 50+ years old from randomuser.me (IDs 0-99 for men and women). Claude Code proceeded to:
- Download ~200 images via curl
- Read all 200 images one by one using the Read tool in rapid succession
- Visually analyze each image to determine apparent age
This consumed an enormous amount of tokens in ~8 minutes, hitting the subscription rate limit (API Error: Rate limit reached). The user was then locked out of the session with no way to continue, commit, or even ask what happened.
Expected behavior
Claude Code should:
- Estimate token cost before batch operations involving images (or other high-token content)
- Warn the user with something like: _"Reading 200 images will consume approximately X tokens. This may hit your rate limit. Would you like to proceed, or should I suggest an alternative approach?"_
- Suggest alternatives proactively, such as:
- Opening images in a local viewer and asking the user to identify relevant ones
- Using an external API (face detection/age estimation) to filter first
- Processing in smaller batches with pauses
- Track cumulative token usage during a session and alert when approaching known rate limits
Additional context
- The user had no way to know this would happen — they trusted the AI to manage resources wisely
- After hitting the rate limit, even simple text commands (
commit,status) failed - The
/costcommand only shows billing info, not rate limit proximity - The
/contextcommand shows token usage for the conversation window but not API rate limit status
Environment
- Claude Code CLI (subscription-powered)
- Model: claude-opus-4-6
- Platform: macOS (Darwin)
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗