Skip to main content
Version: 1.12.1

Cost Analysis

Cost Analysis shows where an organization's usage and spend come from across environments, teams, members, caller API keys, models, target models, days, and cost attribution tags. Filter the usage first, then group the result by the dimension you want to compare.

You can also expand any group or the total to inspect the pricing conditions and billed items that produced its cost. Tags are optional: configure cost attribution tags when the organization needs custom dimensions such as department, subsidiary, project, or cost center.

Prerequisites​

Before starting, prepare the following:

  • Permission to read usage in at least one environment. Cost Analysis combines every environment you can read usage in. A role that reads only some keys' usage shows only those keys.
  • Recorded gateway usage in at least one environment.
  • For a current tag grouping or filter, a declared tag key and recorded usage that carries it. A deleted key remains available for time ranges whose usage still carries it. See Cost Attribution Tags.

For Admin API examples, export the control-plane URL and a read-scoped admin token:

# AISIX_CP includes /api and has no trailing slash.
# The local AISIX Enterprise quickstart uses http://localhost:8080/api.
export AISIX_CP="YOUR_AISIX_CONTROL_PLANE_API_URL"
export AISIX_TOKEN="YOUR_ADMIN_TOKEN"

With the prerequisites ready, start by narrowing the usage you want to analyze.

Filter and Group Usage​

The organization-level Cost Analysis page groups usage from every environment in the organization by one dimension at a time. The Filter section selects the usage to analyze, and Statistics breaks it down. For example, filter on business_group=cloud, then group by the department tag to see how that business group's spend splits across departments.

The Filter section comes first:

  • Time range: the last 24 hours, 7 days, or 30 days, or a custom range. The page reads whole hours, so the start is rounded down and the end up to the hour.
  • Filters: environments, team, member, model, and any number of tag key=value filters. Filters on different tag keys must all match, and several values of one key match any of them. A drill-down from an API key row adds that key as a filter. Each active filter shows as a chip below the controls, and Clear filters removes them all.

The Statistics section then breaks the filtered usage down:

  • Group by: a tag key, team, member, API key, model, environment, day, or target model. See Compare a Model's Targets. Grouping by day shows a daily bar chart; other groupings show horizontal bars.
  • Sort by: cost, total tokens, input tokens, output tokens, requests, or successful requests. Groups are listed largest first.
  • Refresh: reloads the figures, together with the tag keys and the names of teams, members, and environments.

Select a row to drill down. The page applies that group as a filter and chooses the next grouping not already fixed by the filters. Use the breadcrumb to return to an earlier step.

When grouping by team or by a tag key, a Budget (current period) column shows the matching team or tag budget's current-period spend and limit. The budget figures are returned only to members whose roles read budgets. When the organization leaves estimated usage out of budgets, the budget's spend excludes estimated requests while the cost on this page still includes them. When grouping by API key, each key row links to the request logs of the environment the key belongs to, filtered to that key.

After a control-plane upgrade, the page shows the same backfill notice as the Usage view. The figures remain incomplete until the backfill finishes. Cost is in the organization's currency.

To see how a row's cost was calculated, open its cost breakdown.

Switch Between Billed Amounts and Platform Cost​

Amounts at the top of the page switches every cost figure between two amounts. Billed is the default, and the page keeps the selection in its URL as ?cost_view=:

  • Billed is each usage event's recorded cost: what the organization charged for the usage. It can come from a sale price, and it includes that sale price's off-peak discount.
  • Platform cost is each usage event's upstream_cost: the usage at the price, in model pricing, of the model that served it. Sale prices and off-peak discounts do not affect it.

The two amounts are shown separately and never added together. Every figure, chart, and sort order on the page follows the selection, and so do the cost breakdown and the CSV it exports. The Budget (current period) column always shows billed spend.

Under Platform cost, a cost can note a number of calls without platform cost, such as 3 calls without platform cost. These are attempts whose serving model has no price, that reached no model, or that were recorded before platform cost existed. They add 0 to the figure, and their billed amount is never put in its place.

