Spend limits help you control API costs by setting monthly budgets for your organization or for individual projects. You can use them as a soft budget for monitoring spend, or enforce a hard limit so API responses fail after spend reaches the limit.
How spend limits work
Spend limits are monthly limits measured in U.S. dollars. They can apply at two levels:
- Organization spend limits apply across the organization.
- Project spend limits apply to a single project.
You can also enforce either level as a hard limit, which makes API responses fail after spend reaches the monthly limit.
Using hard limits
A hard limit causes API responses to fail after the organization or project reaches its monthly spend limit. After spend reaches a hard limit, API responses return a 429 error until you increase the spend limit or the limit resets.
Use hard limits when you need to prevent unexpected spend, such as for experiments, development projects, or customer-specific projects with fixed budgets.
Configuring spend limits
- Go to Organization limits.
- In Spend, select Edit spend limit.
- Enter the Monthly spend limit.
- To make API responses fail after the organization reaches the limit, turn on Enforce a hard limit.
- Select Save.
- Go to Project settings.
- Select Limits.
- In Spend, select Edit spend limit.
- Enter the Monthly spend limit.
- To make API responses fail after the project reaches the limit, turn on Enforce a hard limit.
- Select Save.
Spend alerts
Use spend alerts to get notified before spend reaches the monthly limit. Add alerts at thresholds that give your team enough time to adjust usage, increase the limit, or investigate unexpected traffic.
For broader usage analysis, review the usage dashboard. For request-rate constraints, see the rate limits guide.