Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

OpenAI API Spend Limits: How to Set Them

· 4 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can set spend limits on your OpenAI API account to control costs. The main way is through the Usage limits page in your OpenAI account settings, where you can set a monthly spending cap and a hard limit. You can also set a per-request limit if you use the API directly. This guide walks through both methods, plus what to do if you hit a limit unexpectedly.

What You'll Need

  • An OpenAI account with API access (you must have added a payment method).
  • Access to the account owner or an admin role (only admins can change usage limits).
  • Your API key if you plan to set per-request limits in code.

Step-by-Step

Set a Monthly Spend Limit (Dashboard)

  1. Log in to platform.openai.com with your OpenAI account.
  2. Click your profile icon (top right) and select Settings.
  3. In the left sidebar, click Usage limits. (Labels may vary slightly by version/region.)
  4. Under Monthly spend limit, click Set a limit.
  5. Enter the maximum dollar amount you want to allow per month. This is a soft limit—you'll get email warnings as you approach it, but requests won't stop automatically.
  6. Click Save.

Set a Hard Limit (Dashboard)

  1. On the same Usage limits page, find the Hard limit section.
  2. Click Set a hard limit.
  3. Enter the maximum amount you're willing to spend in a single month. Once this is reached, all API requests will be blocked until the next billing cycle or until you raise the limit.
  4. Confirm the amount and save.

Set a Per-Request Limit (API Code)

If you call the API directly (not through a wrapper), you can add a max_tokens parameter to each request to cap the length of the response, which indirectly controls cost. For example, in Python:

response = openai.ChatCompletion.create(
  model="gpt-4",
  messages=[{"role":"user","content":"Hello"}],
  max_tokens=100
)

This limits the response to 100 tokens (roughly 75 words). It does not cap the total cost of the request (input tokens still count), but it prevents runaway long responses.

Set Alerts (Optional)

  1. In the Usage limits page, scroll to Email alerts.
  2. Click Add email alert.
  3. Enter a threshold amount (e.g., $50) and an email address.
  4. Save. You'll get an email when your usage crosses that threshold.

Common Mistakes

  • Setting only a soft limit – Many users think the monthly limit stops requests; it doesn't. You must set a hard limit to actually block requests.
  • Forgetting to save – Changes don't apply until you click Save.
  • Using the wrong account – Limits are per-account, not per-API-key. If you have multiple projects, they all share the same limit unless you use separate accounts.
  • Ignoring the per-request limit – If you have a long-running script, a single request can still cost a lot; always set max_tokens.

Tips

  • Start with a low hard limit (e.g., $10) and raise it as you understand your usage.
  • Use the Usage dashboard (under Usage in the sidebar) to see daily breakdowns and which models cost the most.
  • If you're building an app for others, consider using the API keys page to create separate keys for each user, but note that limits are still account-wide.
  • Set email alerts at 50%, 75%, and 90% of your budget to stay ahead.

Troubleshooting

I set a hard limit, but requests still go through. Check that you saved the limit and that it's active. Also, there may be a short delay (up to a few minutes) before the limit takes effect. If you're using a third-party service that proxies the API, that service may have its own limits—check with them.

I can't find the Usage limits page. Make sure you're logged into the platform (not just the ChatGPT chat interface). If you don't see it, your account may not have admin permissions—ask the account owner.

My hard limit was reached, but I need to continue. You can raise the limit or wait until the next billing cycle. Note that the hard limit resets on the first of each month (based on your billing cycle).

I got an email about exceeding my soft limit, but I didn't set one. OpenAI may send default warnings when usage is unusually high. Check the Usage limits page to see if a default limit is set.

Frequently Asked Questions

Can I set a daily limit instead of monthly?

No, OpenAI only offers monthly spend limits. For finer control, you'd need to track usage yourself or use a third-party gateway.

Do limits apply to all API keys on my account?

Yes, the monthly and hard limits are account-wide, not per key.

What happens when I hit the hard limit?

All API requests fail with a 429 error (rate limit exceeded) until the limit is raised or the next billing cycle starts.

Can I set a limit in tokens instead of dollars?

No, limits are in dollar amounts only. You can estimate token costs using the pricing page.

Will I be charged if I hit the limit?

You'll be charged for the usage up to the limit, but not beyond it (assuming the hard limit is set correctly).

Can I set a limit on the ChatGPT Plus subscription?

No, usage limits apply only to API usage, not the ChatGPT Plus consumer plan.