After the upgrade to 1.11.0, the control plane adds the platform cost of usage recorded before the upgrade in the background, newest first. Until it finishes, Platform cost shows the backfill notice and its figures can be incomplete. Billed amounts are not affected.

Interpret Special Groups and Labels​

Cost Analysis preserves historical usage even when its current resource or tag metadata has changed. The following labels explain how that history appears:

Label or rowMeaningWhat you can do
Not setThe usage has no value for the selected grouping.Review the row as a whole; it cannot be drilled into.
Day rowUsage from one UTC day.Change the time range or grouping; day rows cannot be drilled into.
Other N groupsThe sum of groups beyond the first 50. The listed groups and this row add up to the total.Narrow the filters to bring a group into the first 50.
DeletedA tag key or resource no longer exists, but selected usage still refers to it. Resources show the first eight characters of their ID.Select the badge to view and copy the full resource ID. For a deleted tag key, type a value or drill down from a group because value suggestions are unavailable.
RemovedA member no longer belongs to the organization.Select the badge to view and copy the member ID.
Name unavailableThe dashboard could not load enough metadata to confirm the resource's current state.Retry the view; this label does not mean the resource was deleted.

Tag controls offer every declared key and any deleted key present in the selected usage. Value suggestions come from current caller API keys, teams, members, and recent usage. When the organization has no declared tag keys, the controls link to Tag Keys, and tag filtering remains unavailable until a key is declared.

Find the Cost of a Semantic Request​

For a semantic router, group or filter by the model group or direct model the router selected. Its row includes both routed requests and requests sent directly to that target. The same rule applies to billed amounts, platform cost, and their breakdowns. To identify the group member that handled an attempt, use Target model.

For example, a router sends two requests in a pinned session to docs-chat, a group with no sale price. Its member serves each request for USD 0.12. The group shows USD 0.24 and two requests. The gateway called docs-decider only for the first request. That model shows USD 0.01 (rounded) for its internal call and zero client requests.

Cost Analysis showing two client requests for docs-chat and a separate internal call charge for docs-decider

When the control plane can identify a semantic attempt but has no recorded target, its model is Not set. A recorded target whose name is unavailable at attribution appears under its UUID.

After upgrading to v1.12.0, model groupings, model filters, and cost breakdowns can show a backfill notice while the control plane updates historical attribution. If the organization was ever updated before the upgrade, even just its name or language, only hours within the last calendar day at upgrade are eligible. An organization with its original settings uses its configured usage retention period. Older totals that retention may have removed and recreated, and events with no evidence of semantic routing, keep their original attribution. Later settings changes do not shorten the window.

Compare a Model's Targets​

To see how a model group's traffic was distributed, select Show targets on its row, or select Target model in Group by.

Each target row shows its Provider key and its cost in the amount that Amounts selects. There is no separate platform cost column: to see what each target cost at its own price, without any sale price or off-peak discount, switch Amounts to Platform cost.

The counts are attempts on each target, including failed attempts and fallbacks. They can therefore add up to more than the model's request count.

Usage of a model called directly stays on that model's row, including responses served from the gateway's cache. Usage of a model group that reached no target falls in Not set. This includes a group response served from the cache and a request that failed before target selection.

Target rows and platform cost cover only usage recorded after the control-plane release that added them, so an earlier range can show less than the model row. Show targets and the grouping are unavailable while filtering by team, member, API key, or tag.

For example, suppose the chat model group distributes requests across several targets. The following query compares what each target served, what it billed, and what it cost at its own price:

GET /usage_analysis?group_by=target_model&model=chat

The target models have no per-key breakdown, so this view takes usage read without an object scope in every environment the request covers: the environments of its environment_id filter, or otherwise every environment where you can read any usage. Other callers receive 403 with the error code USAGE_TARGET_VIEW_FORBIDDEN, never a partial total. A target comparison cannot be combined with team, member, caller API key, or tag filters; such a request returns 400. Each group carries:

FieldMeaning
keyThe target model's ID. It is null for usage of a model group that reached none of its targets, such as a cache hit.
nameThe target model's current name, or null once it no longer exists.
environment_idThe environment the target model belongs to. It is absent once the model no longer exists.
provider, provider_key_nameThe vendor ID and display name of the target's provider key, or null once the model or the key no longer exists.
costThe billed amount, or the platform cost with cost_view=platform, in the organization's currency. The response also returns it as cost_usd, a deprecated name.
prompt_tokens, completion_tokens, total_tokensToken counts of the attempts.
request_countAttempts on this target, counting each failed attempt and fallback.
success_countAttempts on this target that succeeded.
upstream_costThe summed platform cost, or null when every attempt was unpriced.
unpriced_request_countAttempts on this target whose upstream_cost is null. An attempt that reached no target is not counted.

remainder and total also carry upstream_cost and unpriced_request_count. Both fields keep this meaning whichever cost_view is selected. See Choose the Amount Through the Admin API.

Read the Cost Breakdown​

A recorded cost is not always a token count multiplied by one listed rate. An input-token tier can change the rates for a long request. A service-tier entry can replace them, and a sale price's off-peak discount can reduce the result.

The cost breakdown shows which pricing conditions applied, what was billed under each one, and the resulting average unit prices.

Open a Breakdown​

Every row of the Cost Analysis table, including Not set and Total, has an expander before its label. Select Show cost breakdown to open it under the row with the page's current time range and filters. Select Hide cost breakdown to close it.

The Other N groups row has no breakdown. Narrow the filters until the group you need is listed. Reloading the figures closes every open breakdown.

The breakdown lists one block per pricing condition, largest cost first. A condition is one combination of these columns:

ColumnMeaning
ModelThe selected target for a semantic request, the called model for an internal call, or the model the client requested for other traffic.
Target modelThe model the attempt was dispatched to: the model itself when it was called directly, or one of the group's targets. It is — when no model was dispatched, such as a response a model group's request got from the gateway's response cache. A cache hit on a model called directly names that model.
Price tierThe input-token tier whose rates billed any of the request's billed items, such as Tier 2 (no upper limit). It is — when no billed item used a tier's rates, such as under a flat price. A request on the decision endpoints or billed by audio duration is listed under its tier when any of its items billed at the tier's rates, although its Price tier in Request Logs is empty.
Service tierThe service-tier price entry that billed the usage, shown under the first tier name configured on that entry. Base price means no entry was recorded for the usage.
PeriodOff-peak when the request completed inside the off-peak discount of the sale price that billed it, otherwise Normal.
PriceWhich price billed the usage, as described in Which Price Bills a Request. Model's sale price uses the sale price of the selected target for a semantic request, the called model for an internal call, or the requested model for other traffic. Target model's sale price uses the serving model's sale price when the first price cannot bill the request. Platform price uses the serving model's platform price without a discount.
Usage sourceReported by upstream when the upstream reported the usage. Estimated by gateway when the upstream left at least one of the request's token counts missing and the gateway estimated it. A pricing condition with both kinds of usage is listed twice, once for each source.

The Service tier value groups every tier name that the same price entry matches, ignoring case. Base price appears when the upstream reported no tier, when its tier matched no entry, or when none of the request's billed items used token rates, such as a request billed only at decision-endpoint rates. Usage priced before the control plane recorded the billing entry also remains under Base price and is not reclassified. To see the tier the upstream actually reported, open the request in Request Logs.

When Amounts is Platform cost, every condition is priced at the target model's own price: Price is Platform price, Period is Normal, there is no off-peak discount line, and Price tier and Service tier are those of the target's own price. The platform cost of usage recorded before 1.11.0 has no breakdown and falls in the No breakdown line. A notice above the table states how many calls have no platform cost and are left out of the amounts.

Within a condition, each Billed item has its own line with the Quantity billed and the Average unit price. Starting with control plane v1.12.1, the Billed view shows Amount before discount and Net amount side by side. A condition with an off-peak discount ends with an Off-peak discount line that shows the total savings as a negative number in Amount before discount.

When the control plane cannot allocate a recorded historical discount to individual items, their Net amount shows —. The Total still includes the recorded billed cost. The Platform cost view shows a single Amount column. A condition with neither billed items nor an off-peak discount, such as cache hits or usage of an unpriced model, shows a single No charge line.

