Use Cases
- Environment separation — dedicated keys for development, staging, and production
- Team access — separate keys for different team members or projects
- Budget control — set credit limits per key to cap spending
- Security — rotate or revoke individual keys without affecting other integrations
- Usage tracking — monitor consumption per key
Token Types
Sandbox tokens return simulated responses and do not incur any cost. They are ideal for development and CI pipelines.
API Endpoints
Create a Token
Create a Token with Budget
Set a spending limit by enablingactive_balance:
active_balance is true, every API call deducts from the token’s balance. Once it reaches $0, the token stops working.
Periodic Budget Reset
A budget can either reinitialize automatically each day, week, or month, or be a one-time allowance that stays at $0 once spent until you top it up manually. You control this withbalance_reset_period (the reset frequency) and balance_reset_amount (the amount the balance is restored to at the start of each period).
In the dashboard
On the API Keys page, create or edit a key and turn on Spending Limit. Set the Reset allowance (the amount restored each period) and choose a Resets frequency — Daily, Weekly, Monthly, or Never. A reset frequency is always selected when a spending limit is on; it defaults to Monthly. Choose Never for a one-time budget that does not renew. A separate Current balance field shows what’s available right now; editing the allowance only takes effect at the next reset.Through the API
Behaviour to know:
- Setting a reset period automatically enforces the budget (
active_balancebecomestrue) — you don’t have to set it separately. balance_reset_amountis the reset target, kept separate from the livebalance(the amount remaining right now). They are not the same field.- A new periodic token starts the period full: if you don’t pass a starting
balance, it begins atbalance_reset_amount. Passing an explicitbalancelets a key start partway through a period. - Resets run at midnight Europe/Paris time: daily every night, weekly on Monday, monthly on the 1st.
- Setting the period back to
noneclearsbalance_reset_amountand returns the token to a one-time budget.
This per-token reset is distinct from the per-member budget cap you can set on a guardrail. A token budget is a hard cap on one key (it stops at $0); a member budget is a soft periodic spend cap that follows a person across all their keys.
List All Tokens
Best Practices
- Set budgets on non-production tokens to prevent accidental overspending during development.
- Use a periodic reset (
balance_reset_period) for recurring allowances — e.g. a $10/day CI key — instead of topping up manually. - Use sandbox tokens for CI/CD to validate integrations without incurring costs.
- Rotate tokens periodically — create a new token, migrate your application, then delete the old one.
- Set expiration dates on temporary tokens (e.g., for contractors or short-term projects).