Skip to main content

Usage page

The Usage page is where you find out what the gateway spent and served over a date range, and who spent it. It answers the everyday questions of a platform team and of finance: how much did we spend this month, which teams, keys, customers and tags caused it, which models were used, how many requests failed, and is the number the gateway recorded the same as the provider's bill. It reads the daily activity rollups, so it stays fast on large deployments. Open it at /ui/usage. In the left nav it is Usage, the first item of the OBSERVABILITY group. The old link /ui?page=new_usage redirects here.

A real-world scenario​

At the start of the month a platform admin opens the Usage page, picks Last 30 days, and reads the month's total from the Spend tile. Top Virtual Keys shows one key spending twice what it did last month, so the admin clicks it, sees it belongs to the support bot team, and switches to Team Usage to confirm the team's spend by model. Finance needs the numbers in a spreadsheet, so the admin clicks Export Data and downloads the day-by-day breakdown by team and model as CSV. The team lead runs a spend report for the same range on the Spend reports tab, and the two numbers agree.

Find out what a team spent and export it​

  1. Open Usage and set the range with Select Time Range, for example Last 30 days, then Apply.

  2. On the Overview tab read the Spend tile for the total and Top Virtual Keys for the keys that spent the most. Click a key to open its details.

  3. Switch the Usage view selector to Team Usage, pick the team under Filter by team, and read the Team Spend Overview strip and the Spend by model chart on the Cost tab.

  4. Click Export Data, choose Day-by-day by team and model and the CSV format, and click Export CSV.

    Expected result: a file named like team-usage-2026-10-01-2026-10-30-daily_with_models.csv downloads, and a toast confirms the export. The same file comes from the API:

    curl "http://localhost:4000/team/daily/activity/export?start_date=2026-10-01&end_date=2026-10-30&export_type=daily_with_models&format=csv" \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -o team-usage.csv

    Expected result: one CSV row per day, team and model with its spend, tokens and request counts, see spend logs and exports.

  5. For the per key total broken down by model over the same range, open the Spend reports tab, choose Team under Report on, set From and To, and click Run report. The total above the table matches the Spend tile for the team.

The nav item is shown to the session roles Admin, Admin Viewer, Internal User and Internal Viewer. A proxy_admin_viewer signs in with the session role Admin Viewer and is view only. The session role of an org admin is Org Admin, which is not in the list, so org admins do not see the nav item, although the page opens for them at the URL. When the admin has set enabled_ui_pages_internal_users, non-admin roles see the item only if new_usage is in that list. The page has no guard of its own. What each role sees inside it is listed under the differences section below, and the gateway scopes every query to what the caller may read. Only the Spend reports tab needs a license feature. On this page "admins" means the session roles Admin and Admin Viewer, so proxy admins and admin viewers.

ControlTypeWhat it does
Usage view selectorDropdownPicks which usage view fills the page. The options a role gets are listed in the next table. The default is the first option.
User filterSearchable dropdown, placeholder Search users by email…Shown only to admins while the view is Global Usage. Empty means every user. Picking a user narrows every tab of the global view to that user.
Date rangeDate range picker, label Select Time RangeSets the range for every view on the page. The default is the last 7 days. The menu offers Today, Last 7 days, Last 30 days, Month to date and Year to date under Relative time, and Start date and End date fields under Start and end dates. Apply stays disabled until both dates are set and the end is not before the start. Cancel closes the menu without a change.
View optionWho gets itWhat it shows
Global UsageAdmins. Other roles see the same option labelled Your Usage.Admins see usage across every user. Other roles see only their own usage.
Your UsageAdmins onlyThe admin's own usage, with the same tabs as the global view.
Organization UsageAdmins, and anyone who is an org admin of at least one organizationUsage per organization.
Team UsageEveryoneUsage per team.
Customer UsageAdmins onlyUsage per customer (end user) account.
Tag UsageAdmins, Internal Users and Internal ViewersUsage grouped by request tag.
Agent Usage (A2A)Admins onlyUsage per agent.
User UsageAdmins onlyUsage per internal user.
User Agent ActivityAdmins onlyActivity grouped by the User-Agent of each request.

