CostHex

OpenAI API usage limits: set a spend cap

OpenAI API projects and organizations support monthly hard spend limits. Enable enforcement to reject requests at the limit; alerts alone let traffic continue. Enforcement has a delay, so leave room for a small overshoot.

This guide covers API spending. ChatGPT message allowances have separate controls.

Set the monthly spend limit

You need permission to manage the relevant settings. Follow OpenAI's spend-limit guide:

  1. For the whole organization, open Organization limits. For one project, select it in Project settings and open Limits.
  2. Under Spend, choose Edit spend limit and enter Monthly spend limit.
  3. Enable Enforce a hard limit, then save.

An organization cap covers all its projects. A project cap covers traffic billed to that project. Both can apply. Add spend alerts below the cap so someone can investigate before requests fail.

Choose the control for your app

OpenAI API controls
ControlPurposeEffect
Spend alertNotify someone about monthly costsTraffic continues
Hard spend limitEnforce your monthly capAffected requests fail with HTTP 429
Rate limitBound request or token throughputExcess requests receive rate-limit errors

Rate limits vary by model and apply at organization and project level. Requests per minute and tokens per minute are separate constraints. A throughput limit does not define a monthly dollar budget.

OpenAI also assigns an approved monthly usage ceiling based on your usage tier. That ceiling is separate from the spend cap you set.

Identify a billing-related 429

Inspect error.code. OpenAI's error reference distinguishes these cases:

  • project_spend_limit_exceeded: review that project's cap.
  • organization_spend_limit_exceeded: review the organization-wide cap.
  • organization_usage_limit_exceeded: request a higher approved usage limit.
  • credit_balance_exhausted: replenish prepaid credits.

For a reached spend cap, raise or remove it only if you accept more spending; otherwise wait for the monthly reset. Changes take time to propagate. Repeated retries cannot replenish credits or raise a cap.

For a request or token rate-limit error, reduce throughput and use bounded retries with backoff as described in the rate-limit guide.

Before enabling enforcement on a production app, decide what users should see when API calls stop. Assign someone to review alerts and authorize any increase.

For other platforms, see Google Cloud budget controls and Vercel spend limits.

Official sources