How to set a spending limit on the Anthropic API
Last updated
Anthropic stops your API requests at three kinds of monthly limit: the spend cap that comes with your usage tier, a spend limit you set for your organization, and a spend limit you set for a workspace. This page shows where to find and set them, what your app sees when one is reached, and what they don't cover.
Everything here was checked against Anthropic's docs on November 12, 2026. The credit balance error message and the note on API keys were added and checked on November 13, 2026. The sources are linked under the sections they back up.
The short version
- In the Claude Console, open Spend limits.
- Next to Monthly spend limit, click Set limit or Adjust limit.
- Enter an amount. It can't be higher than your tier's cap.
To cap one workspace instead, open Workspaces, select the workspace and click Spend limits.
Three limits, from Anthropic and from you
- Your tier's spend cap is set by Anthropic. It's the most your organization can spend on the API in a calendar month: $500 on the Start tier, $1,000 on Build and $200,000 on Scale. The Custom tier has no cap; its limits are arranged with Anthropic's account team. New organizations may start on an Evaluation tier with lower limits. Your tier is shown on the Rate limits page in the Console.
- Your organization's spend limit is one you set yourself, below the tier's cap.
- A workspace's spend limit covers only that workspace. You can set one on every workspace except the Default Workspace. The organization's limits still apply, even if the workspace limits add up to more.
You can use all three: a small limit on the workspace that runs agents or experiments, and an organization limit set to the most you could stand to lose in one month.
Sources: Anthropic, Rate limits → Spend limits, Anthropic, Workspaces → Workspace limits
Set a limit on the whole organization
- In the Claude Console, go to Spend limits. Your tier's monthly spend cap is shown there too.
- Next to Monthly spend limit, click Set limit or Adjust limit.
- Enter a new value. It can't be higher than your tier's cap.
Set a limit on one workspace
- In the Claude Console, open Workspaces and select the workspace.
- In the panel that opens, click Spend limits.
- Set the monthly limit. In the same place, you can add alerts for when spending reaches certain thresholds.
You can't set a spend limit on the Default Workspace. To cap an agent or an experiment, create a workspace for it, create a new API key in that workspace, and give the workspace a small limit. An existing key can't be moved to another workspace. Only organization admins can create workspaces.
Anthropic's docs don't describe a spend limit for a single API key, only for an organization and for a workspace. The Claude Code workspace is different: Anthropic says it is the only workspace that supports per-user monthly spend limits.
Sources: Anthropic, Rate limits → Setting your own spend limit, Anthropic, Workspaces, Claude Help Center, Create and manage workspaces
What happens when you reach a limit
What your app gets depends on which limit was reached.
A limit you set
Requests fail with error 400 and the type invalid_request_error. The message starts with “You have reached your specified API usage limits”, or “You have reached your specified workspace API usage limits” for a workspace limit, and says when access comes back. Raise or remove the limit to get access back sooner.
Your tier's spend cap
Requests fail with error 429 and the type rate_limit_error, the same as a rate limit. On the Messages API, the error's details.error_code is enforced_spend_limit_reached, and there's no retry-after header. Usage stays paused until 00:00 UTC on the 1st of next month, unless Anthropic raises your limit sooner. To ask for that, use Request tier increase on the Rate limits page in the Console, or contact Anthropic support if it's urgent.
Limits on the Claude Code workspace work differently: Claude Code requests over that workspace's limit can get a 429 with a retry-after header instead.
Sources: Anthropic, Rate limits → Reaching your spend cap, Anthropic, Errors
Stop your code from retrying a limit
Anthropic's official SDKs retry rate limits 2 times by default, and the spend cap's 429 looks like a rate limit. Anthropic says retrying it, including the SDK's automatic retries, fails until access comes back. In our test against a local server that sends Anthropic's documented spend cap error, one call with the SDK's default settings sent 3 requests. If your own code retries too, those retries add up. Check for a spend limit before you retry:
import anthropic
# A spend limit you set on the organization or a workspace
YOUR_LIMIT = (
"You have reached your specified API usage limits",
"You have reached your specified workspace API usage limits",
)
# Your own retry loop decides, so turn off the SDK's 2 automatic retries
client = anthropic.Anthropic(max_retries=0)
def spend_limit_reached(error: Exception) -> bool:
"""True when Anthropic's response says a spend limit stopped the request."""
if not isinstance(error, anthropic.APIStatusError):
return False
body = error.body if isinstance(error.body, dict) else {}
info = body.get("error") or {}
if error.status_code == 429:
# Your tier's monthly spend cap. Anthropic documents this code
# for the Messages API.
details = info.get("details") or {}
return details.get("error_code") == "enforced_spend_limit_reached"
if error.status_code == 400:
return str(info.get("message", "")).startswith(YOUR_LIMIT)
return False
def is_retryable_rate_limit(error: Exception) -> bool:
"""True for a 429 that isn't a spend limit."""
if not isinstance(error, anthropic.RateLimitError):
return False
return not spend_limit_reached(error)import Anthropic from "@anthropic-ai/sdk";
// A spend limit you set on the organization or a workspace
const YOUR_LIMIT = [
"You have reached your specified API usage limits",
"You have reached your specified workspace API usage limits",
];
type ErrorBody = {
error?: { message?: string; details?: { error_code?: string } };
};
// Your own retry loop decides, so turn off the SDK's 2 automatic retries
const client = new Anthropic({ maxRetries: 0 });
// True when Anthropic's response says a spend limit stopped the request.
function spendLimitReached(error: unknown): boolean {
if (!(error instanceof Anthropic.APIError)) return false;
const info = (error.error as ErrorBody | undefined)?.error;
if (error.status === 429) {
// Your tier's monthly spend cap. Anthropic documents this code
// for the Messages API.
return info?.details?.error_code === "enforced_spend_limit_reached";
}
if (error.status === 400) {
const message = info?.message ?? "";
return YOUR_LIMIT.some((start) => message.startsWith(start));
}
return false;
}
// True for a 429 that isn't a spend limit.
function isRetryableRateLimit(error: unknown): boolean {
return error instanceof Anthropic.RateLimitError && !spendLimitReached(error);
}Call the checks in your retry loop. When the rate limit check says yes, wait as long as the retry-after header says, or back off if there's no header. When the spend limit check says yes, stop and tell someone: the request will keep failing until the limit changes or access comes back.
- Retries off means all retries off. With retries set to 0, the SDK also stops retrying connection errors and 408, 409 and 5xx errors, so your own loop has to retry those too.
- The spend cap's code is documented for the Messages API only. On other endpoints, a spend cap 429 can look like an ordinary rate limit, so limit how many times your loop retries.
- A ramp limit is fine to retry. On the Messages API, its 429 has the code
ramp_limit_exceeded. Anthropic says to wait at least as long as itsretry-afterheader says. - The 400 check reads the message. Anthropic's docs give no error code for the 400, only how its message starts. Anthropic also says not to match on message wording because it can change, so treat this check as best effort.
The checks read Anthropic's response body instead of fields added in newer SDKs, so they don't need a recent SDK. We ran them with the Python SDK (anthropic 2.8.0 and 0.60.0) and the TypeScript SDK (@anthropic-ai/sdk 1.8.0 and 0.60.0), against a local test server that sends the errors described above. The newest SDKs also raise their own EnforcedSpendLimitReachedError for the spend cap. It's a kind of rate limit error, so the checks still work there.
Sources: Anthropic, Errors, Anthropic, Rate limits → Ramp limits, Anthropic, Python SDK → Retries, anthropic-sdk-python, anthropic-sdk-typescript
Prepaid credits stop requests too
Most organizations pay for Claude API usage with prepaid credits. Organizations with an invoicing arrangement are billed monthly instead. When the credits run out, you can't call the API until you add more.
Your credit balance is too low to access the Anthropic API. Please go to Plans & Billing to upgrade or purchase credits.To fix it, buy credits on the Billing page in the Claude Console. Anthropic says purchased credits are available immediately. If you see it in Claude Code while you pay for a Claude plan, or it stays after you buy credits, the guide to this error covers those cases.
Anthropic's docs show this message on one page, about the API credits that come with Max, Ultra and Team plans, and give no status code. Developers report it as a 400 with the type invalid_request_error (GitHub issues from November 12 and November 13, 2026). A spend limit you set returns the same status and type, so read the message to tell which one you hit. The checks above don't treat this error as a spend limit or as a rate limit, so your loop won't retry it.
With auto-reload on, Anthropic buys more credits whenever your balance falls below an amount you choose. Then running out of credits may not stop a runaway loop, so set a spend limit as well.
Sources: Claude Help Center, How do I pay for my Claude API usage?, Anthropic, API credits for Max, Ultra, and Team plans
What the limits don't cover
- They're monthly. A loop can spend the whole month's limit in one night, and requests keep failing until you raise or remove the limit, or access comes back.
- They only act at the end. Without alerts, you find out when your app stops working. Workspace spend limits can send alerts at thresholds you choose. Set them well below the limit.
- The Default Workspace can't have one. Keys in it are covered only by the organization's limit and your tier's cap.
- Anthropic's docs don't say how fast a limit takes effect, or whether spend can go past it first.
- They only see Anthropic. OpenAI, Gemini and OpenRouter each have their own cap. This guide covers all four.
Where Billfuse fits
Billfuse is the tool we built for these gaps. It doesn't replace Anthropic's limits. Keep them on.
- One budget across Anthropic and your other providers. Billfuse connects with an Anthropic admin key, checks your spend every hour and emails you at 50%, 80% and 100% of the budget. It can post to Slack too. Individual accounts get admin keys once they set up an organization in the Claude Console.
- Spike alerts, with no budget needed. When one provider's day reaches 3 times a normal day, and at least $10 more, you get an email, and a Slack message if you added one.
- Pausing, if you turn it on. When your total budget or your Anthropic budget reaches 100%, Billfuse switches off each active Anthropic API key. Keys created later aren't paused. Each budget pauses at most once a month, and a pause stays on, also into next month, until you click Resume. Resume turns back on each key that's still off, and you can choose keys to keep off. Keys you turned back on or deleted yourself while it was paused are left alone.
- What it can't do. It isn't instant: Billfuse checks your spend once an hour, so it can act late. It reads what you spent, not your prepaid credit balance, so it doesn't warn you when credits are about to run out. Keep Anthropic's own limits on as well.
More guides
- How to put a hard spending cap on OpenAI, Anthropic, Gemini and OpenRouter
- How to set a hard spending limit on the OpenAI API
- How to set a spending limit on the Gemini API
- How to set a spending limit on the OpenRouter API
- Billing error or rate limit? AI API errors from OpenAI, Anthropic, Gemini and OpenRouter
- Leaked AI API key: what to do first
- Fix "Your credit balance is too low to access the Anthropic API"
- Gemini API error 402: "Your prepayment credits are depleted"
- OpenAI error 429 insufficient_quota: "You exceeded your current quota"
- OpenRouter 402: "This request requires more credits, or fewer max_tokens"
It's free while Billfuse is in early access. You can try it with sample data first, no sign-up needed.