惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
Microsoft Security Blog
Microsoft Security Blog
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Last Week in AI
Last Week in AI
罗磊的独立博客
腾讯CDC
云风的 BLOG
云风的 BLOG
月光博客
月光博客
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
宝玉的分享
宝玉的分享
U
Unit 42
I
InfoQ
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
美团技术团队
IT之家
IT之家
Stack Overflow Blog
Stack Overflow Blog
F
Fortinet All Blogs
GbyAI
GbyAI
S
SegmentFault 最新的问题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Your AI Assistant Just Bought a $30,000 Cloud Subscription
Sathish Chelliah · 2026-05-31 · via DEV Community

Sathish Chelliah

Your AI Assistant Just Bought a $30,000 Cloud Subscription

A postmortem of the $30K Claude bill incident.

The Story

In May 2026, a story made the rounds: "AWS user gets $30K Claude bill after cost alert misses it." Two weeks later, another company reported a $38,000 AWS Bedrock bill caused by a prompt caching miss.

A single prompt cache miss. $38,000. Not a billion-dollar enterprise. A regular business running AI agents.

How Runaway Costs Actually Happen

When you tell an AI agent to "research competitors and draft a report," here's the execution graph:

1. Search API        -> $0.03
2. Web scrape        -> $0.01
3. GPT-4 summary    -> $0.35
4. Agent decides: "not polished enough"
5. GPT-4 premium    -> $2.50
6. Image gen API    -> $1.00
7. Regenerate x 3   -> $7.50
8. Total            -> $13.39 for one report

Enter fullscreen mode Exit fullscreen mode

An agent doesn't know the difference between a $0.01 action and a $10 action.

The Architecture of Prevention

A library can be monkey-patched. A proxy is a network boundary agents must cross.

agent-gov is a FastAPI reverse proxy:

# Your config changes from:
openai.base_url = "https://api.openai.com/v1"
# To:
openai.base_url = "http://localhost:8080/v1"

Enter fullscreen mode Exit fullscreen mode

The proxy runs a 4-stage decision tree:

@app.post("/proxy/call")
async def proxy_tool_call(call: ToolCall):
    key_hash = db.hash_key(call.agent_key)
    agent = await db.get_agent(key_hash)

    # Stage 1: Auth - known agent?
    if agent is None:
        raise HTTPException(status_code=401)

    # Stage 2: Paused?
    if agent["paused"]:
        raise HTTPException(status_code=429)

    # Stage 3: Lazy budget reset
    agent = await db.check_and_reset_budget(agent)

    # Stage 4: Real cost lookup (not agent's estimate)
    registered_tool = await db.get_tool(call.tool_name)
    actual_cost = registered_tool["cost_per_call"] if registered_tool else call.estimated_cost

    # Stage 5: Budget check
    if agent["spent_today"] + actual_cost > agent["daily_budget"]:
        await db.pause_agent(key_hash)
        raise HTTPException(status_code=429, detail="Budget exceeded")

    # Approved
    await db.update_agent_spend(key_hash, actual_cost)
    await db.log_cost_event(key_hash, agent["name"], call.tool_name, actual_cost)
    return {"status": "approved", "spent_today": updated["spent_today"]}

Enter fullscreen mode Exit fullscreen mode

The Anti-Cheat: Tool Registry

If you trust the agent's estimated cost, an agent can claim GPT-4 costs $0.01 when it's $12.50.

agent-gov uses a tool registry:

registered_tool = await db.get_tool(call.tool_name)
actual_cost = registered_tool["cost_per_call"] if registered_tool else call.estimated_cost
# cost_source: "registry" or "client_estimate"

Enter fullscreen mode Exit fullscreen mode

A test proves agents can't lie:

async def test_proxy_uses_registered_cost():
    # Tool registered at Rs 500/call
    # Agent with Rs 100 budget claims Rs 1
    # Result: 429 - Blocked!

Enter fullscreen mode Exit fullscreen mode

Why Proxy Wins Over Library

  • Network boundary - agents must cross it
  • Can't be bypassed by rogue import or version bump
  • Language-agnostic - works with any framework
  • Externally monitorable

Quick Start

pip install agent-gov-saas
agent-gov start
agent-gov config set budget 25.00 --agent my-bot

Enter fullscreen mode Exit fullscreen mode

Auto-paused at $25. No $30K surprise.


Part 1 of "Taming Your AI" series. agent-gov is open-source, MIT-licensed.