Billed itemcomponent in the Admin APIQuantityRate
InputpromptInput tokens neither read from nor written to a prompt cachePrompt
Cache readcache_readInput tokens read from a prompt cacheCache read, or Prompt when blank
Cache writecache_writePrompt-cache writes with a five-minute lifetime, writes the upstream does not split by lifetime, and OpenAI-style writes other than 12-hour onesCache write, or Prompt when blank
Cache write (1 hour)cache_write_1hPrompt-cache writes with a one-hour lifetimeThe one-hour write rate
Cache write (12 hours)cache_write_12hOpenAI-style prompt-cache writes with a 12-hour retentionThe 12-hour write rate
OutputcompletionOutput tokens other than reasoningCompletion
ReasoningreasoningReasoning tokensReasoning, or Completion when blank
Decisions inputdecisions_promptInput tokens not read from a cache, on the decision endpointsPrompt under Decisions pricing
Decisions cache readdecisions_cache_readInput tokens read from a prompt cache, on the decision endpointsCache read under Decisions pricing
Decisions cache writedecisions_cache_writePrompt-cache writes on the decision endpoints that bill at a Decisions pricing rate, 12-hour writes includedCache write under Decisions pricing
Decisions outputdecisions_completionOutput tokens other than reasoning, on the decision endpointsCompletion under Decisions pricing
Decisions reasoningdecisions_reasoningReasoning tokens, on the decision endpointsReasoning under Decisions pricing
Audio durationdurationSeconds of audioAudio per minute

The rates come from the price that billed the request, after applying its input-token tier and service-tier entry. Each item keeps the name of its original rate when a blank rate falls back. For example, cache reads billed at the Prompt rate remain Cache read.

A request on the decision endpoints uses a Decisions item for each part that the price's decision-endpoint rates billed:

  • A part whose decision-endpoint rate is set is billed under that rate's item.
  • A part whose decision-endpoint rate is blank falls back the same way the rates do, and is billed under the item of the rate it reaches. For example, with only a decision-endpoint Prompt rate set and the base Cache read rate blank, cache reads bill at the decision-endpoint Prompt rate under Decisions cache read. With the base Cache read rate set, they bill at it under Cache read.
  • A one-hour cache write has no decision-endpoint rate of its own. It is billed under Decisions cache write when that rate is set, otherwise under Cache write (1 hour) when the price sets a one-hour rate, and otherwise under the same item as the request's other cache writes.
  • When the price sets no decision-endpoint rate at all, decision-endpoint requests are billed under the base items, like any other request.

A summary above the table gives each billed item's share of the amount before discount, such as Input 62.5% · Output 37.5%, followed by any off-peak savings.

Export CSV writes one line per condition and billed item, including the average unit price. Additional lines report the off-peak discount as a negative amount, usage without a breakdown, and the total. The usage_estimated column identifies the usage source and is true for usage the gateway estimated. The service_tier column holds what Service tier shows and is empty for the base price. The price_source column holds the Price value as requested_model, dispatched_model, or platform_price, and the deprecated group_price column before it is true only for requested_model.

The CSV appends net_amount after internal_call_purpose, keeping every existing column in its original position. In the billed export, each item's amount is the amount before discount and its net_amount is what was billed after discount. If a historical item's net amount is unavailable, its net_amount cell is empty. The cell is also empty on the off_peak_discount line and throughout a platform cost export. Billed summary lines, including total, report the recorded billed amount in both amount columns.

When the breakdown holds estimated usage, the Total line states its cost in the organization's currency. For example, a USD organization can show incl. $1.20 on usage estimated by the gateway (3 requests). The request count is left out when it is zero, which happens when only retry or fallback attempts were estimated.

How the Numbers Add Up​

The control plane applies each attempt's recorded off-peak multiplier before summing amounts for each billed item. Attempts in one pricing condition can have different multipliers. If all attempts in a condition used a multiplier of 0.5, input and output amounts of 18 and 4.8 become 9 and 2.4 after discount. The condition costs 11.4, and the Off-peak discount line shows savings of 11.4. Adding each condition's billed cost and any No breakdown amount gives the Total net amount.

