Keys and usage
Create, limit and revoke API keys, and see how much each key used each model.
An application calls your published models with an API key. Each key may call all your published models or only some, and has its own rate limits. The Usage panel shows what each key used, and what Playground prompts to published models used.
Both are on API keys, under Use in the sidebar, with the address apps call and a quickstart. It opens even without a project.
A request to a decision model counts as one request for each decision or text it holds: a batch of 32 decisions is 32 requests toward the plan and the key's limits.
At the top, API requests this month shows how many requests your organization's published models answered this month, with its requests a minute. Every organization's requests a month are unlimited. A plan Tensorant set up for your organization may limit them: then it shows a bar and figures such as "812 of 1K/month · resets Nov 1", warns from 90%, such as "92% used. At the limit apps get an error until Nov 1.", and, when it limits tokens, shows API tokens this month beside it too.
Before you start
- Only owners create, revoke and delete keys. Everyone in the organization sees the key list (never the keys themselves) and the usage. See Roles.
Create a key
Create one key per application, so you can revoke each alone.
- On API keys, choose Create key at the top. "API keys: N of M" shows your organization's limit of 1,000; once it is reached, Create key is unavailable.
- Enter a Name that says which application uses it.
- Under May call, keep All API models of this organization, or choose Only the models I choose and tick at least one model.
- Set Requests/minute and Requests at once, or keep what they start at: your organization's requests a minute (60 if its plan sets none), and 4 at once (fewer if its plan allows fewer).
- Optional: set Expires on.
- Choose Create key.
- In Copy your key, choose Copy key, store the key with your application's secrets, then choose I copied it.
The key starts with ti_ and is shown only this once. Tensorant does not keep it, so a lost key cannot be shown again: revoke it and create another.
Key settings
| Setting | Default | What it does |
|---|---|---|
| Name | None | Up to 80 characters. Labels the key in the list and in usage. |
| May call | All API models | The models the key may call. |
| Requests/minute | Your organization's requests a minute, or 60 | 1 to 6,000, and at most your organization's. The most requests the key sends in any 60 seconds. |
| Requests at once | 4, or your organization's if fewer | 1 to 256, and at most your organization's. The most requests of the key in progress at the same time. |
| Expires on | Never | The key stops working at the end of that day (UTC). |
You cannot change a key after you create it. To change its models or limits, create a new key, move your application to it, then revoke the old one.
The models a key may call
- All API models of this organization includes models you publish later.
- Only the models I choose limits the key to the ticked models. Any other model gets
404 model_not_found, the same answer as for a model that does not exist.GET /v1/modelslists only the models the key may call. You can choose it once the organization has a published model.
A limited key is tied to the models themselves, not their names. If you delete a model and publish a new one with the same name, the key does not reach the new one. The key list shows the deleted model as "1 deleted".
Limits per key
- Requests/minute counts the key's requests in any 60 seconds,
GET /v1/modelsincluded. Beyond it, the API answers429 rate_limit_exceededwith aRetry-Afterheader. - Requests at once counts requests in progress. A stream counts until it ends. Beyond it, the API answers
429 rate_limit_exceededwithRetry-After: 1.
Your organization also has its requests a minute and requests at once, shared by all its keys, whatever its keys allow. Past either, the API answers 429 rate_limit_exceeded with a Retry-After header. The API may also ask you to retry when it's busy. See Chat completions for every API limit.
A request refused by a requests-a-minute limit, the key's or the organization's, doesn't count toward it. Every other request with a valid key counts toward the requests a minute, even if it is refused afterwards, for example past the requests at once or with a 400, 403, 404 or 503. For what counts toward the month, see Usage.
The key list
| Column | What it shows |
|---|---|
| Name | The key's name |
| Status | Active, Expired or Revoked |
| Key | Its first characters, such as ti_AbCdEfGh… |
| May call | "All models", or the model names |
| Limits | For example "60/minute · 4 at once" |
| Last used | When it last called the API, or "Never" |
| Expires | When it stops working, or "Never" |
Revoke a key
- Open the ... menu on the key's row and choose Revoke.
- Choose Revoke key to confirm.
The key is refused from the next request, with 401 invalid_api_key. Revoking cannot be undone. The key stays in the list as Revoked.
To remove a revoked key from the list, choose Delete in its ... menu, then Delete key. Its usage stays, shown as "A deleted key".
Usage
The Usage panel shows This month (UTC) or the Last 30 days:
- Totals for Requests, Errors, Tokens and Average time. Tokens adds prompt and answer tokens; its note splits them, such as "1.2k in · 300 out". When a plan limits tokens, the note adds the tokens still reserved, such as "· 4.1k reserved".
- A chart of requests per day, answered and errors.
- A table by key and model (Key, Model, Requests, Errors, Tokens, Average time), busiest first. A deleted key's usage shows as "A deleted key". Prompts to a published model in the Playground show as Playground, "Prompts in the console": they count toward the month like an application's requests.
Usage counts only requests that reach the model, as the monthly limits do (see Plan limits). A request refused before that isn't counted, such as one with an invalid key or field, past a limit, for an unknown or stopped model, or with images on a plan without them. A counted request that doesn't end with a complete answer is an error: for example still 503 model_starting after waiting for a cold start, 400 model_refused, a 502, or a stream that ended without data: [DONE]. Streamed answers count their tokens like whole ones.
A request in progress counts as an error, with its full token reservation, until it ends. When a plan limits tokens, the panel says so: "Each request reserves its model's full context against the monthly token limit until its answer is counted."
Only these counts are kept. Prompts and answers are never stored.
Plan limits
Every organization has these limits on the API:
- API keys: 1,000 that are not revoked, expired ones included.
- API requests a minute: 2,000 in any 60 seconds, across all keys. See Limits per key for what counts. Past it, the API answers
429 rate_limit_exceeded. - API requests at once: 64 being answered at the same time, across all keys; a stream counts until it ends. Past it, the API answers
429 rate_limit_exceededwithRetry-After: 1.
API requests and tokens a month are unlimited. A plan Tensorant set up for your organization can limit them:
- API requests this month: counted requests, errors included. See Usage.
- API tokens this month: prompt and answer tokens together, and tokens still reserved.
Months are calendar months (UTC), and such caps are strict. Just before calling a model, the API reserves one request and the model's full context window in tokens (its Context length (tokens) when published), which covers prompt, images and answer. If that reservation doesn't fit what is left of the month, the request is refused with 429 quota_exceeded, even when a shorter answer would have fit.
When a complete answer reports its token counts, the unused part of the reservation is given back. Errors, interrupted requests and answers without token counts keep the full reservation, shown in usage as "reserved". Room frees up as requests in progress end with a complete answer, when Tensorant raises the limit, or when a new month begins.
When an organization with such a limit has used 80% of its API requests for the month, its owners get a warning email, "organization used 80% of its API requests a month". When it uses them up, they get "organization reached its API requests a month".
Limits
| Limit | Value |
|---|---|
| Keys per organization | 1,000 that are not revoked. Expired keys count until revoked. |
| Name | 80 characters |
| Requests/minute | 1 to 6,000, at most your organization's |
| Requests at once | 1 to 256, at most your organization's |
| Models a key may be limited to | 50 |
| Requests at once per organization | 64, across all keys |
| Requests a minute per organization | 2,000, across all keys |
| Usage shown | This month, or the last 30 days |
When something goes wrong
| Problem | What to do |
|---|---|
| Create key is greyed out | Point at it to see why: "Only owners create keys.", or your organization's limit of keys is reached. Ask an owner, or revoke a key you no longer use. |
| "Your plan (Plan) allows N …" or "An organization can have 1,000 keys. Revoke one first." | Revoke a key you no longer use; expired keys count until revoked. |
| "Choose an expiry in the future" | The day under Expires on has already ended in UTC. Choose a later day, or leave it empty. |
| "Choose published models of this organization" | A model you ticked was deleted meanwhile. Close the dialog and try again. |
401 invalid_api_key |
The key is mistyped, revoked or expired. Check it, or create a new one. |
404 model_not_found |
The model does not exist, or the key may not call it. Check May call and GET /v1/models. |
429 rate_limit_exceeded |
Wait the Retry-After seconds, or create a key with higher limits. If the message says the organization sent too many requests this minute, spread requests out. |
429 quota_exceeded |
A plan Tensorant set up for your organization limits requests or tokens a month, and they are used up. Wait until next month (UTC), or write to [email protected]. See Plan limits. |
| Errors or "reserved" tokens while nothing failed | Requests in progress count as errors, with their full reservation, until they end: look again later. An answer without token counts keeps its reservation. |
Need a hand? Visit troubleshooting