If the gateway reports that a person is no longer an org admin while the page is open, an Organization Usage selection falls back to the global view on the next render.

Global Usage and Your Usage​

These two views share one layout. A row of tabs sits above the content, with Export Data on the right and, for proxy admins, Ask AI next to it.

TabWho sees it
OverviewEveryone (selected by default)
Model ActivityEveryone
Key ActivityEveryone
User ActivityEveryone
MCP Server ActivityEveryone
Endpoint ActivityEveryone
Spend reportsEveryone. The content needs a license, see that section.
ErrorsAdmins only

Overview tab​

The stat strip at the top has four cells, each with a daily sparkline where it applies.

StatMeaning
SpendTotal spend in the range. The hint reads of $X budget when the signed in user has a personal max budget, and No budget set otherwise.
Total RequestsSuccessful plus failed requests, with the two counts shown as ok and failed under the number. For admins the counts come from the gateway request table, so they include requests that never reached a model. Other roles see the counts from the spend rollup.
Total TokensTotal tokens in a compact form, with the cache read tokens as a hint. Hover for the exact number.
Avg cost / request and Avg latencySpend divided by requests, and the average response time of timed requests. Avg latency shows a dash when no request was timed, and the hint gives the success rate.

The Daily usage panel stacks the top 8 models per day, with the rest grouped as Other. Its controls are Metric (Spend, Tokens or Requests, default Spend), Bucket size (Daily or Weekly, default Daily) and Scale (Linear or Log, default Linear). The title changes to Weekly usage when the bucket is weekly. Under the chart, Top models ranks up to 10 models for the chosen metric. The chart shows No usage in this range when there is nothing to plot.

The panels below the chart are these.

PanelWhat it shows
Top agentsAdmins only, and only in the global view with no user picked. Ranks up to 10 agents and SDKs read from each request's User-Agent tag, named agents first, with a daily stacked chart of the top 6. Agent metric switches between Tokens (default), Spend and Requests. When less than half of the range's tokens carried a User-Agent, the subtitle says what share was attributed. Each row has a View activity link that switches the page to User Agent Activity filtered to that agent's tags. The empty state is No agent traffic in this range.
Spend by ProviderSpend, Successful, Failed and Tokens per provider, with a total. Show Zero Spend also lists providers that served requests but cost nothing in the range, such as free or unpriced models, and its help icon says so. Off, only providers with spend are listed. Show Unknown includes the unknown provider, which holds requests that failed to route to a provider. Both switches start off. The empty state is No provider usage data.
Top Virtual KeysThe keys with the most spend. Number of top keys to show offers 5 (default), 10, 25 and 50. View switches between Table View (default) and Chart View. The table has Key ID, Key Alias, User (only when some key has a user) and Spend (USD). Click a key ID or a bar to open that key's details in a dialog, which closes with the close button, a click outside or Escape. A key that is no longer in the database (deleted, or a CLI or SSO session key) cannot be opened and says so in a tooltip.
Top Users by SpendThe 10 users with the most spend, with User, Spend and Requests. If the request fails it shows Could not load top users. with a Retry link.
Gateway Requests by EndpointAdmins only, and only when the gateway has per route counts for the range. Successful and failed requests per route.

Model Activity tab​

A search box (Search by model name) filters the list, with a clear button once you type. The toggle beside it switches between Public Model Name (the model group a caller asks for, default) and Spanway Model Name (the individual deployment). When the search matches nothing, the tab says that no models match in this date range.

The tab starts with an Overall Usage summary of Total Requests, Total Successful Requests, Total Tokens and Total Spend, and two charts, Total Tokens Over Time and Total Requests Over Time. Below it every model is a collapsible row sorted by spend, with its spend, request count and average response time. The first row starts open. An open row shows these parts.

PartWhat it shows
Stat stripTotal Requests, Total Successful Requests, Total Tokens (with the average per successful request), Total Spend (with the cost per successful request) and Avg Response Time (with the number of timed successful requests).
Top Virtual Keys by SpendThe keys that spent the most on this model, each with team, user, spend, requests and tokens. It shows Loading top keys... while it loads, and Could not load top keys. with Retry on failure. It is hidden when there are no keys.
ChartsSpend per day, Total Tokens, Requests per day, Avg Response Time per day (only when some request was timed), Success vs Failed Requests and Prompt Caching Metrics (cache read and cache creation tokens).

Key Activity tab​

A four cell strip shows Spend, Requests (with ok and failed counts), Tokens (with input and output) and Avg cost / request (with cache read tokens). Below it the Virtual keys panel lists keys with Key, Spend and Requests. The list loads 50 keys at a time and loads more as you scroll to the bottom.

The search box (Search alias, hash, user ID, or email) filters the loaded keys right away and also asks the gateway for matching keys that are not loaded yet. Opening a key row loads its detail, which uses the same stat strip and charts as an open model row. The tab shows Loading keys..., Could not load keys for this range. with Retry, Could not load more keys. with Retry, Could not search keys. with Retry search, and a message that no keys match your search in this date range.

User Activity tab​

The User activity panel lists users with User, Spend, Requests, Successful, Failed and Total tokens, plus a count of users. It loads 50 users at a time. Click Load more to fetch the next page. The empty state is No user activity in this date range. On failure it shows Could not load users for this range. or Could not load more users., each with Retry.

MCP Server Activity tab​

Uses the same layout as the Model Activity tab, with one collapsible row per MCP server instead of per model. There is no search box, no model name toggle and no top keys panel.

Proxy admins and admin viewers in the global view with no user picked also see three panels below the rows, which MCP usage analytics explains in full.

PanelWhat it shows
MCP active usersHow many people called MCP tools in each of the last 7 days, weeks or months. Active users period picks DAU (default), WAU or MAU, and Active users split picks Server (default), Tool or Client label. Help text under the controls says what the current choice counts.
Tool usageEvery MCP tool called in the date range, with Tool, Server, Calls, Failed, Users, Avg time, Spend and Last used, most called first.
Top agents by MCPThe agents that called each server or tool. Top agents split picks Server (default), Tool or Client label. Split by client label it lists each client app with its calls.

Each panel says Could not load ... when the gateway refuses, and names what is missing when there is nothing to show.

Endpoint Activity tab​

PartWhat it shows
Success vs Failed Requests by EndpointA bar chart of successful and failed requests per endpoint, such as /chat/completions.
Endpoint Usage TrendsDaily requests per endpoint as lines.
EndpointsA table with Endpoint, Successful / Failed, Total Request, Success Rate, Total Tokens and Spend. The empty state is No endpoint usage data.

Spend reports tab​

The whole tab sits behind a license check for the Spend reports feature. While the license is being checked a spinner shows. Without the feature the tab shows Spend reports needs a Spanway Enterprise license, names Spend reports as the missing feature and links to Get a trial license.

A spend report gives the total spend per key over a date range, broken down by model. Days are UTC and both dates are included. The report covers the key you are signed in with, its user, its team or its organization.

ControlTypeWhat it does
Report onDropdownKey, User or Team for everyone. Organization is added for proxy admins, admin viewers and org admins. The default is Team.
<Scope> id (optional)TextThe id of the key, user, team or organization to report on. The help text under it says what an empty value means. Empty means your own key, yourself, your key's team or your key's organization. Admins can paste another key's sha256 hash or enter any user or team id. Org admins can pick only organizations they administer.
From and ToDate fieldsThe range. Both default to the last 30 days ending today.
Run reportButtonRuns the report. It reads Running while the request is out. It is disabled while a date is missing, malformed, the end is before the start, or the dates are more than 366 days apart. The reason shows under the form, for example Pick a start and an end date. or A report covers at most 366 days. Pick a shorter range.

The result reads Total $X across N keys above a table with Key hash (shortened, the full hash in a tooltip), Spend, Input tokens, Output tokens and Models (each model with its spend). When nothing was logged it says no spend was logged for this scope in the range. A request the gateway refuses for licensing shows the license message. Other errors show the gateway's message in red. The gateway returns 403 when a non-admin asks for a key, user or team that is not their own.

The Spend capture rate card sits under the report for proxy admins and admin viewers, and it shows even when the license does not include Spend reports, because the check is free. It compares the OpenAI spend Spanway recorded with OpenAI's own bill for the same UTC days, so you can spot traffic that skipped the gateway. It needs OPENAI_ADMIN_KEY set on the proxy. It has From and To date fields (default the last 30 days) and a Compare with the OpenAI bill button, which reads Comparing while it runs and is disabled for a bad range or a range of 90 days or more (Compare at most 90 days at a time.). The result says what share of the OpenAI bill Spanway recorded, then the recorded and billed amounts. When the share is below the alert threshold it adds that some traffic is likely missing. The card limits a comparison to 90 days, while the API accepts up to 180. When OpenAI billed nothing it says there is no rate to compare. Errors show in red. The gateway allows only proxy admins and admin viewers to call this check.

Errors tab​

Admins only. When a user is picked in the user filter, the tab shows Errors are deployment-wide and asks you to clear the user filter in Global Usage, because error counts have no per user split.

PartWhat it shows
Stat cardsError rate (with failed of total requests), Failed requests, Client errors (4xx), Server errors (5xx), Rate limited (429) and Auth failures (401/403).
Error rate over timeFailed requests as a share of all requests per day. Show switches between Total (default) and By status code.
Failed requests by status codeFailed requests per day stacked by HTTP status, with a legend of the codes.
By status codeEach status code with its name, count and share of all failed requests.
Failures by identityKeys, teams, users or models ranked by failed requests. Group by picks Virtual keys (default), Teams, Users or Models. Columns are the identity, Requests, Failed, Error rate and Top status. The Inspect failed requests in Logs button opens the Logs page.

Panels with nothing to show say No requests in this range or No failed requests in this range. When the gateway does not answer, the tab shows Error activity could not be loaded and asks you to reload.

Ask AI panel​

Ask AI is shown only to proxy admins, because the gateway answers only them: admin viewers get a 403 and other roles a 401. It opens a side panel titled Ask AI that answers questions about spend, models, keys and trends across the whole gateway. The model dropdown is optional. Its placeholder says the default is gpt-4o-mini, which is the model the gateway uses when none is picked, and the list comes from the model hub, so a model group name is answered through the router with its own deployment and credentials. Type in the box (Ask about your usage...) and press Enter to send, or Shift and Enter for a new line. The send button is disabled while the box is empty or a reply is streaming. The panel shows the tools the assistant calls as it works. Clear chat empties the conversation and is disabled when there is nothing to clear. The close button stops a reply that is still streaming. The last 20 messages are sent with each question. When something fails after the reply started, the panel shows An internal error occurred. Please try again. and the gateway logs AI usage chat failed: <reason> at ERROR.

Export Data dialog​

Export Data opens Export Usage Data. The top line shows the date range of the page. Export type offers Day-by-day breakdown by user, Day-by-day breakdown by user and key and Day-by-day by user and model. Format offers a CSV option for spreadsheet apps (default) and JSON (includes metadata). The export button reads Export CSV or Export JSON and changes to Exporting... while the file is built. On success the file downloads, a toast confirms it and the dialog closes. On failure a toast says Failed to export data. Cancel closes the dialog.

Organization, Team, Customer, Tag, Agent and User Usage​

These views share one layout built for the chosen entity type.

Filter and export bar​

ControlTypeWhat it does
Filter by teamTeam picker, placeholder Search teams by alias...Team view. Narrows the view to the picked teams.
Filter by userUser pickerUser view. Narrows the view to one user.
Filter by <entity>Multi select, placeholder Select <entity> to filter...Organization, customer, tag and agent views. Narrows the view to the picked entities. When the range has no entities it reads No <entity>s with usage in this range and is disabled until any old selection is cleared. A clear button appears once something is picked.
Export DataButtonOpens Export <Entity> Usage with the same type and format choices as the global export, plus Day-by-day breakdown by <entity> and user for every entity except users. The top line also counts the active filters.

The Tag Usage view starts with a notice, Reusable credentials are automatically tracked as tags, explaining that a reusable credential shows up as a tag that starts with Credential: . Its close button hides the notice until the page reloads.

Tabs​

TabNotes
CostSelected by default.
Model ActivityNamed Request / Token Consumption in the agent view.
Agent ActivityTeam view only, for admins. One collapsible row per agent.
Key ActivitySame as the global Key Activity tab, scoped to the entity.
Endpoint ActivitySame as the global Endpoint Activity tab, scoped to the entity.

Cost tab​

The <Entity> Spend Overview strip shows Total Spend, Total Requests, Successful Requests, Failed Requests and Total Tokens. In the team view, when a team has reserved capacity billed per hour, the first tile becomes Total Cost with an info tooltip. Click it or press Enter on it to show two more tiles, Request Cost (usage priced per token) and Flat Cost (reserved provisioned throughput, reported only and never counted against team, key, user or organization budgets).

PanelWhat it shows
<Metric> by model chartA daily or weekly stack of the top 8 models with the same Metric, Bucket size and Scale controls as the Overview tab, and a ranking under it. It reads by deployment when the model toggle is on Spanway Model Name. In the team view a flat cost series is stacked on top when the metric is spend.
Spend Per <Entity>A table of the entity with Share, Spend, Successful, Failed and Tokens, only for entities with spend. The Track cost per <entity> link opens the spend tracking docs. The empty state is No <entity> spend data.
Spend Per User Within TeamTeam view only. Team, User, Spend, Requests, Successful, Failed and Tokens for every team you can see, or the teams in the filter. The UI session team is left out. The empty state is No user spend in this range.
Top Virtual KeysAs on the Overview tab. The tag view adds a Tags column with a toggle to show all tags of a key.
Top Public Model NamesNamed Top Spanway Models with the other toggle value, and Top Agents in the agent view. Number of models to show offers 5 (default), 10, 25 and 50, and a view switch offers Table View and Chart View. Columns are Model, Spend (USD), Successful, Failed and Tokens.
Top Agents Driving SpendTeam view only, for admins. The agents with the most spend across the range.
Provider UsageSpend per provider.

User Agent Activity​

The Summary by User Agent panel shows up to four user agents with Success Requests, Total Tokens and Total Cost, and fills empty slots with No Data. Filter by User Agents (placeholder All User Agents) narrows the page to the picked agents and has a clear button. When you arrive from View activity on the Top agents panel, the filter starts with that agent's tags.

The second panel switches with Activity view between Active users (default) and Per user. Active users shows DAU, WAU & MAU per Agent, and Active users period picks DAU (last 7 days), WAU (last 7 weeks) or MAU (last 7 months). Per user shows Per User Usage (Last 30 Days) with a table of User ID, User Email, User Agent, Success Generations, Total Tokens, Failed Requests and Total Cost, and a User Usage Distribution chart of users by successful request count.

Legacy Usage page​

The previous Usage page is still reachable at /ui/old-usage. It is not in the left nav. The old link /ui?page=usage redirects to it. A banner at the top says The old Usage page is on a draft deprecation list, with a Spanway support link and a close button.

The page opens only for proxy admins and admin viewers. Everyone else sees a Usage card that says proxy-wide usage is only available to admin users and points to the Usage page. When the gateway has DISABLE_EXPENSIVE_DB_QUERIES set because the spend log table is too large, the page shows Database Query Limit Reached with the row count and a View Usage Guide button instead of charts.

TabWhat it shows
All Up, sub tab CostThis month's project spend, Monthly Spend, Top Virtual Keys, Top Models and Spend by Provider (with Provider and Spend).
All Up, sub tab ActivityRequests and tokens per day for the whole gateway, then the same two charts for each model.
Team Based UsageTotal Spend Per Team and Daily Spend Per Team.
Customer UsageA date range picker, a Select Key dropdown and a table of Customer, Spend and Total Events.
Tag Based UsageA date range picker, a tag picker (Select tags, default All Tags) and Spend Per Tag. Without an Enterprise license each tag is listed as an Enterprise only feature and cannot be picked.

The Select Key dropdown only ever lists All Keys on this page, and picking a value does not change the table.

Errors​

StateWhat you seeWhat to do
Spend data fails to loadA red banner says fetching spend data failed, so the totals may be empty rather than final. The entity views show the same banner, and a second one when agent data fails in the team view.Reload the page.
No traffic in the rangeCharts are empty and lists say no usage, no user activity, no keys or no provider data in this date range.Widen the date range.
A panel fails on its ownTop users, top keys, key lists and user lists show a short message with Retry or Retry search.Click the retry link.
Errors tab with a user pickedErrors are deployment-wide.Clear the user filter.
Errors tab failsError activity could not be loaded.Reload the page.
Spend reports without the licenseSpend reports needs a Spanway Enterprise license with the missing feature named.Add a license that includes Spend reports.
Disabled buttonsRun report and Compare with the OpenAI bill stay disabled for a missing or bad range, a range that is too long, or while a request is running. The date picker's Apply stays disabled until both dates are valid. Clear chat is disabled with no messages.Fix the range or wait for the request.
Ask AI shows An internal error occurred. Please try again.The model call or a usage lookup failed.Pick another model, or read AI usage chat failed in the gateway log.
A key cannot be openedThe Key ID is plain text with a tooltip saying the key is no longer in the database.None. The key was deleted or was a session key.

Logs​

The Usage page writes nothing to the gateway log while it works. When a chart, export or Ask AI answer fails, the gateway logs one line that a gateway admin can read.

LevelLineMeaningAction
ERRORDaily activity aggregation failed: <reason>, Daily activity key page failed: <reason> or Daily activity export failed: <reason>A chart, key list or Export failed and the page showed its error banner or Retry.Read the reason, usually the database.
ERRORAI usage chat failed: <reason>An Ask AI answer failed.Read the reason, usually the model or its credentials.
ERRORTool <name> failed: <reason>One usage lookup behind Ask AI failed.Check the database.

The full list is in the log reference.

Differences by role and license​

RoleWhat changes
Admin (proxy admin)Every view and tab. The global view covers every user and has the user filter, request counts from the gateway request table, Top agents, Gateway Requests by Endpoint and the Errors tab.
Admin ViewerThe same views and data as Admin, because the page treats the Admin Viewer session role as an admin role. The page has no write actions.
Org adminThe nav item is hidden. At the URL the global view is labelled Your Usage and covers only their own usage, without the Errors tab. They get Organization Usage for organizations they administer and Team Usage. They also get Organization in Spend reports.
Internal User and Internal ViewerYour Usage, Team Usage and Tag Usage. All data is limited to their own user by the gateway. No Errors tab, no Top agents and no gateway request counts.
enabled_ui_pages_internal_usersWhen set, non-admin roles see the nav item only if new_usage is listed.

The Spend reports tab needs a license that includes Spend reports. The gateway enforces the license on the report routes too. If the license state cannot be read, the tab shows "Spend reports is hidden until the license can be checked" instead of the report form. The Spend capture rate card is shown only to proxy admins and admin viewers, with or without the Spend reports license, matching the gateway, which lets only those roles read any scope and call the capture rate check. The Organization scope is shown to those roles and to org admins, who can report only on organizations they administer. The legacy page needs no license except for picking single tags.