billing_error / payment_required
Your Anthropic account has run out of API credits, has no active payment method, or has hit a spending limit. This is a billing configuration issue — fix it in the Anthropic Console and the error clears immediately.
What the error looks like
{
"type": "error",
"error": {
"type": "payment_required",
"message": "Your credit balance is too low to make API requests. Please go to Plans & Billing to get more credits."
}
}
HTTP status: 402. You may also see "type": "billing_error" in some account states.
Common causes
- Free-tier credits exhausted — new accounts get $5 of free credits; once spent, all calls return 402
- No payment method on file — account was never upgraded from the free tier
- Card declined or expired — Anthropic tried to charge and the card failed
- Hard spending limit reached — you set a monthly cap in the Console and crossed it
- Account suspended for billing — unpaid invoices or fraud hold
Fix: Add or update your payment method
- Go to console.anthropic.com → Settings → Billing
- Click Add payment method (Visa, Mastercard, Amex accepted)
- Purchase a credit top-up ($5 minimum, or enable auto-recharge)
- Retry your API call — the 402 will be gone immediately
Fix: Raise or remove your spending limit
If you have a spending cap set:
- Go to Settings → Billing → Usage limits
- Increase the monthly spend limit or disable it
- Optionally set an alert threshold instead of a hard cap
Check your balance programmatically
import anthropic
client = anthropic.Anthropic()
# The SDK wraps 402 as anthropic.PaymentRequiredError
try:
message = client.messages.create(
model="claude-opus-4-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
except anthropic.PaymentRequiredError as e:
print(f"Billing issue: {e}")
print("Go to https://console.anthropic.com/settings/billing")
TypeScript / Node.js
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
try {
const message = await client.messages.create({
model: "claude-opus-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});
} catch (error) {
if (error instanceof Anthropic.PaymentRequiredError) {
console.error("Billing issue — add credits at console.anthropic.com");
}
}
Frequently Asked Questions
Claude Haiku 4.5 starts at $0.80/$4.00 per MTok input/output. Sonnet 4.6 is $3/$15. Opus 4.7 is $15/$75. See the official pricing page for current rates.
No. Claude.ai subscriptions (Free/Pro/Team) are separate from API billing. An API 402 does not affect your claude.ai access, and vice versa.
Some banks block international tech charges. Try a different card, or contact your bank to whitelist Anthropic's merchant ID. If it still fails, contact billing@anthropic.com.
Related errors
- authentication_error (401) — invalid or missing API key
- permission_error (403) — key lacks required scopes
- rate_limit_error (429) — too many requests per minute