Feature request: cost cap / confirmation before external API calls

Resolved 💬 3 comments Opened Feb 19, 2026 by fieldjoshua Closed Feb 23, 2026

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

  1. 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.
  2. Hard cost cap flag: Support something like --max-cost $5 that aborts if estimated spend exceeds the cap.
  3. 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

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