Home / Use cases / anthropic-api-budget-cap
Cap Claude API spend per agent — automatic USDC paywall
The problem
You hand an agent your Anthropic API key. It loops, makes 200,000 calls overnight, you wake up to a $4,000 bill. There is no per-agent budget primitive in the upstream API.
What Spawnpay does
Wrap each agent in the Spawnpay paywall SDK with a daily budget. Pre-charge throws BUDGET_DAILY before the call goes upstream. State persists to ~/.spawnpay/budget-state.json with a 24h rolling window.
Code
curl -X POST https://spawnpay.ai/api/proxy\
-H 'Authorization: Bearer spk_live_...'\
-H 'Content-Type: application/json' \
-d '{ "provider": "anthropic", "path": "/v1/messages", "method": "POST", "body": { "model": "claude-haiku-4-5-20251001", "max_tokens": 256, "messages": [ { "role": "user", "content": "hello" } ] }}'
What you get with $7 free credit
Every new spk_ wallet starts with $7. That covers 7,000 proxy calls, 1,400 cloud-scrapes, or 700 screenshots — enough to verify Spawnpay fits your workflow before topping up.