The remaining rules explain why a condition or average price can differ from a simple token count multiplied by one base rate:

SituationHow it appears in the breakdown
The price changed during the selected rangeAverage unit price is the amount before discount divided by the quantity. It is weighted by quantity across the old and new rates. Without a price change, it equals the configured rate. Token prices are shown per 1M tokens. Audio-duration prices are shown per minute.
A request crosses an input-token thresholdAISIX selects one tier from the request's input tokens, including cache reads and writes. Every billed item uses that tier; a request is never split across tiers.
The upstream reports a service tierA matching service-tier entry replaces the base rates and input-token tiers, and the usage is listed under that entry. If no entry matches, the request uses the base rates and is listed under Base price, together with requests that reported no tier. The condition is decided when the request is priced: editing a price or an entry's tier names later changes only usage priced afterwards.
The gateway fills in a missing token countThe whole request is marked Estimated by gateway and its filled counts use the normal rates. Estimation changes the usage source, not the price. Leaving estimated usage out of budgets does not change this either.
A request retries or fails overThe request count belongs to the first attempt's usage source. Later attempts add their quantities and cost to their own conditions without adding another request, so a fallback with estimated usage can contribute estimated cost with no request count.
A request billed at a sale price completes off-peakThe control plane calculates each attempt's savings by multiplying its amount before discount by one minus its multiplier. Off-peak discount shows the sum of those savings.

Internal Calls in the Cost Breakdown​

The model calls the gateway makes itself while serving a request, such as a semantic router's embedding or a semantic cache lookup, are internal calls. Each one is billed at the prices of the model it called. Cost Analysis includes their cost in every cost figure and leaves them out of the request and token figures. An internal call belongs to the group of its request's caller and time. When grouping by model, its model is the model it called.

When a row's cost includes internal calls, the cost shows their part beneath it, such as incl. $0.12 internal calls. Under Platform cost, it also notes those without a platform cost, such as 2 internal calls without platform cost.

In a breakdown, internal calls are pricing conditions of their own, marked with their purpose:

PurposeLabelinternal_call_purpose
Semantic router embeddingInternal call: semantic routing embeddingsemantic_route_embedding
Semantic router decisionInternal call: semantic routing decisionsemantic_route_decision
Semantic cache lookupInternal call: semantic cache embeddingsemantic_cache_embedding
Guardrail embeddingInternal call: guardrail embeddingguardrail_embedding

On such a condition, Model and Target model are the model the call addressed, Price tier and Service tier are empty, and the request count is 0. A semantic router whose classifier names its TypeSafe key and model directly has no model on its decision calls, which are not billed. The summary above the table states the internal calls' total, such as Includes $0.12 for the gateway's own model calls, listed with their purpose; they are not requests. Under Platform cost, it also states how many have no platform cost.

In the CSV, internal_call_purpose holds the purpose on the lines of an internal call and is empty on the lines of the callers' own usage.

In the Admin API, each group of GET /usage_analysis/breakdown carries internal_call_purpose, which is null on the callers' own usage, and total carries internal_call_cost and internal_call_no_platform_cost_count. Groups are ordered with the callers' own usage before internal calls when they tie on every other key.

Usage That Has No Breakdown​

The control plane records the breakdown when it prices a request and does not recalculate earlier usage. Usage recorded before the control-plane release that added the breakdown has none. The same applies to usage recorded by an older control-plane instance during a rolling upgrade.

When the selected range contains such usage, a notice shows when breakdown data begins and the amount without one. A No breakdown line carries that amount so the breakdown's Total still matches the row. In the Billed view, both lines show — in Amount before discount when the selected range includes such costs.

Cost Breakdown of a Single Request​

Expanding a row in Request Logs shows Cost breakdown with one line per billed item. The UI uses the organization's currency symbol; for example, a USD organization can show Input: 1,320 tokens × $0.15 / 1M tokens = $0.000198. An Off-peak discount line appears when the discount applied.

