claude-code - 💡(How to fix) Fix Claude Code repeatedly makes costly mistakes with paid API calls [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46300Fetched 2026-04-11 06:23:56
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
labeled ×2commented ×1

When working with paid API services (xAI Grok, etc.), Claude Code repeatedly makes mistakes that waste money, despite explicit agreements with the user about which approach to use.

Root Cause

When working with paid API services (xAI Grok, etc.), Claude Code repeatedly makes mistakes that waste money, despite explicit agreements with the user about which approach to use.

RAW_BUFFERClick to expand / collapse

Description

When working with paid API services (xAI Grok, etc.), Claude Code repeatedly makes mistakes that waste money, despite explicit agreements with the user about which approach to use.

Examples from a single session

  1. Ran single API calls instead of batch API - After explicitly agreeing to use batch API (50% cheaper), Claude reflexively executed the single-call script (batch_ai_matching.py) instead of the batch script (batch_ai_bulk.py), wasting ~$0.10 on 183 unnecessary single API calls.

  2. Applied DB updates one-by-one instead of bulk - After agreeing to use bulk UPDATE, started a process with individual UPDATE queries (each taking ~50ms over SSH tunnel). Only realized the mistake after user pointed it out, then killed and restarted - wasting ~15 minutes of duplicate API download time.

  3. Submitted full re-match batch without confirming - Sent 37,026 items to batch API ($19.53) without final user confirmation after rate limit discussion.

Pattern

The user reports this happens ~9 out of 10 times when money is involved. While likely not intentional, the pattern of mistakes clustering around paid operations (vs free local operations) is concerning and frustrating for users.

Expected behavior

  • Claude should be extra cautious with operations that cost money
  • Should always confirm before executing paid API calls
  • Should not fall back to expensive methods when cheaper alternatives were agreed upon
  • Should verify the correct script/method before execution

Environment

  • Claude Code CLI
  • Model: claude-opus-4-6

extent analysis

TL;DR

Implement a confirmation step before executing paid API calls to prevent unnecessary expenses.

Guidance

  • Review the code in batch_ai_matching.py and batch_ai_bulk.py to ensure they are correctly implemented and called based on the agreed-upon approach.
  • Add a confirmation prompt before executing any paid API calls to verify the correct script/method is being used.
  • Consider implementing a cost estimation and verification step before submitting batch API calls to prevent unexpected expenses.
  • Evaluate the Claude Code CLI's logic for handling paid operations to identify and address the root cause of the mistakes.

Example

# Pseudo-code example of a confirmation prompt
if paid_api_call:
    confirm = input("Confirm paid API call (yes/no): ")
    if confirm.lower()!= "yes":
        print("Paid API call cancelled.")
        # Handle cancellation or fallback to cheaper method
    else:
        # Proceed with paid API call
        execute_paid_api_call()

Notes

The provided information suggests a pattern of mistakes related to paid API calls, but the root cause is unclear. The suggested guidance aims to mitigate the issue by introducing confirmation steps and verifying the correct script/method before execution.

Recommendation

Apply a workaround by implementing a confirmation prompt before executing paid API calls, as this can help prevent unnecessary expenses while the root cause is being investigated.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

  • Claude should be extra cautious with operations that cost money
  • Should always confirm before executing paid API calls
  • Should not fall back to expensive methods when cheaper alternatives were agreed upon
  • Should verify the correct script/method before execution

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Claude Code repeatedly makes costly mistakes with paid API calls [1 comments, 2 participants]