insufficient_quota Error Explained: Balance, Budget Cap, Rate Limit
insufficient_quota means this account or project has no billable quota left. It has nothing to do with how fast you send requests. Waiting a few seconds and retrying usually won't help. You need to add credit, raise the budget cap, or switch to a key that still has quota.
This error trips up newcomers because it often arrives with HTTP status 429, and most people read 429 as "rate limited." Below, the three easily confused cases are separated, followed by a troubleshooting order you can follow step by step.
When does insufficient_quota show up?
Using the OpenAI API as the example, a typical response looks like this:
{
"error": {
"message": "You exceeded your current quota, please check your plan and billing details.",
"type": "insufficient_quota",
"code": "insufficient_quota"
}
}
The key is the code field. Both are 429s, but rate_limit_exceeded means you hit a rate limit, while insufficient_quota means a quota problem. The phrase "you exceeded your current quota" is about quota, not request frequency.
Other providers use different wording but follow a similar idea: some return a dedicated insufficient-balance error code, others use a different 4xx status and explain in the response body. Field names and status codes are defined in each provider's official docs, so don't draw conclusions from the HTTP status alone.
What is the difference between low balance, a budget cap, and a rate limit?
| Type | Typical symptom | What it really is | Does waiting help? | What to do |
|---|---|---|---|---|
| Insufficient balance | insufficient_quota, fails on every model | Prepaid balance or free credit is used up | No | Add credit, or confirm which account the key belongs to |
| Budget cap | The account still has money, but a project or organization hit its monthly limit | A spending cap you (or an admin) set | No; wait for the next cycle or raise it manually | Adjust the budget or limit settings |
| Rate limit | rate_limit_exceeded, appears at peak times, clears after a few seconds | Requests per minute or tokens per minute exceeded your tier | Yes | Back off and retry, lower concurrency, upgrade your tier |
A rough rule of thumb: if it recovers after a few seconds, it is probably a rate problem. If it fails the same way no matter how many times you retry, it is probably a quota problem. The error code in the response body is the final word.
Budget caps are especially easy to overlook. Many platforms let you set a spending cap per organization or project. The account balance may be fine while one project's key keeps returning quota errors. In that case, look at the project the key belongs to, not the total account balance. Where to find these settings, and what they are called, is covered in the official docs.
What order should you troubleshoot insufficient_quota in?
- Check the error code, not just the status code. Print the full response body and see whether
codeortypeisinsufficient_quota. If it israte_limit_exceeded, see 429 Too Many Requests: how to troubleshoot LLM API rate limits. - Confirm which account and project the key belongs to. Many people hold several keys, and a key copied from an old project may belong to an account that ran out of quota long ago. Check the organization and project the key lives in, in the console.
- Open the usage and billing pages. Look at your balance, the quota you have used, and whether there are unpaid invoices. Whether free trial credit expires, and what the API returns afterward, is covered in the official docs.
- Check the project or organization budget cap. If the account has balance but you still get the error, look at whether a monthly limit is set and whether you have reached it this month.
- After adding credit or changing settings, wait a moment and test again. Credit may take a while to show up. Verify with one minimal request instead of rerunning the whole batch.
A minimal curl check looks like this (the key is passed through an environment variable so it stays out of your shell history):
curl -s https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"<your model name>","messages":[{"role":"user","content":"ping"}],"max_tokens":5}'
Use a model your account can access. The name here is only a placeholder.
How should your code handle these two kinds of 429?
Don't retry every 429 the same way. Retrying a quota error only wastes time, and under high concurrency it can add log noise. A more robust approach:
- Parse the error code in the response body. Send
rate_limit_exceededthrough exponential backoff and retry. - Fail
insufficient_quotaimmediately, raise an alert, and notify whoever owns billing. - Count the two separately in monitoring. Otherwise a "429 spike" metric mixes billing problems with traffic problems.
For how to set alert thresholds, see How to set LLM API alert thresholds: treating 429, 5xx, timeouts, and P95 latency separately.
How do you tell related errors apart?
- For a full comparison of the two OpenAI 429 types, read OpenAI 429 errors: telling insufficient_quota from rate_limit_exceeded and how to handle each.
- For provider-agnostic rate limit troubleshooting, read 429 Too Many Requests: how to troubleshoot LLM API rate limits.
- To look up other status codes together, use LLM API error code cheatsheet: what 400 to 529 mean and which to retry.
- If you get a 401, the problem is the key itself. See 401 Invalid API Key: 6 things to check one by one.
- If the error is unsupported_country_region_territory, that is a region-support issue, not a quota issue. See What the unsupported_country_region_territory error means.
One more case is worth ruling out first: the service itself may be having an outage and returning abnormal responses. You can check the probe results for the official API endpoint on cdnping's OpenAI status page, or use Is it down? for an overall status view. Note that these pages reflect service availability. They cannot tell you anything about your own account's quota.
Are there other options for beginners in China who hit quota problems?
For users in China, a quota problem with an overseas provider is often more than "just add credit." You may need an international payment method, and your account's region must be within the provider's officially supported range. All of this follows each provider's official policy. Please use these services in line with their terms and local regulations, and don't try to get around payment or region restrictions in ways that aren't compliant.
If your goal is to use models reliably in tools like Claude Code and Codex, you can look at AGI Plan. AGI Plan is a commercial partner of cdnping. What follows lists only facts published on its official site:
- A multi-provider LLM aggregation gateway, sold as a monthly subscription, billed in RMB, with no overseas credit card required.
- The quota in one subscription can be switched between multiple capability groups.
- Tools such as Claude Code and Codex only need one endpoint address changed.
- Some models are marked "overseas only." See the model list for specifics.
- The site states that it is not an officially authorized channel. Whether it suits you is for you to judge.
For setup steps and plans, see the AGI Plan beginner guide.
What to do next
- Print the full response body and confirm that
codeisinsufficient_quota. - Check which organization and project the key belongs to, then look at the balance and budget cap.
- After fixing it, verify with one minimal request.
- In your code, handle quota errors and rate errors separately.
If the account's quota is fine and requests still fail, move on to the network layer, for example the Developer network self-check checklist (2026 edition), or test connectivity to each AI API from the home page.