You exceeded your current quota
OpenAI refused the request because the account or project behind the API key is out of credit or has reached a spending limit.
Also appears as
- RateLimitError: 429 You have no credits remaining. Add credits to continue using the API at https://platform.openai.com/settings/organization/billing/.
- {"error":{"message":"You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.","type":"insufficient_quota","param":null,"code":"insufficient_quota"}}
- openai.RateLimitError: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}
Prompt to fix it
Calls to the OpenAI API fail with "429 You exceeded your current quota" (type insufficient_quota). This is a billing problem, so don’t add retries or backoff for it. Find where the app creates the OpenAI client and which environment variable holds the key, and tell me which OpenAI project that key needs to belong to. Then update the error handling so insufficient_quota stops right away, logs clearly, and shows users a friendly “AI is unavailable” message, while real rate limits still retry with backoff. Keep the key on the server.
Paste into Layerwise or any AI coding tool.
What it means
Despite the 429 status, this is a billing error. OpenAI uses 429 for both rate limits and billing, and the type insufficient_quota means billing: the organization or project that owns the key has no prepaid credit left, or it reached a spend or usage limit. Every request fails the same way until that changes, so retries only waste time.
API usage is billed separately from a ChatGPT subscription, and a new API account starts with no credit. Newer responses say so directly: “You have no credits remaining,” with the code credit_balance_exhausted. Spend limits you set have their own codes, organization_spend_limit_exceeded and project_spend_limit_exceeded, under the same insufficient_quota type.
If you’ve added credit and still see it, the key probably belongs to a different organization or project than the one you funded, or that project has its own spend limit. Check which project the key belongs to on the API keys page, then check that project’s limits.
Common causes
- The account has never had prepaid API credit, which is the default for new accounts whatever ChatGPT plan you have.
- The credit balance ran out, and auto recharge is off.
- The organization or project reached a spend limit set in its billing or project settings.
- The key in the app belongs to a different organization or project than the one with credit.
How to fix it
- Sign in to platform.openai.com, open your organization’s Billing settings, and check the credit balance.
- Add credits, and turn on auto recharge so a production app doesn’t stop when the balance runs out.
- Check the organization’s and project’s spend limits, and raise the one you hit.
- Confirm the key in your environment variables comes from the funded project, and redeploy after you change it.
- In code, treat
insufficient_quotaas permanent: stop retrying and show the user a clear message.
Example fix
import OpenAI from 'openai';
const openai = new OpenAI();
export async function generate(input: string) {
try {
const response = await openai.responses.create({ model: 'gpt-6-luna', input });
return response.output_text;
} catch (error) {
// Billing errors arrive as 429 too, but waiting never fixes them.
if (error instanceof OpenAI.APIError && error.type === 'insufficient_quota') {
throw new Error('AI is unavailable: the OpenAI account is out of credit.', {
cause: error
});
}
throw error;
}
}Related errors
All errors429 Too Many Requests
The service is rate limiting you: too many requests arrived in a short time, so it refuses more until the limit resets.
Incorrect API key provided
The AI API rejected the key your code sent: it has a typo, was revoked, or isn’t the key you think the app is using.
Anthropic API 529 overloaded_error
Anthropic’s API had more traffic than it could serve at that moment, so it turned your request away even though the request was fine.
Context length exceeded
The text sent to the model, including chat history, documents, and tool results, is more than the model can read in one request.
Build with an agent that checks its work
The Layerwise agent clicks through the live preview and reads the console, so it catches errors before you do.