The section is absent from rows recorded before breakdown data existed and from rows with nothing to bill, such as a cache hit or a request to an unpriced model.

The expanded row also shows the attempt's recorded Off-peak multiplier. For example, ×0.5 means the control plane billed half of each item's pre-discount amount, and ×1 means it billed the full amount. The dashboard omits the field for attempts without a recorded multiplier.

To show a breakdown in your own application, read the attempt rows from GET /api/environments/{env_id}/usage_events or its JSON or CSV export. Each item in cost_components has a component, a quantity, and an amount before the off-peak discount. The sum of the amounts minus off_peak_discount gives the attempt's billed cost. Events recorded before the breakdown existed have null for both cost_components and off_peak_discount in JSON.

Starting in v1.12.0, the control plane records off_peak_multiplier when it prices each attempt. Use that row's multiplier m for every component, even if the model's price has since changed. The billed amount is amount * m, and the savings are amount * (1 - m). For example, if an input component costs USD 0.04 before the discount and m is 0.75, the billed amount is USD 0.03 and the savings are USD 0.01. If a request has multiple attempts, calculate each attempt separately before adding the results.

A multiplier of 1 means the attempt received no off-peak discount. If the control plane did not record a multiplier for an older attempt, JSON returns null and the CSV cell is empty. Treat the multiplier as unknown in that case.

Automate Cost Analysis​

The Admin API exposes the same usage groups and cost breakdowns as the dashboard. Use it to export every group, reconcile costs in another system, or compare pricing conditions across a business dimension.

GET /usage_analysis returns the dashboard's figures, and GET /usage_analysis/tag_keys returns the tag keys present in a time range, including deleted keys. Both are documented in the AISIX Enterprise / Cloud Admin API. To retrieve more groups than the dashboard shows, see Retrieve Every Group Through the Admin API.

Choose the Amount Through the Admin API​

GET /usage_analysis and GET /usage_analysis/breakdown take a cost_view parameter, billed or platform, that matches Amounts in the dashboard. Without it, or with billed, the responses are the billed amounts described on this page. With cost_view=platform:

  • cost, and its deprecated alias cost_usd, is the platform cost on every group, on remainder, and on total. sort=cost orders groups by it.
  • Each group, remainder, and total carry no_platform_cost_attempt_count, the attempts whose upstream_cost is null. They add nothing to cost. The count is of attempts, not requests: a request that fell back counts once for each such attempt, and an attempt that reached no target counts too, unlike unpriced_request_count.
  • A group's budget is still the billed spend.
  • backfill_in_progress is also true while the control plane is still adding the platform cost of usage recorded before the upgrade to 1.11.0.
  • On the breakdown, each group is priced at the dispatched model's own price. components, price_tier, and service_tier come from that price, price_source is platform_price, off_peak and group_price are false, and off_peak_discount is 0. Each component's net_amount is null. The platform cost of usage recorded before 1.11.0 has no breakdown and is included in uncovered_cost, so total.cost plus uncovered_cost equals the total.cost of GET /usage_analysis with cost_view=platform. total also carries no_platform_cost_attempt_count.

The following request lists a week of platform cost by model:

curl -sS --get "${AISIX_CP}/usage_analysis" \
--data-urlencode "from=2026-11-01T00:00:00Z" \
--data-urlencode "to=2026-11-08T00:00:00Z" \
--data-urlencode "group_by=model" \
--data-urlencode "cost_view=platform" \
-H "Authorization: Bearer ${AISIX_TOKEN}"

Read the Breakdown Through the Admin API​

GET /usage_analysis/breakdown returns the breakdown that Cost Analysis shows. It takes the same from and to and the same filters as GET /usage_analysis, and the same permission as other usage reads, limited to the keys your roles let you read. Two more parameters narrow it to one group of any grouping:

  • target_model_id limits it to usage dispatched to one model. Like group_by=target_model, it and unset=target_model cannot be combined with team_id, member_id, api_key_id, or tag, and such a request returns 400. They also take the same permission as the target model view.
  • unset limits it to usage with no value for a dimension, named as in group_by: tag:<key>, team, member, api_key, model, or target_model. Repeat it for several dimensions.

