Skip to main content

Token as a Service

Version
since 2.x, describes 2.52.14
Feature flag
token_service
For
Workspace user, Platform operator

A workspace buys inference as a service: an operator publishes service tiers and offerings with an effective-dated per-MTok price book, a workspace member mints a service key against a published tier, and requests through the OpenAI-compatible Token Service endpoint are metered per token and drawn down against the workspace balance. Where Inference endpoints serves a model a workspace runs itself, Token as a Service meters an operator-published offering; both are switched on per deployment with a feature flag.

What it does​

  • Tiers. An operator manages service tiers: rate limits (requests per minute, tokens per minute, concurrency) and an availability target, over the staff management API. A tier can be retired and reactivated: the customer tier catalog lists active tiers only, minting a key on a retired tier is refused, and keys already minted on it keep serving. The operator economics behind a tier are never on the customer wire.
  • Offerings and prices. Offerings reference a model and carry status transitions; an offering cannot be activated without an effective price entry. The price book is effective-dated, per-MTok input and output, with full history kept and listed newest first.
  • Keys. A workspace member mints a service key against a published tier, lists keys and revokes them. The key material is shown exactly once at mint; the platform keeps only a hash. The key dialog picks a tier from the published catalog (free-typed handles survive only when the catalog is empty or fails to load). Revocation is the key lifecycle: keys are never deleted, so the billing evidence of a revoked key survives.
  • Prepaid packages. An operator defines package products on an offering: input and output token volumes, a price at cent precision and an optional validity in days, moving through draft, active and retired. A workspace buys packages from the Packages page; the purchase needs the workspace permission that purchases instances and charges the workspace balance while billing is on (a short balance is refused; while billing is off it is recorded without charge). Operators can grant a package to a workspace, free of charge or charged. A covered request draws from the held package first, soonest expiry first, on both token legs; only the remainder is metered and billable. Packages expire on schedule and whatever they still hold is forfeited; purchases are not refunded.
  • Metering. Every request is metered with exact token counts, priced per-MTok from the effective price entry, and drawn down against the workspace balance idempotently: a replayed record reference never posts twice. Requests cheaper than a cent are aggregated before posting. Each offering has a circuit breaker with a configurable failure threshold and cooldown; every breaker trip raises an alert. While billing is switched off, metering continues and nothing posts.
  • Budgets. A daily token budget can be set on a key and on the workspace and organization quota frames; a request beyond the level that binds is rejected with 429 quota_exceeded_tokens. The workspace sees its budget and which level binds.
  • Usage. The priced ledger is aggregated per key, offering and UTC day; reports come as JSON and CSV, with Covered and Billable columns on every row. The workspace sees a usage dashboard with per-key budget visibility.
  • Service levels. Every key's previous UTC month is evaluated against its tier's availability target. An operator-configured credit schedule turns a missed month into an automatic service credit: a percent of the key's billed total, of the lowest bracket the measured availability fell below, rounded to cents and never posted twice. A credit is posted to the workspace balance as a service credit while billing is on; written while billing is off, it is record-only. Months that ended before the schedule was set earn nothing. An operator can also run an ended month's evaluation on demand, with a recorded reason; a credited evaluation stays frozen.
  • Reconciliation and health. The platform reconciles the priced ledger against the gateway's tallies nightly, comparing only billable, uncovered amounts, and an operator can trigger the same comparison on demand with a recorded reason. The operator console shows usage rollups across workspaces, the reconciliation outcome and drift alerts, and a Health panel: the metering spill queue depths (queued, processing, dead-lettered), dead letters that can be requeued, and every offering's breaker state.
  • Every staff and key mutation is written to the activity log.
  • Is switched on per deployment with the token_service feature flag, which requires inference_serving and model_catalog.

Where it is​

