Guide · Budgets

How to set a daily budget per API key

A monthly limit tells you how much you might lose. A daily limit for each key tells you which agent went wrong today. Here's what each provider supports natively and how to close the gaps.

Published

What each provider supports

ProviderNative per-key limitNative daily resetThe closest native setup
OpenRouterYesYes (limit_reset: daily)Set it directly on the key
OpenAINo (limits apply to a project or organization)No (monthly)One key per project, with a monthly hard limit on the project
AnthropicNo (limits apply to a workspace or organization)No in the Console (monthly)One key per workspace, with a monthly workspace limit

OpenRouter: native daily limit per key

In the dashboard

Open the key's page and set a credit limit. Choose a daily reset if you want it to refill each day. Once a key uses its limit, its requests are rejected until it resets or you raise it. [1] The Key safety tab in security settings flags keys that have no limit. [2]

With the Management API

PATCH https://openrouter.ai/api/v1/keys/{hash} with a body like {"limit": 20, "limit_reset": "daily"}. Resets happen at midnight UTC. A Management API key is required. [3]

OpenAI: one project per key, then a monthly hard limit

OpenAI's spend limits are monthly, for the organization or a project. [4] To get as close to per-key as OpenAI allows:

Step 1: give each agent its own project

Create a project for each agent or tool, and create that agent's API key inside its project.

Step 2: set the project's hard limit

Go to Project settings → Limits → Spend → Edit spend limit, enter the Monthly spend limit, turn on Enforce a hard limit, and save. Requests then fail with 429 project_spend_limit_exceeded once the limit is reached. Enforcement isn't instantaneous. [4]

Step 3: add a daily check

OpenAI has no native daily limit. To get one, poll per-key spend yourself, or use a monitor. OpenAI's admin API reports completions usage grouped by api_key_id and daily costs. [5]

Anthropic: one workspace per key, then a monthly workspace limit

Step 1: give each agent its own workspace

Create a workspace for each agent and create that agent's key in it. The Default Workspace can't have a spend limit, so don't use it for agents. [6]

Step 2: set the workspace's spend limit

On the Workspaces page (platform.claude.com/settings/workspaces), select the workspace, click Spend limits, then Change limit. You can also add an email notification there. A workspace limit must be lower than the organization's limit. [6][7]

Step 3: add a daily check

Console limits are monthly. [8] Anthropic's Admin API (organization accounts only) provides a messages usage report grouped by API key, which you can poll for daily totals. [9]

Choosing the numbers

These starting points are suggestions from the OpenAI per-key guide, not measured averages.

  • Daily cap: start near the key's normal daily total, not the worst day you can imagine.
  • Spike rule: for keys that should stay fairly flat, alert when spend over the last few minutes is a large multiple of the recent baseline. The OpenAI guide suggests trying about 8× over 10 minutes.
  • Kill action: decide it in advance. OpenAI key deletion is permanent; Anthropic and OpenRouter disables are reversible. [3][10]

Get a daily per-key budget on all three with BillCurfew

BillCurfew adds a daily dollar cap and a spike rule to each key on OpenAI, Anthropic and OpenRouter. It reads admin APIs, so there's no proxy and no code change, and it stores no prompts. Alerts go by email on every plan, with Slack on paid plans. A manual kill works on every plan, including Free. Optional auto-kill is paid-only and stays off until you turn it on. It polls about every five minutes, so treat it as a second clock next to the limits above, not a replacement for them.

Start free with one key, no card. Free is $0 for 1 provider and 1 key, with email alerts and a manual kill. Solo is $19/mo, Team $49/mo and Agency $149/mo, each with a 14-day trial.

FAQ

Can I set a daily spend limit on an OpenAI API key?

Not natively. OpenAI spend limits are monthly and apply to an organization or project. Put one key in each project and add a daily check on top.

Does Anthropic have per-key spend limits?

Not per key. Spend limits apply to the organization or a workspace and are monthly in the Console. Put one key in each workspace.

Does OpenRouter support daily limits per key?

Yes. Set limit and limit_reset to daily on the key. It resets at midnight UTC. [3]

What happens when a limit is hit?

OpenAI returns 429 with a spend-limit error code, Anthropic returns an error saying you've reached your specified usage limits, and OpenRouter rejects the key's requests until it resets or the limit is raised. [4][8][1]

Why bother with a daily budget if I have a monthly one?

A monthly limit can be used up by one night's loop. A daily per-key limit keeps the damage to one day and one agent.

Sources

  1. OpenRouter, API Authentication. https://openrouter.ai/docs/api_reference/authentication [1]
  2. OpenRouter, Security settings. https://openrouter.ai/docs/guides/overview/auth/security-settings [2]
  3. OpenRouter, Update an API key. https://openrouter.ai/docs/api/api-reference/api-keys/update-an-api-key [3]
  4. OpenAI, Spend limits. https://developers.openai.com/api/docs/guides/spend-limits [4]
  5. BillCurfew, OpenAI per-key spend limit. billcurfew.com/guides/openai-per-key-spend-limit [5]
  6. Anthropic, Workspaces. https://platform.claude.com/docs/en/manage-claude/workspaces [6]
  7. Claude Help Center, Create and manage Workspaces. https://support.claude.com/en/articles/9796807-create-and-manage-workspaces-in-the-claude-console [7]
  8. Anthropic, Rate limits (spend limits). https://platform.claude.com/docs/en/api/rate-limits [8]
  9. Anthropic, Admin API. https://platform.claude.com/docs/en/manage-claude/admin-api [9]
  10. Anthropic, Authentication (disable vs. delete). https://platform.claude.com/docs/en/manage-claude/authentication [10]