Your credit balance is too low to access the Anthropic API
The API runs on prepaid credits, and your workspace has run out — a Claude Pro subscription does not include API credits. Buy credits or enable auto-reload in the console.
Updated
The error
anthropic.BadRequestError: Error code: 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.'}}What it means
Anthropic's API is prepaid: you buy credits, requests consume them, and at zero the API stops. Your key is valid and your code is fine — the account's balance is empty. This differs from a rate limit, which is about speed, and from a 401, which is about identity. This one is purely money.
Why it happens
The most common confusion: a Claude.ai subscription is not API credit. Claude Pro/Max pay for the chat product at claude.ai; the API at console.anthropic.com bills separately. Many developers subscribe to Pro, generate an API key, and are surprised the key has no balance behind it.
Otherwise it is ordinary exhaustion: the initial credits ran out, a batch job consumed more than expected, or the balance sits in a different workspace than the key you are using — balances and keys are workspace-scoped in organisations.
How to fix it
1. Buy credits. In console.anthropic.com, open Plans & Billing and purchase a credit pack. The API resumes within minutes of the balance going positive.
2. Turn on auto-reload for anything that must not stop. Set a threshold and a top-up amount, and the balance refills itself. This converts a hard outage into a billing line item — the right trade for production.
3. Check which workspace your key belongs to. If the organisation has several workspaces, credits in one do not fund keys from another. The key's workspace is shown where it was created; match key and balance.
4. Understand the spend before refilling blind. The console's usage page breaks down tokens by model and key. A surprise drain usually has a mundane cause — a retry loop without backoff, a verbose system prompt sent on every call, or an oversized max_tokens combined with long generations. Fix the leak, then refill.
5. Cut costs on the code side. Use a smaller model for easy tasks, cache repeated prompt prefixes (prompt caching discounts repeated context), trim conversation history, and batch offline work with the Batches API, which is priced lower.
How to prevent it
Set a balance alert (and auto-reload for production) the day you create the account. Track cost per feature from the start — tokens in, tokens out, model — so growth in spend is a graph you watch, not a 400 you discover.
Related errors
- RateLimitError 429 — includes the OpenAI quota-exhaustion twin of this error
- 401 Incorrect API key provided
- Error 529: Overloaded