deniz.in

Markets

Weather

Loading weather

· via dev.to (home feed)

Anthropic console locale bug charged developer $10,000 instead of $100

A developer in Costa Rica entered 100,00 in Spanish number format and was billed $10,000 for $100 of Anthropic API credits, exposing missing locale parsing and server-side validation in the payment flow.

Anthropic console locale bug charged developer $10,000 instead of $100

What happened

A developer in Costa Rica tried to top up $100 of API credits through Anthropic's console and was billed $10,000, according to a write-up published on dev.to that also drew discussion on Hacker News. The trigger was number formatting. In Spanish-speaking locales, one hundred is written as "100,00", with a comma marking the decimal. According to the report, the platform removed the comma without interpreting it, turning the string into 10000, and the payment executed immediately — no confirmation dialog, no server-side sanity check, and no window to cancel.

How the charge slipped through

The dev.to analysis describes a chain of missing controls rather than a single flaw. The input field accepted free text without parsing it against the user's locale. Nothing at the API layer normalized the value into a canonical numeric form. No confirmation screen displayed the final amount before the charge. And no server-side rule bounded how large a single credit purchase could be. With all of those layers absent, an ambiguity in one text field translated directly into a transaction a hundred times larger than intended.

Where the fix belongs

The write-up maps three places where locale-aware handling could live, each with drawbacks. Client-side validation can parse input using the visitor's locale and show a formatted preview, but users can bypass it with developer tools and locale detection can guess wrong. An API gateway can reject ambiguous formats and require canonical amounts, though that pushes friction onto users who must change habits or settings. Normalizing at the payment-processor edge is too late to ask the user to confirm intent, since errors surface only after the money moves.

The recommended arrangement is defense in depth: the client previews the exact amount about to be charged, the gateway converts every input to one canonical format with a fixed decimal separator, the server enforces per-transaction ceilings plus step-up verification for large purchases, and only a pre-validated payload reaches the processor. In this incident, per the source, none of those steps were in place.

A wider set of billing risks

The author extends the incident into a broader catalogue of failure modes for platforms that bill for AI agent usage: agents stuck in retry loops that burn credits within minutes, long-running tasks that outlive the balance they started with, exchange-rate drift between authorization and settlement, chargebacks filed after credits were partially consumed, and refunds that must distinguish spent from unspent balances. Each has known mitigations — per-minute spend caps, reserving credits at task start, locking rates at authorization, delaying credit availability on new accounts — but none of them come for free, and the post argues most agent billing pipelines lack them.

Why it matters

The core lesson is older than AI agents: free-text financial input from international users is inherently ambiguous, and stripping punctuation without parsing it properly is a correctness bug with money attached. "1.234,56" and "1,234.56" are the same number in different locales, and a naive string replacement turns them into very different ones. The remedy is well understood — parse on the server using the declared locale, confirm the final amount with the user, and cap transactions that proceed without extra verification. What makes this case notable is that a major AI provider's billing flow appears to have skipped all three, and the same gap exists anywhere a platform accepts user-entered payment amounts. The specifics come from a single report, so details may shift if Anthropic responds publicly, but the engineering pattern it exposes applies far beyond one console.

  • #anthropic
  • #payments
  • #localization
  • #api-billing
  • #cloud

Related posts