To compare a breakdown across members, tags, or another supported dimension, pass group_by. See Compare Costs Across Members, Tags, and Other Dimensions.

With cost_view=billed, each component under groups, remainder, and total has an amount before discount and a net_amount after discount. Each entry's off_peak_discount is its total discount, and cost is its recorded billed amount. When there is no recorded discount, net_amount equals amount. When a historical discount cannot be allocated across the items in a group or summary, all its components have net_amount: null. Its recorded cost and off_peak_discount are still available.

For a day group, pass the start and end of that UTC day as from and to. The following request breaks down a week of the chat model group:

curl -sS --get "${AISIX_CP}/usage_analysis/breakdown" \
--data-urlencode "from=2026-11-01T00:00:00Z" \
--data-urlencode "to=2026-11-08T00:00:00Z" \
--data-urlencode "model=chat" \
-H "Authorization: Bearer ${AISIX_TOKEN}"

The response has the following shape:

{
"group_by": null,
"currency": "USD",
"groups": [
{
"model": "chat",
"target_model": "31f302a2-d055-4f9f-a662-1dc4b84de9f7",
"target_model_name": "gpt-4o",
"price_tier": {
"index": 2,
"max_input_tokens": null
},
"service_tier": "priority",
"off_peak": true,
"price_source": "requested_model",
"group_price": true,
"usage_estimated": false,
"request_count": 120,
"components": [
{ "component": "prompt", "quantity": 3600000, "amount": 18, "net_amount": 9 },
{ "component": "completion", "quantity": 240000, "amount": 4.8, "net_amount": 2.4 }
],
"off_peak_discount": 11.4,
"cost": 11.4
}
],
"remainder": {
"group_count": 0,
"request_count": 0,
"components": [],
"off_peak_discount": 0,
"cost": 0
},
"total": {
"request_count": 120,
"components": [
{ "component": "prompt", "quantity": 3600000, "amount": 18, "net_amount": 9 },
{ "component": "completion", "quantity": 240000, "amount": 4.8, "net_amount": 2.4 }
],
"off_peak_discount": 11.4,
"cost": 11.4,
"group_count": 1,
"estimated_request_count": 0,
"estimated_cost": 0
},
"covered_from": "2026-11-01T08:00:00Z",
"uncovered_cost": 3.2
}

❶ price_source maps to the dashboard's Price column: requested_model, dispatched_model, or platform_price. Here the chat model group's sale price billed the usage. group_price is deprecated and equals price_source being requested_model.

❷ usage_estimated maps to Usage source. true means the gateway estimated at least one token count; false means the upstream reported the usage.

❸ remainder sums every pricing condition omitted from this page. The listed groups' costs plus remainder.cost add up to total.cost.

❹ total covers every page. Its estimated request count and cost sum only conditions whose usage was estimated. A request is counted once, under its first attempt, while the components and cost include every attempt.

❺ covered_from marks the first hour with breakdown data. Add uncovered_cost to total.cost to reconcile the result with GET /usage_analysis for the same range and filters.

service_tier maps to Service tier: the first tier name of the entry that billed the usage, here an entry whose tier names begin with priority, or null for Base price. Historical usage priced before this field existed also has null and is not reclassified.

The response orders groups by cost, largest first. It returns at most limit groups beginning at offset; see Retrieve Every Group Through the Admin API. The currency field identifies the organization's currency.

For the complete response schema, see the AISIX Enterprise / Cloud Admin API.

Compare Costs Across Members, Tags, and Other Dimensions​

Use group_by when you want to compare the pricing conditions across a business dimension rather than inspect one filtered group. For example, the following request compares a week of costs across members:

curl -sS --get "${AISIX_CP}/usage_analysis/breakdown" \
--data-urlencode "from=2026-11-01T00:00:00Z" \
--data-urlencode "to=2026-11-08T00:00:00Z" \
--data-urlencode "group_by=member" \
-H "Authorization: Bearer ${AISIX_TOKEN}"

