Set spend limits Early availability
Set spend limits to control AI gateway costs. You can set a cap at the organization level and override it for specific keys and users.
If the limit is reached, all API calls are blocked until the limit resets at the end of the reset period. Requests that were already accepted before the limit was reached finish and are charged. Setting a limit to $0 USD refuses every request.
Multi-level budgets
You can set spend limits at different levels:
- Organization spend limit: This caps the total spend of all keys in the organization.
- Project spend limit: This caps the total spend of all keys in a project.
- Default spend limit per API key: This caps the spend of each API key that doesn't have a custom limit set.
- Default spend limit per user: This caps the spend of each user for all the keys they own, if the user doesn't have a custom limit set.
Custom limits can be set for individual keys and users. Keys and users that don't have a custom limit inherit their spend limit from the organization and project-level settings.
Set an organization spend limit
role:organization:admin- In your organization click Admin.
- Click AI gateway.
- Click Configure.
- Enter the Spend limit for the organization, API keys, or users.
- Select the Reset period.
- Click Save changes.
Set a project spend limit
role:organization:admin- In your organization click Admin.
- Click AI gateway.
- Find the project and click Actions > Change spend limit.
- Enter the Spend limit.
- In the Daily spend limit and Monthly spend limit, select the organization default or custom. Organization admin can also select Unlimited. This allows the project spend to exceed the organization-level spend limit.
- Click Save changes.
Set the spend limit for an API key
project:ai_gateway_keys:write or role:organization:adminYou can override the organization spend limit by setting the spend limit
for a specific key. Only users with the role:organization:admin role can set
a spend limit that exceeds the organization-level setting.
- In your organization click Admin.
- Click AI gateway.
- Find the key and click Actions > Change spend limit.
- Enter the Spend limit.
- In the Daily spend limit and Monthly spend limit, select the organization default or custom. Organization admin can also select Unlimited. This allows the key spend to exceed the organization-level spend limit.
- Click Save changes.