Track usage and set limits
See what a project’s calls use, set a monthly limit of your own, and handle calls that go over a limit.
See usage
Open the project, then AI. Usage shows AI units, requests, and tokens for the last 24 hours, 7 days, or 30 days, next to the period before, and which models and which API keys or people used them.
Set a monthly limit of your own
Your plan sets the most a project can use in a month. A limit of your own, below it, stops calls sooner, so a mistake or a leaked key can never use more than you meant.
In the console, open the project, then AI, then Limits. Under Your limit, enter the AI units the project may use each month, then select Save. Select Use the plan’s limit to remove it. 0 stops AI for the project.
Only people with Developer access or more can change it. API keys can read it, with View usage and limits, but never change it.
How a call is checked
Before a call runs, the most it could use is set aside from the month’s units: its input, and max_tokens of output. When it finishes, only what it really used counts, and the rest is given back. So a call can be refused while the project still has units left, if its max_tokens would not fit. Lower max_tokens to ask for less.
Calls in progress count toward the limit too, so many calls at once can never go over it together.
Handle a refused call
| Code | Status | What to do |
|---|---|---|
unit_limit_reached | 403 | The project has used its units for the month, or this call could go over them. Wait for next month, raise your own limit, or move the project to a plan with more. Sending it again gets the same answer. |
rate_limited | 429 | The project sent more requests or tokens this minute than its plan allows. Wait for the seconds in Retry-After, then send it again. |
tokens_over_limit | 403 | One call asks for more tokens than the plan allows in a whole minute, so it can never run. Send less, or lower max_tokens. |
The months start on the 1st, in UTC. See Limits for your plan’s numbers.
Last updated