Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenRouter error

OpenRouter 402 weight_exceeds_budget: what it means and how to fix it

Error message
402 weight_exceeds_budget

Retry? NoLast verified 1 documented fix1 source

What it means

This single request's estimated cost is larger than your whole in-flight budget. metadata.limit_source is openrouter_credits. Retrying will not help.

Causes

  • Large prompt or high max_tokens making one request's estimated cost exceed the in-flight budget

How to fix it

  1. Fix 1.

    Lower max_tokens or the prompt size, or add credits.

More OpenRouter errors

All 32 OpenRouter errors

HTTP 402 at other providers

FAQ

What does the OpenRouter error "402 weight_exceeds_budget" mean?

This single request's estimated cost is larger than your whole in-flight budget. metadata.limit_source is openrouter_credits. Retrying will not help.

How do I fix OpenRouter "402 weight_exceeds_budget"?

Lower max_tokens or the prompt size, or add credits.

Should I retry OpenRouter "402 weight_exceeds_budget"?

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 1 source: 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.