Suanlimao
← Back to all tutorials

API keys

Budgets, rate limits and allowlists

Cap what each key can spend so a leak or a runaway script cannot drain your balance.

About 8 minFor:Anyone who wants to control spend and scope

Before you start

  • At least one key exists

Step 1 · STEP 0x01

Set budgets

Edit key
1

5 hours

Empty = unlimited
2

1 day

Empty = unlimited
3

7 days

Empty = unlimited
4

Monthly / total

Empty = unlimited
5
Save
Diagram — the wording matches the real page, the layout may differ slightly

Budgets are in USD and can be combined; once any one is used up requests are refused. The 5-hour, 1-day and 7-day budgets are rolling windows and recover as spend slides out of the window.

When a budget is used up requests return 429 key_budget_exceeded, and the message says which window and when it recovers.

Step 2 · STEP 0x02

Restrict models and source IPs

Edit key
1

Model allowlist (comma-separated, empty = any)

Model names copied from the plaza
2

IP allowlist (comma-separated, CIDR supported, empty = any)

Your server's outgoing IP
3

Expiry date

Never
4
Save
Diagram — the wording matches the real page, the layout may differ slightly
  • Model allowlist: the key can only call the listed models — good for a script that needs just one.
  • IP allowlist: only requests from these addresses work — good for servers with a fixed outgoing IP, not for laptops whose IP changes.
  • Expiry date: for a key you lend out temporarily, so you don't have to remember to revoke it.

Step 3 · STEP 0x03

Understand rate limits

LimitWhat it means
RPM / TPM / concurrencyRequests per minute, tokens per minute and concurrent requests. Accounts move up tiers with total top-ups and never move down.
Per-key limitA key can be stricter than the account tier, never looser.
Account daily capAn account-level daily spend guard; the page shows the current cap while an account is restricted.
response headers
HTTP/1.1 429 Too Many Requestsretry-after: 3x-ratelimit-limit-requests: …x-ratelimit-remaining-requests: 0

On 429 retry with exponential backoff (1s, 2s, 4s…); for higher limits open a ticket and explain the use case.

✓ How to tell it worked

  • After saving, the Usage column shows month-to-date against the cap, and requests beyond it get 429.

FAQ

If I set budgets, can the balance still run out?

A budget caps one key only. With several keys, each is limited by its own budget.

How soon do changes apply?

New requests use the new settings right away; in-flight requests are unaffected.

Related tutorials

Still stuck?

Read the troubleshooting tutorials first. If that does not help, open a ticket with the request_id, time, model and the exact error (never paste your key).