Anthropic API 400 "Your credit balance is too low to access the Anthropic API": who is being billed, and what to do
Anthropic's API is prepaid: an organization buys credit, requests draw it down, and at zero every request returns this 400. That much is simple. What fills a thousand GitHub issues is the second way to get it: you pay for Claude Pro or Max, you run Claude Code, and a request is billed to the API account anyway, because an ANTHROPIC_API_KEY is set somewhere in your environment and Claude Code uses it in preference to your login. The subscription sits unused while the API balance drains, and when it hits zero you are locked out of both. Whichever way you arrived, the error stops when there is credit, and nothing else changes it.
Last verified September 21, 2026 against Anthropic docs: errors, anthropics/claude-code #31537: low credit balance after top up, anthropics/claude-code #44559: session using API credits instead of the subscription, GitHub: 1,151 issues quoting the message since January 2026 · 4 min read
| Provider | Anthropic API; Claude Code shows it as Credit balance too low · Add funds |
| HTTP status | 400 Bad Request, type invalid_request_error. Anthropic documents billing problems under 402, but this one arrives as a 400 |
| Message | Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits. |
| Cause | The organization behind the API key has no prepaid credit. API credit is separate from Pro and Max subscriptions |
| How common | 1,151 GitHub issues quote the exact message since January 2026 (GitHub search, September 21, 2026) |
| Can you wait it out? | No. Adding credit is the fix, and even that has taken hours to a week to register in the reports linked below |
- On a subscription? Run
/statusin Claude Code. If it shows an API key rather than your plan, find and unsetANTHROPIC_API_KEY(shell profile,.env,.claude/settings.json), then/login. - On an API key on purpose? Add credit at platform.claude.com. Check the key's organization is the one you funded.
- Topped up and still locked out? Known reports of hours to a week; contact support with the request id.
- To keep working now: point Claude Code at another Anthropic-format endpoint (fix 3).
What it looks like
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits."},"request_id":"req_011CZ..."}
Credit balance too low · Add funds: https://platform.claude.com/settings/billing (Claude Code's short form)It is a 400, not the 402 billing_error Anthropic's docs list for payment problems, so SDKs raise BadRequestError and frameworks that route on status treat it as a malformed request. In the Hermes and oh-my-openagent threads it never triggered their provider fallback for exactly that reason.
Who is being billed
| Situation | Why the API account is being billed | Fix |
|---|---|---|
| You use Claude Code with a Pro or Max subscription and still see this | An ANTHROPIC_API_KEY in your shell, a .env, or a project settings.json makes Claude Code bill the API account instead of the plan. Several threads report finding the variable after weeks of paying twice | Unset the variable and run /login; check /status shows the subscription |
| You use an API key on purpose and the console shows $0 | Prepaid credit ran out | Add credits. Auto-reload has its own monthly ceiling |
| You topped up and the error continues | Reports of the balance taking hours to a week to clear on Tier 4 accounts (#31537, open, 11 upvotes) | Nothing on your side; contact Anthropic support with the request id |
| A tool or agent framework shows it | Whoever configured that tool's Anthropic key | Check the tool's provider settings |
Fix 1: if you have a subscription, make Claude Code use it
Claude Code prefers an API key over a login when both are present. Run /status; if it names an API key, search for ANTHROPIC_API_KEY in ~/.zshrc, ~/.bashrc, any .env your shell loads, and the env block of .claude/settings.json at user and project level. Unset it, start a new shell, /login. The API balance you have already spent is gone; the plan windows are intact.
Fix 2: add credit, to the right organization
On platform.claude.com, Plans & Billing for the organization that owns the key. Keys are per organization; credit bought under a personal organization does not fund a key created under a workspace, and vice versa. If the balance shows funds and the error persists, you are in thread #31537: several users report the lock outlasting a paid top-up by hours or days. The request id in the error is what support asks for.
Fix 3: keep Claude Code working on another endpoint
Claude Code will talk to any host that speaks the Anthropic Messages API. Ours serves open models on it, from a balance that is yours and separate from Anthropic's:
export ANTHROPIC_BASE_URL="https://api.inferenceapis.com"
export ANTHROPIC_AUTH_TOKEN="your-inferenceapis-key"
export ANTHROPIC_MODEL="zai-org/GLM-5.3[1m]" # [1m] tells Claude Code the window is 1M, so it stops compacting at 200K
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-ai/DeepSeek-V4.1-Flash[1m]"
claudeOn September 21, 2026, Claude Code 2.1.278 through this endpoint on GLM 5.3 ran a failing test, fixed the bug and re-ran it in 6 turns and 3 seconds. Per-project setup, model results and the [1m] detail are in the Claude Code guide. When your Anthropic credit or login is sorted, open a new shell and you are back.
Frequently asked questions
I have Claude Max. Why does the API even have a balance?
The subscription covers Claude Code when it is logged in with your account. The API is a separate prepaid product for programmatic use. Claude Code can use either, and uses the API key if one is set.
Does this error consume the request?
No. Nothing was served and nothing is billed.
Why 400 and not 402?
Anthropic returns this particular condition as an invalid_request_error. Their docs list 402 billing_error for payment-method problems; the two are different conditions.
Where Inference APIs fits
Fix 3 is what we sell: Claude Code, the Claude Agent SDK and the Anthropic SDKs all work against our endpoint, which serves open models on the Anthropic Messages API from a prepaid balance of your own. They are not Claude. They finished our Claude Code test task for cents. US GPUs, zero retention; a new account starts with $1 of credit.
Something changed or wrong? Tell us and we will re-verify the entry.
