AI Gateway Billing and Keys
The AI Gateway charges your prepaid balance in USD, the same balance Varity Cloud uses. It is funded by your plan, by top-ups, or by the Free plan; see Billing and Pricing. An inference key is what your code sends to spend it.
How You Are Charged
Section titled “How You Are Charged”- Free plan usage covers only Chat, Build, and static apps, up to $0.50 of AI usage per day on the cheapest suitable model. Any subscription or top-up removes the daily limit.
- API key requests need a paid balance from a subscription or top-up.
- You cannot bring your own provider key.
Inference key requests are charged per model at the rate in customer_pricing
on GET /v1/models, which also says how that
rate is set. The same rates are on the Models tab of the
portal’s AI Gateway page. This page lists no prices, because the catalog changes
without a docs release.
When a request cannot be paid for, it is refused with a 402 before any model
is called. The codes and what each one means are listed once, in
API Errors.
Adding Funds
Section titled “Adding Funds”Subscribe to a plan or buy a top-up on the billing page of the Developer Portal; see Top-Ups. Optional auto top-up refills your balance when it falls below a threshold you set, adding no more in a month than the limit you choose.
Inference Keys
Section titled “Inference Keys”Create, list, and revoke keys on the Inference keys tab.
- The key plaintext is shown once, when the key is created. Store it then; it is never returned again.
- Each key is identified by an id of the form
vki_…. - A key can be limited to a list of up to 64 model ids. An empty list allows every model, including models added later.
- A key has a privacy floor,
privateoranonymized. Ananonymizedkey requires the account itself to allow anonymized processing first. - A key can carry its own
requests_per_minuteandconcurrency_limit(the smaller of the key’s and the account’s bound applies), a spending budget, and an expiry. - A revoked key stops working within 60 seconds.
Send the key as a bearer credential on every inference request:
Authorization: Bearer $VARITY_API_KEYAccount Routes
Section titled “Account Routes”The portal tabs are built on these routes on https://ai.varity.app. They take
a Developer Portal session as the bearer credential. An inference key is
refused on them with 403 portal_session_required, so a leaked inference key
cannot mint more keys, move money, or change privacy settings. They are not in
GET /v1/openapi.json; this table is their public reference, and the only
place AI Gateway keys are issued is POST /v1/keys on this host.
| Route | What it does |
|---|---|
POST /v1/keys | Creates an inference key. Body: name (1 to 80 characters), allowed_models (array, may be empty), privacy_floor, and optionally requests_per_minute, concurrency_limit, upstream_budget_usd, expires_at (Unix seconds), project_id, application_id, environment. |
GET /v1/keys | Lists the account’s inference keys. No plaintext is ever returned. |
GET /v1/keys/audit | Key lifecycle events. Accepts limit from 1 to 500. |
POST /v1/keys/{id}/revoke | Revokes one of the account’s own keys. |
GET /v1/billing/balance | The balance: availableBalanceUsd, reservedUsd, spendThisMonthUsd, monthlySpendingLimitUsd, autoReload, and more. |
GET /v1/billing/transactions | Balance transactions. Accepts limit from 1 to 100 (default 50) and offset from 0 to 10,000. |
PATCH /v1/billing/settings | Sets monthlySpendingLimitCents (null, or 100 to 10,000,000) and autoReload { enabled, thresholdCents, amountCents }. |
POST /v1/billing/top-up | Starts a card checkout. Body: email (must belong to your account) and balanceCents (within the top-up bounds; see Top-Ups). Returns the checkout url plus balanceCents, serviceFeeCents, and totalCents. |
PUT /v1/inference/policy | Sets the account privacy floor. See Privacy Routing. |
The request budgets for these routes are on Rate Limits.
Usage And Request History
Section titled “Usage And Request History”Your own code can read what it has spent with an inference key, through the
/v1/inference/* routes listed on
Endpoints.
They report spend for inference key requests only. Chat and Build have no
per-action price.
Request records hold metadata only, never prompt or response content, and are kept for 30 days. See Privacy And Data Retention.
Next Steps
Section titled “Next Steps”- Endpoints: a minimal request for every inference route
- Rate Limits: request budgets and the
429bodies - Models: per-model pricing fields