API Reference
Log In
API Reference

Provider billing chart

Returns provider billing data shaped as chart series, so you can plot spend and usage
over time or compare them across providers, models, API keys and people. Choose a
metric, a dimension and a mode.

metric: totalCost | inputCost | outputCost | cacheReadCost | cacheWriteCost
| requestCount | tokenCount | inputTokens | outputTokens
| uncachedInputTokens | cacheReadTokens | cacheWriteTokens

In aggregate mode metric also accepts a comma-separated list, and the response then
carries one series per metric. Time mode takes a single metric, because each series
there is named after its dimension value.

inputTokens is uncached plus cached input tokens. uncachedInputTokens,
cacheReadTokens, cacheWriteTokens and outputTokens split tokenCount without
overlapping.

dimension: none | provider | model | workspace | apiKey | usageType | serviceTier
| apiKeyModel | subscriber

  • none: a single series named Total.
  • provider: one series per provider.
  • model: one series per model.
  • workspace: one series per workspace. The key is the workspace name, or its id when it has no name.
  • apiKey: one series per API key. The key is the API key name, or its id when it has no name.
  • usageType: one series per usage type.
  • serviceTier: one series per billing category the provider itself uses. For Cursor that is seat-included against usage-based.
  • apiKeyModel: one series per API key and model. The key is the API key id and the model name joined by the character U+001F, so you can split it without relying on a key name that can be renamed.
  • subscriber: one series per person. The key is the address the provider attributed the spend to, or the handle the provider names the person by when there is no address. Spend that belongs to nobody is grouped under (no person). One person is one key across every provider in the range, so a developer billed by two providers appears once, with their spend summed. This dimension works with cost metrics only, because usage is stored without a person. Asking for it with any other metric returns a 400.

mode: time (one series per dimension value over date buckets) | aggregate (one series per metric, one point per dimension value)
grain: day | week | month (time mode only)

Each response holds at most the 500 largest dimension keys, ranked by the metric named
first in metric. Every series in the response carries that same set of keys, so you
can join metrics by key. totalKeys reports the number of distinct keys before the
cap and truncated says whether the cap was applied, so a partial result is never
mistaken for a complete one.

To scope the chart to a single API key, pass the apiKey filter. Filtering the series
yourself after the request can give wrong results, because only the 500 largest keys
are returned.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Query Params
string
enum
required

Time period for analytics

Allowed:
string

Filter start date/time in ISO 8601 format.

string

Filter end date/time in ISO 8601 format.

string
enum

Filter results by AI provider. Omit to include all providers.

string
enum

Filter by usage type. Omit to include all types.

Allowed:
string

Narrow results to a single API key id within the caller's organization, matched exactly. Honoured by /billing/chart, /billing/models, /billing/api-keys and /billing/users; other billing endpoints ignore it. On those four, rows and totals cover only charges stored under that id, so a value that matches no stored charge returns a zero total, never the organization total.

number
≥ 0

Filter by a starting cost (inclusive).

number
≥ 0

Filter by an ending cost (inclusive).

string
Defaults to totalCost

Metric to plot: totalCost, inputCost, outputCost, cacheReadCost, cacheWriteCost, requestCount, tokenCount, inputTokens, outputTokens, uncachedInputTokens, cacheReadTokens or cacheWriteTokens. In aggregate mode this also accepts a comma-separated list, and the response carries one series per metric.

string
Defaults to none

Dimension each series is keyed by: none, provider, model, workspace, apiKey, usageType, serviceTier, apiKeyModel or subscriber. apiKeyModel is keyed as the API key id and the model name joined by the character U+001F. serviceTier keys the provider's own billing category; for Cursor that is seat-included against usage-based. subscriber keys by the person the provider attributed the spend to, and works with cost metrics only.

string
Defaults to time

time gives one series per dimension value over date buckets; aggregate gives one series per metric, one point per dimension value.

string
Defaults to day

Date bucket size: day, week or month. Applies to time mode only.

Headers
string
enum
Defaults to application/json

Generated from available response content types

Allowed:
Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
application/hal+json
*/*