Claude Code's Agent SDK Credit Pool Explained: What Changed on June 15, 2026 (and How to Cut the Bill)
On June 15, 2026, Anthropic split Claude Code billing into two separate pools: interactive terminal/IDE usage still draws from your Pro or Max subscription limits, while programmatic usage (the Agent SDK, headless claude -p calls, GitHub Actions integrations) now draws from a separate monthly Agent SDK credit billed at full standard API rates, with no rollover. If you automate Claude Code in CI/CD or scripts, this change directly affects your monthly cost.
What actually changed
Before the split, every way of running Claude Code — typing in the terminal, running headless scripts, or triggering it from a GitHub Action — shared the same usage pool as your Claude.ai chat sessions. Heavy automated workloads could throttle your interactive chat access, which was a common complaint among teams running Claude Code in build pipelines.
Anthropic's fix was to carve programmatic usage into its own bucket:
| Usage type | How it runs | Billed against |
|---|---|---|
| Interactive Claude Code | Terminal or IDE, human at the keyboard | Pro/Max subscription limits |
| Claude.ai chat | Web, desktop, mobile | Pro/Max subscription limits |
| Agent SDK (Python/TypeScript) | Your own programmatic projects | Separate Agent SDK credit |
claude -p (headless) | Scripted/non-interactive Claude Code | Separate Agent SDK credit |
| Claude Code GitHub Actions | CI/CD automation | Separate Agent SDK credit |
Any usage with ANTHROPIC_API_KEY set | API-key auth instead of subscription | Standard pay-as-you-go API rates |
One detail worth remembering: setting the ANTHROPIC_API_KEY environment variable overrides your subscription entirely. Once it's set, Claude Code authenticates with that key and bills as plain pay-as-you-go API usage, regardless of what plan you're on.
How much Agent SDK credit do you actually get
The credit pool is tied to your subscription tier, and it's metered at full API rates — there's no subscriber discount applied to programmatic usage:
| Plan | Monthly Agent SDK credit |
|---|---|
| Claude Pro ($20/mo) | $20/mo |
| Claude Max 5x ($100/mo) | $100/mo |
| Claude Max 20x ($200/mo) | $200/mo |
Credits do not roll over between billing cycles, and running out mid-month means your automated Claude Code jobs simply stop until the next reset — unless you've separately enabled pay-as-you-go usage credits, in which case overflow bills at standard rates.
Who this actually affects
If you only use Claude Code interactively at your desk, nothing changes for you — you're still on the same subscription pool as before. The people who feel this immediately are:
- Teams running Claude Code headlessly in CI/CD pipelines or GitHub Actions
- Developers building on the Agent SDK for their own automated workflows or internal tools
- Anyone who scripts batch code review, test generation, or repo-wide refactors via
claude -p
For light interactive users on Pro, the $20 credit pool is usually enough headroom. For anything beyond light automation, a Max plan upgrade or a switch to direct API billing becomes the practical choice — and direct API billing is exactly where cost-control techniques like prompt caching and model tiering start to matter a lot.
How to keep programmatic Claude Code costs down
Since Agent SDK and headless usage now bills at full API rates with a hard monthly ceiling, the usual cost levers matter more than ever:
- Prompt caching — reuse system prompts, repo context, and tool definitions across calls instead of resending them every turn. This alone can cut input token costs by 70-90% on repetitive agent loops.
- Model tiering — route simple lint/format/summary tasks to a cheaper model and reserve the flagship model for genuinely hard reasoning or multi-file refactors.
- Batch where possible — group non-urgent jobs (nightly test generation, doc updates) instead of firing one request per commit.
- Watch context length — agent loops accumulate tool output fast; trimming stale context keeps both latency and spend down.
The other option worth knowing about: once you're on ANTHROPIC_API_KEY billing anyway, nothing forces you to use Anthropic's own endpoint at full list price. An OpenAI-compatible relay like Safa API lets you point ANTHROPIC_BASE_URL at a cheaper endpoint, keeps prompt caching support intact so your caching strategy still works, and settles payment via Alipay instead of requiring a US credit card — useful if your team is outside the US. It also exposes Claude, GPT, and Gemini through one endpoint, so if a headless job needs to fall back to a different model when the Agent SDK credit pool runs dry mid-month, you don't need a second SDK or a second billing account to do it.
常见问题 / FAQ
Does the Agent SDK credit pool affect interactive Claude Code in my terminal?
No. Interactive Claude Code sessions where you're typing in the terminal or IDE still draw from your regular Pro/Max subscription usage limits, exactly as before June 15, 2026. Only programmatic usage — Agent SDK calls, headless claude -p, and GitHub Actions — moved to the new separate credit.
What happens if my Agent SDK credit runs out before the month ends?
Agent SDK requests stop until your credit refreshes at the next billing cycle, unless you've enabled pay-as-you-go usage credits on your account, in which case overflow usage is billed at standard API rates.
Can I avoid the credit pool limit entirely?
Yes — setting ANTHROPIC_API_KEY switches Claude Code to direct pay-as-you-go API billing instead of any subscription pool. At that point, using a cheaper OpenAI-compatible relay that supports prompt caching and doesn't require a foreign credit card, such as Safa API, is a straightforward way to lower the effective per-token cost of your automated workflows.
官方直连 · 一个接口接入 Claude / GPT / Gemini · 7×24 稳定
免费注册试用 →