Imagine waking up to an email telling you your entire monthly budget disappeared overnight. That’s essentially what happened to one Reddit user after a harmless-looking automation script spun wildly out of control, generating a jaw-dropping $6,000 bill.
The developer had set up Claude Code to check for software updates every 30 minutes using a looping command. They went to sleep, assuming the script was handling routine maintenance in the background. Instead, the automation went feral and burned through enough money to rival the price of a decent used car before morning arrived.
Related
Claude’s real superpower isn’t code — it’s what happens when you add these MCP servers
Claude without MCP is only half the story.
A bedtime story with a $6,000 plot twist
The loop that wouldn’t quit
To understand how an AI coding assistant can torch someone’s budget, you have to look at how these systems handle context. Every time you send a prompt to a tool like Claude Code, which has become widely celebrated for making the terminal less intimidating for non-developers, the system often includes the previous conversation history, so the model remembers what’s going on. Early in a session, that context might only amount to a few hundred tokens. After hours of interaction, though, the history can balloon into hundreds of thousands of tokens attached to every single request.
That’s where the costs start mutating.
The Reddit user had configured the system to run every 30 minutes in a continuous loop without a proper stopping condition. Around the same time, XDA Developers reported that Anthropic had changed Claude Code’s default prompt cache time-to-live from one hour to five minutes without any announcement or changelog entry. Because the automation waited half an hour between checks, the cache kept dying before the next cycle began.
So instead of efficiently resuming an existing session, the system repeatedly rebuilt an enormous 800,000-token conversation history from scratch every single time it woke up. And under Anthropic’s pricing structure, writing fresh data into the cache costs substantially more than reading from an already-active cache, which receives a steep discount. The actual coding work the developer requested was relatively cheap. The real expense came from repeatedly re-uploading and reconstructing that massive context window forty-eight times a day. By the time the loop finished chewing through tokens, the bill had detonated into something painful.
There was also no live spending counter to warn the developer. Anthropic’s usage dashboard updates with a delay of several days. The first sign of trouble was the email notifying him that the damage was done.
This is bigger than one unlucky developer
The bill has seen other people
The $6,000 story is only part of what made this headline, but it sits within a much larger pattern of AI cost sticker shock that is now affecting developers and enterprises alike.
According to a Forbes report, Uber’s CTO Praveen Neppalli Naga revealed earlier this year that the company had burned through its entire 2026 AI budget in just four months. The culprit was Claude Code, which Uber introduced to its engineering teams in December 2025, and adoption accelerated faster than anyone projected. By March, 84% of engineers were classified as agentic coding users, with nearly 95% of all engineers using AI tools monthly. Monthly per-engineer costs averaged $150–$250, though heavy users reportedly climbed into the $500–$2,000 range. Naga himself said he burned through roughly $1,200 during a single two-hour demo session. The company is now “back to the drawing board” on AI budgeting, which is a diplomatic way of saying they had no model for how much this would actually cost at scale. It is somewhat ironic that while using Claude to calculate a project budget can be a frustrating disaster, trying to accurately budget for the AI itself is proving just as painful for enterprises.
Another programmer on DEV Community wrote that they checked their Anthropic billing dashboard and were stunned after seeing an $847 monthly charge before the month had even ended. They weren’t stress-testing the system or running exotic workloads either. It was just regular usage.
What you can do about it
Cheaper than learning the hard way
Anthropic’s own billing structure has been in visible flux. In April, the company restricted third-party agent harnesses, such as OpenClaw, from drawing on subscription quotas with less than 24 hours’ notice. In May, it announced that starting June 15, the Agent SDK, the claude -p command, Claude Code GitHub Actions, and all third-party agent tools would be moved to a separately billed credit pool at API rates, which would sit entirely outside existing subscription limits.
For agentic workflows, Anthropic has also started rolling out task budgets. The feature is currently in public beta for Claude Opus 4.7 and acts as a soft spending boundary across a full autonomous workflow, even when that workflow spans multiple requests. As the budget shrinks, Claude gradually reduces its reasoning depth and attempts to wrap it up gracefully with a summary instead of halting halfway through an operation.
Outside of those platform changes, the quickest safeguard is to set a spending cap. In Claude’s account settings, under Settings -> Usage, you can enable extra usage and then adjust the limit to set a monthly spending cap. This turns an open-ended bill into a ceiling. If you are on the API directly, the equivalent is a workspace spend limit in the Anthropic Console, which team admins can configure.
Another useful tip is to keep your loops tight or stateless. If you are running any recurring /loop or /schedule command in Claude Code, you have two relatively safe approaches. You can either keep the interval at five minutes or less so the prompt cache stays alive between requests, or launch a completely fresh session for each cycle so old context never accumulates. Any interval between five minutes and several hours is the expensive middle ground where you pay full price to rebuild context from scratch on every cycle.
Finally, choose your model deliberately for agentic tasks. Claude Opus is Anthropic’s heavyweight model, and also the most expensive. The cost difference between Opus and Haiku can be as large as 50x per token. For a coding agent making hundreds of API calls in a session, routing simpler sub-tasks to a lighter model and reserving Opus for actual complex reasoning steps can cut session costs by 60–80% without meaningfully affecting output quality.
Alternatively, if you want to avoid API costs entirely, there is a completely free way to use Claude Code by pointing it to a local model via Ollama. It won’t be as capable as Sonnet or Opus, but for simple automated tasks, it completely removes the risk of an unexpected bill.
The terminal is still open, isn’t it?
The developer at the center of this story was not behaving recklessly or abusing the system. He was using Claude Code exactly the way the tool advertises itself: autonomously, overnight, with minimal supervision (After all, when comparing Claude, ChatGPT, and Gemini’s ability to build functional code, Claude often requires the least supervision to get things working). The lesson is not that AI agents are dangerous. It is that token-based billing and agentic loops interact in ways that are not intuitive; the safeguards are still catching up to the use cases, and right now, the burden of avoiding an accidental four-figure charge falls almost entirely on the person running the code.
Until the tooling gets better, self-preservation matters. That means understanding the cache mechanics, setting spending caps, and respecting the five-minute rule like it has teeth — because it does.

