OpenRouter error
OpenRouter 402 payment_required: what it means and how to fix it
402 payment_requiredRetry? NoLast verified 4 documented fixes2 sources
What it means
The account or API key has insufficient credits. error.metadata.limit_source is openrouter_credits when the balance cannot cover the request, or openrouter_key_limit when the key's credit limit is exhausted. A negative balance can cause 402 even for free models.
Causes
- Account balance at or below zero
- Per-key credit limit exhausted
- Balance cannot cover the request's estimated cost
How to fix it
- Fix 1.
Check error.metadata.limit_source, then add credits to bring the balance above zero.
- Fix 2.
If the key's limit_remaining is exhausted, raise the key's credit limit or wait for it to reset (see limit_reset).
- Fix 3.
Reduce the request size (fewer input tokens or a lower max_tokens), and monitor with GET /api/v1/key.
- Fix 4.
A 402 without a Retry-After header is not a wait-and-retry case.
More OpenRouter errors
All 32 OpenRouter errors400 invalid_requestRetry? Not stated400 invalid_promptRetry? Not stated400 context_length_exceededRetry? Not stated400 max_tokens_exceededRetry? Not stated400 token_limit_exceededRetry? Not stated400 string_too_longRetry? Not stated400 invalid_imageRetry? Not stated400 image_too_largeRetry? Not stated
HTTP 402 at other providers
FAQ
What does the OpenRouter error "402 payment_required" mean?
The account or API key has insufficient credits. error.metadata.limit_source is openrouter_credits when the balance cannot cover the request, or openrouter_key_limit when the key's credit limit is exhausted. A negative balance can cause 402 even for free models.
How do I fix OpenRouter "402 payment_required"?
There are 4 documented fixes. Start with the first: Check error.metadata.limit_source, then add credits to bring the balance above zero.
Should I retry OpenRouter "402 payment_required"?
No. The official docs treat this error as not retryable: fix the cause before sending the request again.
Which other AI APIs return HTTP 402?
Per their official error docs: Anthropic API (402 billing_error), Cohere API (402 Payment Required), DeepSeek API (402 - Insufficient Balance), Gemini API (402 payment_required; 402 RESOURCE_EXHAUSTED), Mistral API (402 Payment required).
Sources
Last verified against 2 sources: OpenRouter's official docs and official SDK repositories.
Newsletter
Know when the APIs change
One email per week. New model releases, API changes, what broke, and how developers are working around it.