Spending Caps
Overview
Spending caps let you set a maximum monthly budget for your account. When your usage reaches the limit, the API returns 429 RESOURCE_EXHAUSTED until the next month or until you raise the limit.
This prevents unexpected costs when integrating Langbly into automated workflows.
API endpoints
Get current spending limit
GET /v2/account/spending-limit
Response (limit set):
{
"spendingLimit": {
"limitCents": 2000,
"limitDollars": 20
}
}
Response (no limit):
{
"spendingLimit": null
}
Set spending limit
PUT /v2/account/spending-limit
Set a limit in dollars:
{
"limitDollars": 20
}
Or in cents for precise control:
{
"limitCents": 2000
}
Remove spending limit
PUT /v2/account/spending-limit
{
"limitCents": null
}
Behavior
- When monthly usage reaches the spending limit, all translate requests return 429 with a
Retry-Afterheader indicating seconds until the month resets - Spending is calculated based on your current month's character usage at your plan's rate
- The limit resets on the first day of each month (UTC)
- Spending caps only apply to paid accounts. Free tier accounts already have a fixed monthly limit.
Best practices
- Set a cap slightly above your expected usage to avoid accidental disruptions
- Monitor the
Retry-Afterheader to handle rate limiting gracefully in your application - Use per-key usage tracking (available in your dashboard) to identify which integrations drive the most usage