SurfacePath
Web appToken Service in the workspace sidebar: the overview, Keys (mint with the one-time reveal, list, revoke), Usage (per-key usage with budget visibility, CSV export) and Packages (the purchasable catalog, the buy dialog, your packages with per-leg progress, status and expiry)
Operator consoleToken Service: management (tiers, offerings, the effective-dated price book), oversight (usage rollups, manual reconciliation, drift alerts, the SLA evaluations, the Packages tab with the grant dialog, and the Health panel)
API, keys.../token-service/workspaces/{ws}/keys (mint, list) and .../keys/{id} (revoke)
API, tiersGET .../token-service/workspaces/{ws}/tiers (the published tier catalog, active tiers only)
API, packagesGET .../token-service/workspaces/{ws}/package-products (the catalog) and GET/POST .../token-service/workspaces/{ws}/packages (your packages, buy)
API, usage.../token-service/workspaces/{ws}/usage (JSON and CSV, with the coverage columns); staff cross-tenant usage at /admin/token-service/usage
API, SLAGET .../token-service/workspaces/{ws}/sla-report and GET /admin/token-service/sla-report (JSON by default, CSV through the report negotiation)
API, staff/admin/token-service/tiers, /admin/token-service/offerings, GET /admin/token-service/offerings/{id}/price, /admin/token-service/package-products, /admin/token-service/packages (oversight and grant), GET /admin/token-service/health, POST /admin/token-service/spill/requeue-dead, POST /admin/token-service/sla/evaluate, GET /admin/token-service/alerts, POST /admin/token-service/reconcile
GatewayThe deployment's OpenAI-compatible Token Service endpoint, reached with Authorization: Bearer ... and the service key

How to buy and use inference as a service​

  1. An operator switches the deployment's token_service flag on and publishes at least one tier and one offering with an effective price entry.
  2. A workspace member opens Token Service, then Keys, and mints a key: pick the tier from the catalog (its rate limits and availability target are listed), copy the secret when it is shown; it is never shown again.
  3. Call the deployment's Token Service endpoint with Authorization: Bearer <key>; the API is OpenAI-compatible.
  4. Buy a package on Packages to prepay a token volume: covered requests draw from it first, and only the remainder bills against the balance.
  5. Follow usage on Usage: per-key totals against the daily token budget, with the binding level shown; pull the usage report as JSON or CSV.
  6. At the start of each month the platform evaluates the previous month against the tier's availability target; a missed month earns the scheduled credit, visible in the SLA report.

On-demand and on-prem​

On the on-demand service Token as a Service is switched on: we publish the tiers, the offerings and their prices, and usage is drawn down from the workspace balance.

Both delivery models run the same code behind the flag. On a licensed deployment with billing switched off, usage is still metered and budgets still enforce, but nothing posts to a balance and a service credit, once written, stays record-only; see Billing on a licensed on-prem deployment.

Numbers​

NumberBound
Rate limitsPer tier: requests per minute, tokens per minute, concurrency; a rate-refused request's tokens are rolled back out of the counter
Daily token budgetEnforced at the key, the workspace and the organization quota frame; a request beyond it: 429 with cause quota_exceeded_tokens
Circuit breakerPer offering; configurable failure threshold (default 5) and cooldown (default 30 seconds)
Package expiryChecked hourly at 5 past the hour UTC; an expired package never draws, also before the sweep flips its status
Package priceBelow 100,000, at cent precision, so a payment record is always exact to the cent
SLA evaluationThe 1st of each month, 03:30 UTC, over the previous UTC month; an ended month can be re-run on demand
Credit roundingTo cents; a sub-cent credit writes a zero row and posts nothing

Limits and known behaviour​

  • A key's secret is shown exactly once, at mint; the platform stores only a hash and cannot recover it.
  • A revoked key keeps its usage ledger; keys are not deleted.
  • Usage metered while billing is switched off never posts, also after billing is switched on again.
  • Buying a package needs the workspace permission that purchases instances; a purchase is never refunded, and an expired package forfeits its remaining tokens.
  • Minting a key on a retired tier is refused; keys already on it keep serving. A retired package product keeps the packages already held on it.
  • The credit schedule applies from the month it was set onward; earlier months earn nothing.
  • The token_service flag requires inference_serving and model_catalog; while it is off, the routes are unavailable.