Guides: spending limits for AI APIs
Last updated
OpenAI, Anthropic, Google Gemini and OpenRouter each let you set a hard cap on spending: a dollar amount where your requests start to fail. These guides show where each cap is, what happens when you hit it, and what it doesn't cover.
The first guide covers the caps at all four providers on one page. The next four cover one provider each, in more detail. The last six are for when something has already gone wrong: an error you can't place as billing or a rate limit, a key has leaked, Anthropic says your credit balance is too low, Gemini says your prepayment credits are depleted, OpenAI says you exceeded your current quota, or OpenRouter says a request requires more credits. Every guide was checked against the providers' own docs and says when.
How to put a hard spending cap on OpenAI, Anthropic, Gemini and OpenRouter
Where each AI API lets you stop spending at a dollar amount, what happens when you hit it, and what the caps don't cover.
Last updated
How to set a hard spending limit on the OpenAI API
Turn on OpenAI's hard spend limit for a project or your whole organization, and stop retrying the 429 errors it causes.
Last updated
How to set a spending limit on the Anthropic API
Set a monthly spend limit for your Anthropic organization or a workspace, and stop retrying the 400 and 429 errors at a limit.
Last updated
How to set a spending limit on the Gemini API
Set a monthly spend cap on a Gemini API project in AI Studio or Google Cloud, see what happens at a cap, and stop retrying one.
Last updated
How to set a spending limit on the OpenRouter API
Set a credit limit on an OpenRouter API key or a budget on a workspace, tell a 402 from a 403, and stop retrying a limit.
Last updated
Billing error or rate limit? AI API errors from OpenAI, Anthropic, Gemini and OpenRouter
Which OpenAI, Anthropic, Gemini and OpenRouter errors mean credits or a spend limit ran out, and which are rate limits to retry.
Last updated
Leaked AI API key: what to do first
What to do when an AI API key leaks: turn it off, save the usage records, report it.
Last updated
Fix "Your credit balance is too low to access the Anthropic API"
Why the Anthropic API says your credit balance is too low, even with Claude Pro or Max or after buying credits, and why retrying won't help.
Last updated
Gemini API error 402: "Your prepayment credits are depleted"
What the Gemini API's 402 "Your prepayment credits are depleted" means, which keys stop, and how to add credits.
Last updated
OpenAI error 429 insufficient_quota: "You exceeded your current quota"
What OpenAI's 429 insufficient_quota error means, which of four billing limits stopped you, and how to fix each one.
Last updated
OpenRouter 402: "This request requires more credits, or fewer max_tokens"
What OpenRouter's 402 "requires more credits, or fewer max_tokens" can mean, even with credits left, and how to fix it.
Last updated