Each returned group still represents one pricing condition, but now identifies the member whose request produced it. The focused excerpt below omits unrelated response and pricing-condition fields:

Focused response excerpt
{
"group_by": "member",
"groups": [
{
"key": "e754c9ea-83c5-49e3-9e38-5d4fc782bd0e",
"name": "Alice",
"model": "chat",
"target_model_name": "gpt-4o",
"price_tier": {
"index": 2,
"max_input_tokens": null
},
"request_count": 18,
"components": [
{ "component": "prompt", "quantity": 420000, "amount": 2.1, "net_amount": 2.1 },
{ "component": "completion", "quantity": 30000, "amount": 0.6, "net_amount": 0.6 }
],
"cost": 2.7
}
]
}

❶ The response echoes the selected grouping. Without group_by, this field is null.

❷ key is the member ID, and name is the current display name. Usage without a member has a null key. If the member no longer exists, the name is also null.

The remaining fields identify the pricing condition and show what it cost. One member can therefore appear in several groups when their requests used different models, targets, price tiers, or other pricing conditions.

The same request can compare other dimensions:

Comparisongroup_by valueGroup identity
One tag keytag:<key>Tag value
TeamsteamTeam ID and current name
Caller API keysapi_keyKey ID, current name, and its environment_id while the key exists
EnvironmentsenvironmentEnvironment ID and current name
UTC daysdayDay

Any grouping can return a null key for usage that had no value for that dimension. A team, member, caller API key, or environment group carries its current display name, or a null name after the resource no longer exists. Tag and day groups do not carry names.

Every pricing condition already identifies its model and target model, so requests with group_by=model or group_by=target_model return 400.

For the complete response schema, see the AISIX Enterprise / Cloud Admin API.

Retrieve Every Group Through the Admin API​

The dashboard does not page. Its main table shows the 50 highest-ranked groups and summarizes the rest as Other N groups. An expanded cost breakdown shows up to 500 pricing conditions and summarizes the rest as Other conditions.

To analyze or export every group, page through GET /usage_analysis or GET /usage_analysis/breakdown sequentially:

offset=0
while :; do
page=$(curl -sS --get "${AISIX_CP}/usage_analysis/breakdown" \
--data-urlencode "from=2026-11-01T00:00:00Z" \
--data-urlencode "to=2026-11-08T00:00:00Z" \
--data-urlencode "group_by=member" \
--data-urlencode "limit=500" \
--data-urlencode "offset=${offset}" \
-H "Authorization: Bearer ${AISIX_TOKEN}")
echo "${page}" | jq -c '.groups[] | {member: .key, name, model, target_model_name, price_tier, usage_estimated, request_count, components, cost}'
offset=$((offset + 500))
[ "${offset}" -lt "$(echo "${page}" | jq '.total.group_count')" ] || break
done

This example reads 500 member groups at a time and prints one line per group. The paging fields work as follows:

  • limit sets how many groups a response lists, 50 by default and 500 at most. offset skips that many groups in sort order before the first one listed, and defaults to 0.
  • total.group_count is how many groups there are across every page.
  • remainder sums every group outside the current page, including those before and after it. On every page, the listed groups' costs plus remainder.cost add up to total.cost.
  • Groups that tie in the sort order are ordered by key. Breakdown conditions then use the rest of their columns, with the usage source last and reported usage before estimated usage. Successive pages neither repeat nor skip a group as long as usage does not change between requests.

Choose a completed time range before paging. Usage from the current hour can change the ordering while the loop runs and cause a group to move between pages.

Read pages one after another, not in parallel. Every page recomputes the aggregation over the whole range, and parallel requests multiply its database memory use. The control plane does not cap concurrent aggregation queries.

Each aggregation query has 30 seconds. A timeout returns 503 with the error code QUERY_TIMEOUT and no groups. Narrow the time range or filters, then try again.

Next Steps​

Configure Cost Attribution Tags for organization-defined allocation dimensions, or review Model Pricing when a cost is missing or differs from the provider's pricing basis. Use Usage Reporting for organization-wide totals and reporting behavior.