Skip to content

API keys and limits ​

Every call to /v1 except the two public lists needs an API key. A key belongs to a project, says what it may be used for, and can carry its own limits.

Projects ​

Projects group keys, for example one per application or environment. Model usage and receipts show which key spent what.

Open "Model API" in the console's sidebar and click "Manage API keys". Under "Projects", type a name and click "New project". A key needs a project, so create one first.

Create a key ​

Under "New key":

FieldWhat it does
"Project"The project the key belongs to.
"Label"A name you'll recognise in the key list. Optional, up to 80 characters.
"Use for""Model API", "Sandboxes", "VMs", or any mix. At least one.
"Spend limit (USD, optional)"The most this key may spend. Empty means no key limit.
"Limit period""Total" for the key's whole life, or "Monthly" for each UTC calendar month.
"Requests per minute (optional)"The most requests a minute this key may send.

Click "Create". The key appears once, with a "Copy" button. Copy it now. Yi Cloud keeps only a hash of it and can't show it again. Lists show only its start, pwc_live_….

What a key may be used for ​

"Use for"Endpoints
"Model API"/v1/models, /v1/chat/completions, /v1/responses, /v1/embeddings, /v1/messages
"Sandboxes"/v1/sandboxes and everything under it
"VMs"/v1/vms and everything under it

GET /v1/catalog and GET /v1/compute/classes need no key.

A key used outside what it allows gets 403 forbidden with "This API key may not be used here".

A key with "Sandboxes" or "VMs" can see and act on every sandbox or VM in your workspace, including those created with other keys or in the console.

Spend limit ​

A key's spend limit counts everything charged through it:

  • its model calls,
  • sandboxes it created,
  • leases and renewals of VMs it created or renewed,
  • the stopped-VM rate of VMs it created.

Before a call or resource starts, Yi Cloud checks that the key's spending so far, plus what it already holds, plus the new hold, fits in the limit. If it doesn't, the request gets 402 key_limit_reached. The "Spent / limit" column shows where each key stands for the current period.

A stopped VM whose hourly charge no longer fits the limit of the key that created it is deleted. See VMs.

Requests per minute ​

The limit counts every request the key sends to /v1, over a sliding 60-second window. A request over the limit gets 429 rate_limited with a Retry-After header in seconds.

Limits above the key ​

Every key spends from the same workspace balance. A key limit higher than the balance doesn't help. There is no monthly cap above the key. See Billing and receipts.

Revoke a key ​

Click "Revoke" next to the key. From then on it gets 401 invalid_key with "This API key was revoked". Sandboxes and VMs it created keep running until they end or you delete them.

Keep keys safe ​

  • Store keys in environment variables or a secret manager. Never put them in browser code, mobile apps or repositories.
  • Use one key per application and give it only the uses it needs.
  • Set a spend limit on keys that run unattended.
  • The "Last used" column shows when a key was last used, to the minute. Revoke keys nobody uses.
  • If a key may have leaked, revoke it and create a new one.