Skip to main content
Version: Dev

Usage Reporting

The Usage view summarizes traffic, token consumption, spend, and platform cost across the organization for the last 30 days. Use it to identify the environments, models, or caller API keys driving usage, reconcile spend with budgets, and investigate missing data.

Token totals can include local estimates when an upstream omits usage. Token Counting and Usage Estimation explains when AISIX estimates a count and whether the caller receives it.

Read the Usage Summary​

Open Usage in the organization navigation. Every card and table uses the same rolling 30-day window.

Usage summary cards for spend, platform cost, requests, tokens, and cache savings
CardWhat It Shows
SpendThe amount billed after sale prices, price tiers, and off-peak discounts. Response-cache hits cost nothing.
Platform costWhat the serving models cost at their configured model prices. It is not added to spend.
RequestsDownstream requests, counted once rather than once per attempt.
TokensRecorded token consumption, with input and output shown separately beneath the total.
Cache savingsUpstream input and output tokens avoided by semantic-cache hits.

When at least one attempt contains estimated usage, the Spend and Tokens cards show incl. estimated and the number of affected attempts. The number includes retries, failovers, and ensemble sub-calls; it is not a percentage of downstream requests.

Large card values are abbreviated for the Dashboard locale, such as 4.3T or $4.3M. Hover over a value to see its exact amount.

Compare Usage Breakdowns​

Use the tables below the cards to locate the source of traffic and spend.

Usage breakdown tables by environment, model, and caller API key
  • By environment shows which deployment environments generated traffic and billed spend.
  • Top models lists up to 10 environment and caller-requested model-alias combinations, ranked by spend. Older events without a requested alias use the resolved model.
  • Top API keys lists up to 10 environment and caller API key combinations, ranked by spend.

Use Cost Analysis when you need additional grouping by team, member, tag, provider, or another attribution dimension.

Understand Request and Token Totals​

The summary intentionally counts requests differently from attempts and internal model calls:

MeasureCounting Rule
RequestsCounted once, from the first attempt (attempt_index: 0). Retries, failovers, ensemble sub-calls, and gateway internal calls do not add requests.
Successful requestsDetermined by the successful 2xx attempt. For an ensemble, the judge is the successful attempt.
TokensUses each event's provider-reported total when present; otherwise AISIX adds input, output, cache-creation, and cache-read counts. Internal-call tokens are excluded from this card.

The Requests card follows the HTTP result. An MCP or A2A operation that reports an application error inside HTTP 200 therefore counts as a successful attempt, even though Logs labels the operation as an error.

Metrics and Usage Events defines the request and attempt counting rules. Provider-Reported Counts explains why an upstream's token counters do not always add up.

Compare Spend and Platform Cost​

Spend and Platform cost answer different questions:

FigurePrice BasisUse It To Understand
SpendThe price charged for the requested model, including sale prices and discounts.Customer billing and budget consumption.
Platform costThe configured price of the model that served each attempt, recorded as upstream_cost.The underlying cost of serving traffic.

The Usage view shows the two 30-day cards together. An environment's Overview page similarly shows Cost today and Platform cost today. Per-environment and top-API-key tables remain billed-spend figures.

When an attempt has no platform cost, the card reports how many calls are missing it. Such an attempt used an unpriced model, reached no model, or predates platform-cost tracking. It contributes 0 to platform cost; AISIX never substitutes its billed amount.

If the usage summary cannot load, the cards show — and Could not load rather than a misleading zero.

Gateway Internal Calls​

AISIX can call models while serving a downstream request—for example, to embed semantic-cache input, classify semantic routing, or evaluate a semantic guardrail. These internal calls contribute to Spend and Platform cost, but not to the Requests or Tokens cards.

When the window contains internal calls, the Dashboard adds a Gateway internal calls card. It shows their billed cost, tokens, and platform cost. Environment Overview cards also identify the portion of today's cost produced by the gateway's own model calls.

Backfill after an Upgrade​

AISIX builds hourly usage rollups and platform-cost history after the upgrade that introduces them. During this work, the Usage and environment Overview pages show Backfilling historical usage.

Expect the following sequence:

  1. The control plane waits for the required usage index. Until it is ready, the pages can show zero even for traffic received after the upgrade.
  2. Historical usage is added in the background, newest first. Today's usage is filled before older history.
  3. Figures remain incomplete until the notice disappears.

During a rolling control-plane upgrade, a replica that has not yet upgraded can record an internal call as an ordinary request. Request and token figures for that interval can therefore include some internal calls.

See Monitor Database Work for the completion signal and operational impact.

Usage and Budget Enforcement​

Budgets evaluate AISIX gateway usage records, but their totals do not always match the Usage view:

ReasonEffect
Different time windowsUsage always covers the rolling last 30 days; each budget uses its configured period.
Estimated usage excludedUsage still includes and labels estimated attempts, while an organization can exclude them from budgets and token rate limits.
Enforcement modeA hard-stop budget rejects matching traffic with HTTP 429; warn-only mode records the over-budget state without blocking.

For an unexpected rejection, inspect the returned budget scope, the limit and period, and the caller API key's team and member bindings. See Budgets for the complete enforcement path.

Troubleshoot Missing or Unexpected Usage​

AISIX gateways report usage automatically over the managed control-plane connection. Events are sent in batches, so a completed request can take about five seconds to appear. Metrics and Usage Events documents the delivery path and retry behavior.

If data remains missing or looks incorrect, start with the symptom you observe:

SymptomChecks
Request is absentConfirm the request used the expected environment, appears in Request Logs, and passed through a gateway with a recent heartbeat. Then verify gateway connectivity to the control-plane telemetry endpoint.
Spend is zero or unexpectedCheck Model Pricing for an exact provider and model-name match and a nonzero rate for the applicable token or audio basis. In a CNY organization, only organization-defined prices apply. Very small amounts can round to zero in Usage.
Platform cost is missingConfirm that the serving model has a price and that the request reached a model. During an upgrade, wait for the platform-cost backfill to finish.
Budget spend differs from UsageCompare the time windows and check whether the organization excludes estimated usage from budgets.
Figures are incomplete after an upgradeWait until the backfill notice disappears and use the upgrade guide to monitor the usage index and backfill jobs.

If a gateway-served request never appears in Request Logs, inspect aisix_usage_events_rejected_total. The counter covers malformed events the control plane rejected inside an otherwise accepted batch. Those events are dropped and are not resent; the batch logs control plane rejected usage events in an accepted telemetry batch (events dropped).

During a temporary control-plane outage, the gateway retries failed telemetry batches with increasing delays while retaining them for up to 30 minutes. An outage beyond that window, or a full in-memory queue, can drop events; aisix_usage_event_drops_total counts them. See How Usage Events Reach the Control Plane.

The gateway continues enforcing its last received budget state. In strict mode, it rejects budgeted traffic after usage delivery has failed for the configured grace period. Behavior During a Control-Plane Outage describes the grace period and recovery behavior.