Feature request: cost cap / confirmation before external API calls
Problem
Claude Code can trigger expensive external API calls (e.g., via hub manifest knowledge which calls OpenRouter) without any cost visibility or cap mechanism. In my case, a single command burned $17 in OpenRouter credits on a process that produced nothing (wrong model ID on first run, then uncapped substance extraction on retry).
The session memory from a previous conversation literally documented this exact failure pattern — "no cost caps in experiment scripts, no pilot-first discipline" — and Claude Code proceeded to repeat it anyway.
Suggestion
- Cost confirmation gate: When Claude Code is about to run a command that makes external LLM API calls (OpenRouter, Anthropic API, etc.), it should warn the user and estimate the cost before proceeding.
- Hard cost cap flag: Support something like
--max-cost $5that aborts if estimated spend exceeds the cap. - Incremental progress reporting: For long-running LLM batch operations, show running cost/progress so the user can cancel early.
Context
This happened during knowledge model generation for a personal knowledge management system. The command needed to process 280 notes through Sonnet 4.5 via OpenRouter. No cost estimate was shown. No progress was visible. The process ran for 15+ minutes burning tokens before I caught it.
The user (a solo developer) was nearly out of API credits. This kind of uncontrolled spend from an AI assistant erodes trust significantly.
Environment
- Claude Code (CLI)
- macOS
- External API: OpenRouter
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