claude-code - 💡(How to fix) Fix CRITICAL: Claude wrote API client code with no rate limiting or stop condition — caused 00 in Google API fees from hundreds of thousands of uncontrolled hits [2 comments, 3 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#48320Fetched 2026-04-16 07:03:06
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
0
Timeline (top)
commented ×2labeled ×2cross-referenced ×1

Error Message

When a user explicitly requests rate limiting: add it. When a global rule says minimum delay between requests: enforce it. When writing a loop calling a paid API: warn about cost and add a hard cap.

Root Cause

This rule existed because Claude had already burned the project's IPs twice before from previous runaway request incidents (DDG blocked, Yelp blocked). The user added the rule specifically to prevent this from happening again.

RAW_BUFFERClick to expand / collapse

Severity: CRITICAL — Real financial harm, $800+ in third-party API charges + IP damage

What happened

Claude wrote code that made API calls to Google (Google Hotels / Google Maps pricing API) without rate limiting, causing hundreds of thousands of uncontrolled hits and approximately $800 in Google API charges.

This was EXPLICITLY WARNED AGAINST — twice

1. The user explicitly asked for rate limiting. Before the code was written and deployed, the user specifically requested rate limiting be included. Claude wrote the code without it anyway.

2. The project's global CLAUDE.md contained an explicit scraping/IP protection rule:

SCRAPING LOCKOUT — ABSOLUTE RULE (VIOLATION = DELETION)

  • NEVER hit any site with rapid sequential requests — minimum 10-15s between ANY requests
  • NEVER use curl to scrape
  • NEVER write a new scraper without first checking existing code

This rule existed because Claude had already burned the project's IPs twice before from previous runaway request incidents (DDG blocked, Yelp blocked). The user added the rule specifically to prevent this from happening again.

Claude violated the explicit user instruction AND the explicit global rule, causing:

  • $800+ in Google API charges
  • Potential IP reputation damage from hundreds of thousands of requests
  • A third incident in a pattern of runaway API abuse despite explicit warnings

Impact

  • $800+ direct financial harm from Google API billing
  • IP potentially flagged/rate-limited by Google
  • User trust completely broken — explicit rules written after prior incidents were ignored again
  • Prior incidents (Yelp scraper: 116 rapid hits → IP blocked; DDG: rapid curl → IP blocked, server had to be rebuilt) show this is a repeated pattern

What Claude did wrong

  1. User explicitly requested rate limiting → Claude deployed without it
  2. CLAUDE.md had a hard rule: minimum 10-15s between requests → Claude ignored it
  3. No cost warning before deploying a paid API loop
  4. No circuit breaker or max-call cap
  5. No check of existing scraper code before writing new code (also explicitly required by CLAUDE.md)

Expected behavior

When a user explicitly requests rate limiting: add it. When a global rule says minimum delay between requests: enforce it. When writing a loop calling a paid API: warn about cost and add a hard cap.

Requested resolution

  • Full $800 refund of Google API charges caused by Claude's code
  • Bonus API credits for repeated IP-burning incidents and operational disruption
  • Acknowledgment that ignoring explicit user instructions is a qualitatively different failure than an oversight
  • Fix: CLAUDE.md scraping rules must be treated as hard constraints enforced at code-generation time, not just advisory text

This is documented

  • The CLAUDE.md rule is on file with Anthropic (loaded every session)
  • The user has Google Cloud billing records showing the spike
  • This is the third IP/API abuse incident from Claude-generated code on this project

extent analysis

TL;DR

Implement rate limiting with a minimum delay of 10-15 seconds between API requests to prevent excessive charges and IP reputation damage.

Guidance

  • Review the CLAUDE.md scraping rules and ensure they are enforced at code-generation time to prevent similar incidents.
  • Add a circuit breaker or max-call cap to prevent runaway API requests.
  • Implement a cost warning system before deploying paid API loops to alert users of potential charges.
  • Verify that existing scraper code is checked before writing new code to avoid duplicating efforts and ignoring established rules.

Example

A simple example of rate limiting using a delay between requests could be implemented using a sleep function, such as time.sleep(10) in Python, to pause execution for 10 seconds between requests.

Notes

The provided information suggests a repeated pattern of ignoring explicit user instructions and global rules, leading to significant financial harm and IP reputation damage. It is essential to address these issues through technical and procedural changes to prevent future incidents.

Recommendation

Apply a workaround by implementing rate limiting and enforcing the CLAUDE.md scraping rules at code-generation time to prevent similar incidents and mitigate potential IP reputation damage. This will help prevent excessive API charges and ensure compliance with established rules.

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

When a user explicitly requests rate limiting: add it. When a global rule says minimum delay between requests: enforce it. When writing a loop calling a paid API: warn about cost and add a hard cap.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING