Cap what an API token can run
Give a token a ceiling on cost, requests or parallel turns, so a broken script cannot spend a day's budget in an hour.
Set a limit
- Open Account → API tokens.
- Choose Limits in the token's row. The Limits dialog opens.
- Set the limits you want and choose Save. Every limit also has an Unlimited switch, which turns it off.
The token's own row shows its last use, its expiry, its prefix, and the Copy, Limits and Delete buttons. Open the row to see its turns, answered turns, failed turns and cost per day for a period you pick beside the chart; that period then applies to every token. Days are counted in UTC.
What each limit stops
| Limit | What happens when it is reached |
|---|---|
| Cost per day | Further runs are refused until the next UTC day. |
| Cost per month | Further runs are refused until the next UTC calendar month. |
| Requests per minute | Every request made with this token is refused until the minute is over. |
| Concurrent turns | A new run is refused while this many runs are still going. |
A refused run costs nothing and counts no turns against the token. The answer names the reason and how long to wait, so a script can sleep and retry: see Agent API errors.
When the cost is unknown
A turn can use tokens that nothing prices: the provider reported no charge, and Chetty has no list price for the model, neither a catalog row nor a price set for that model. That day's cost is then unknown, not zero.
The token shows Cost unknown. A token with a daily cost limit is refused for the rest of that UTC day, and one with a monthly cost limit for the rest of that UTC month. Chetty never treats unknown as zero, because a limit it cannot check is not a limit.
A cost limit counts what turns have already used. Runs that are still going when a new one starts can therefore take the day, or the month, slightly past the limit.
If Chetty restarts during a run
A run interrupted by a restart is counted as failed, and its spend can no longer be attributed to the token. The day it started and the day of the restart then count as cost unknown.
A token with a daily cost limit is refused for the rest of those UTC days. A token with a monthly cost limit is refused for the rest of the months those days fall in.
Related guides
See Create and manage a personal API token for creating, copying and deleting tokens, and Usage and cost figures for what the whole instance spends.