Skip to content

AI Gateway Billing and Keys

Varity TeamCore Contributors

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.

  • 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.

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.

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, private or anonymized. An anonymized key requires the account itself to allow anonymized processing first.
  • A key can carry its own requests_per_minute and concurrency_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_KEY

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.

RouteWhat it does
POST /v1/keysCreates 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/keysLists the account’s inference keys. No plaintext is ever returned.
GET /v1/keys/auditKey lifecycle events. Accepts limit from 1 to 500.
POST /v1/keys/{id}/revokeRevokes one of the account’s own keys.
GET /v1/billing/balanceThe balance: availableBalanceUsd, reservedUsd, spendThisMonthUsd, monthlySpendingLimitUsd, autoReload, and more.
GET /v1/billing/transactionsBalance transactions. Accepts limit from 1 to 100 (default 50) and offset from 0 to 10,000.
PATCH /v1/billing/settingsSets monthlySpendingLimitCents (null, or 100 to 10,000,000) and autoReload { enabled, thresholdCents, amountCents }.
POST /v1/billing/top-upStarts 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/policySets the account privacy floor. See Privacy Routing.

The request budgets for these routes are on Rate Limits.

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.

  • Endpoints: a minimal request for every inference route
  • Rate Limits: request budgets and the 429 bodies
  • Models: per-model pricing fields