
# Spend and usage

See what each workspace, key, person or model spent this month, and which models, providers and keys account for your traffic.

**Dashboard**

1. Choose a workspace at the top of the sidebar, or **All workspaces** for every workspace.
2. Open **Spend & budgets** and choose the month.
3. Group the rows by **Key**, **Person** or **Model**, or by workspace with **All workspaces**.
4. Choose **Export CSV** to download the report.

The page shows what was spent this month, the change from last month, what the month is on pace for and the spend per day, with a row for each key, person or model and the budgets that apply below.

You need: a role that can read spend, such as an organisation Owner, Admin or Viewer, or a Workspace admin or Workspace viewer.

**HTTP API**

```bash
curl -sS "$TOKEDEX_URL/control/v1/workspaces/<workspace-id>/spend-report?groupBy=key&period=2026-11" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
```

```json
{
  "object": "spend_report",
  "period": "2026-11",
  "groupBy": "key",
  "data": [
    { "kind": "line", "name": "research-app", "keyId": "01M7V8Z2…", "calls": 66, "inputTokens": 924, "outputTokens": 132, "costUsd": "0.000158", "previousCostUsd": null, "daily": ["0.000000", "…", "0.000158"] }
  ],
  "total": { "calls": 66, "costUsd": "0.000158" },
  "projectedCostUsd": "0.000249",
  "coverage": { "calls": 66, "pricedCalls": 66, "unpricedCalls": 0, "estimatedCalls": 0 }
}
```

You need: an admin key that can read spend, such as one with the `finance` or `viewer` preset, in `TOKEDEX_ADMIN_KEY`, and `export TOKEDEX_URL='http://127.0.0.1:4000'`.

`groupBy` is `key` (the default), `person` or `model`. `period` is a month as `YYYY-MM`, the current one by default. `GET /control/v1/workspaces/spend-report` reports every workspace you can read, grouped by `workspace` by default. Add `format=csv` for a CSV file.

## Choose a view

| To find out | Open |
| --- | --- |
| What a workspace, key, person or model spent in a month, against its budget | **Spend & budgets** |
| Which models, providers, keys or tags account for calls, tokens and cost over a time range | **Usage** |
| What a model costs, or to set its price | **Pricing**, and [Prices](#prices) below |
| Why one request failed or what a session cost | [Find and inspect a request](/gateway/requests-and-sessions) |
| Who changed gateway configuration or access | **Audit log** |

Start with the spend report for what a month cost and how it compares with budgets, then use **Usage** to find which model, provider, tag or project drove it. Report totals from the spend report, because **Usage** leaves out requests the gateway did not record or no longer keeps.

## Read the spend report

Months are calendar months in UTC. Every grouping adds up to the same total; spend the rows do not cover, such as **Playground** keys or removed keys, is one row of its own. The spend report goes back 13 months, so export each month's report as CSV if you need it longer. Group by key first, since each application has its own key, and by model when you are deciding whether a cheaper model would serve.

A Developer's spend report and usage cover their own keys. Organisation totals, and each workspace's spend beside its budget, need a role that reads every workspace: organisation Owner, Admin or Viewer.

When some costs are unknown or estimated, the report says how many calls have a known cost. A call to a model with no price counts as $0 until someone [sets one](#prices), and a call that ends without a usage report, such as a cancelled request, is charged a conservative estimate. Check that count before you rely on a total, and set a price for each model that has none, since its calls otherwise count as nothing.

**HTTP API**

`coverage` counts the calls with no price in `unpricedCalls` and the estimated ones in `estimatedCalls`.

Amounts are the gateway's calculation from reported usage and its prices, so reconcile them with your provider's invoice. The report reads the gateway's spend records, which are kept apart from traces, so it stays complete when request recording is off.

## Prices

A price belongs to one provider's model, in US dollars per million tokens. It is the catalogue price that ships with the gateway release, which changes only when you upgrade; a price set on this gateway, which wins over the catalogue's; or the price of [your own model server](/gateway/custom-models), set with it.

**Dashboard**

1. Open **Pricing**, find the model and provider, and choose **Set price** on its row.
2. Enter **Input ($ per 1M tokens)** and **Output ($ per 1M tokens)**. Under **Prompt caching (optional)**, enter **Cache read**, **Cache write** and **Cache write, 1 hour** where the provider prices them apart; the drawer starts with the model's current rates. Add a **Note (optional)** such as where the price comes from.
3. Choose **Save price**.

**Price from** on the row now reads **Your price**, and the rates apply from the next request. **Mark as free** makes the model's calls cost nothing, for a model you do not pay per token for, and **Use the default** goes back to the catalogue price. Each needs an organisation Owner or Admin.

**HTTP API**

Pricing overrides use the provider's native model ID, not the public `maker/model` selector sent to inference endpoints. The provider and native model together identify the price being overridden.

```bash
curl -sS "$TOKEDEX_URL/control/v1/pricing/overrides" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model": "gpt-6-luna",
    "price": { "input": "0.08", "output": "0.40" },
    "note": "Negotiated rate"
  }'
```

The gateway answers `201` with the `price_override`, and the rates apply from the next request. `price` also takes `cachedInput` (a cache read), `cacheWrite` and `cacheWriteLong` (a cache write kept for an hour). This needs an admin key with the `admin` preset. Send `"free": true` in place of `price` to make the model's calls cost nothing, for a model you do not pay per token for. `DELETE /control/v1/pricing/overrides/openai:gpt-6-luna` goes back to the catalogue price, and `GET /control/v1/pricing` lists each model's `price` and its `source`: `catalogue`, `override`, `deployment`, or `null` when no price is known.

Your price replaces the whole catalogue price: a cache read or write rate you leave out is charged at the input rate (an hour-long write at the cache write rate), and tool-call rates you leave out are no longer charged. Spend already recorded keeps the price it was charged at, except calls made with no price: you can [price those](#price-calls-made-with-no-price) once their model has one. Set a price only where your rate differs from the catalogue's, such as a negotiated rate, since it drops the rates you leave out, and record its source in the note so others can check it.

After an upgrade, check your prices against the new catalogue, because yours keeps winning when the catalogue's changes.

When you add a [model from a provider](/gateway/custom-models#a-model-a-catalogue-provider-serves), set rates or mark it free. The price declared on that model takes precedence over an override for its provider model ID.

While a budget that refuses unknown prices (the default) applies to a key, the key's requests to a model with no price are refused with `403` `price_unavailable` until you set a price or mark it free.

**Dashboard**

A banner on **Pricing** says how many models have no price.

## Price calls made with no price

A model with no price can serve keys whose budgets permit unpriced calls. This includes existing models from a provider that have no price. The gateway records their usage with no cost. Once a price covers the model, apply it to those calls to add their cost to the day, week and month they were made. Budgets, spend reports and traces count that cost.

- A call is priced once. A call that already had a price keeps it, and a later price change moves nothing already priced.
- A call that ended without a usage report is priced from its estimate, and counts as estimated.
- Calls with no price are kept for 400 days, as long as the daily spend they land in.
- A budget whose period has ended does not alert again for cost added to it. Spend added to the current period counts toward its thresholds as usual.

**Dashboard**

**Alerts** lists each model that is serving calls with no price, and the sidebar's Alerts count includes them, for an Owner or Admin. Each stays until a price covers the model.

1. Open **Pricing**. **Calls with no price** lists each model's calls, tokens, and first and last call.
2. Choose **Set price** on its row, enter the rates, and keep **Also price the earlier calls with no price** ticked. The drawer uses the rate for one-hour cache writes when the usage records them. Cache writes without a recorded duration use the ordinary cache write rate.
3. Choose **Save price**. The page says how many calls were priced and what they added to spend.

A model that already has a price, set after its calls were made, shows **Price these calls** instead. It says what they will cost before it charges them. The details of a [model from a provider](/gateway/custom-models#a-model-a-catalogue-provider-serves) also count its calls with no price, and setting its own price there can charge them too.

**HTTP API**

`GET /control/v1/pricing/unpriced` lists the calls by provider model ID, with `calls`, `usage`, `firstSeenAt`, `lastSeenAt`, the gateway `models` that served them, and the `price` that covers them now, or `null`. In `usage`, `cacheCreationLongInputTokens` counts the subset of `cacheCreationInputTokens` known to have a cache duration of at least one hour. Add `?since=<ISO time>` to list only later calls.

Send `"applyToUnpriced": true` with an override to price the model's calls with it:

```bash
curl -sS "$TOKEDEX_URL/control/v1/pricing/overrides" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "fireworks",
    "model": "accounts/fireworks/models/new-model",
    "price": { "input": "0.60", "output": "2.50" },
    "applyToUnpriced": true
  }'
```

The reply adds `repriced`: the `calls` priced, the `estimatedCalls` among them, the `unpricedCalls` still with no price, the `cost` added and the `workspaceIds` it was added to. To use an existing price, send `{ "provider", "model" }` to `POST /control/v1/pricing/unpriced/reprice`, with `"dryRun": true` to preview the charge. Both preview and apply return `400` when earlier unpriced calls exist and no price covers any of them. Once all calls are priced, both return zero calls and zero cost. Each needs an admin key with the `admin` preset, and each pricing is an audited `price_override.reprice` change.

With the CLI: `tdx pricing unpriced list [--since 30d]`, `tdx pricing unpriced price --provider <id> --model <provider-model-id> [--preview]`, and `--apply-to-unpriced` on `tdx pricing overrides set` and `edit`.

## Explore usage

**Dashboard**

1. Open **Usage** and choose a time range, from **1 hour** to **All time**.
2. Group by **Model alias**, **Model**, **Provider**, **Key**, **Tag**, **Project**, **Person** or **Workspace**.
3. Choose a row to see its calls, tokens and cost, and open its requests.

**Refresh** shows a request you just sent, and **Export** downloads the table. **Refused** counts the requests the gateway refused in the range, or in the last 30 days with **All time**.

**HTTP API**

```bash
curl -sS "$TOKEDEX_URL/observability/v1/usage?groupBy=model&since=2026-11-01T00:00:00Z" \
  -H "Authorization: Bearer $TOKEDEX_ADMIN_KEY"
```

```json
{
  "object": "list",
  "data": [{ "name": "openai/gpt-6-luna", "calls": 66, "inputTokens": 924, "cachedInputTokens": 0, "outputTokens": 132, "reasoningOutputTokens": 0, "totalTokens": 1056, "costUsd": 0.0001584 }],
  "groupBy": "model",
  "summary": { "calls": 66, "totalTokens": 1056, "costUsd": 0.0001584 }
}
```

This needs an admin key that can read usage, such as one with the `viewer`, `finance` or `operator` preset. `groupBy` is required: `model`, `provider`, `key`, `agent`, `tag`, `project`, `user` or `workspace`. `since` and `until` take ISO times; `workspaceId`, `keyId`, `model`, `provider` and `tag` filter the rows, and `format=csv` returns a CSV file.

Input tokens include cached input and cache writes, and output tokens include reasoning tokens, so do not add those columns together.

## Spend and usage differences

**Usage** covers the requests the gateway recorded and still keeps, over any time range. The spend report counts every priced call by calendar month, whether or not it was recorded. For monthly accounting and budgets, use the spend report. What the gateway records, and for how long, is on [What the gateway records](/gateway/recording-and-retention).

Next: [Budgets](/gateway/budgets), [Budget alerts](/gateway/budget-alerts) or [Your own model server](/gateway/custom-models).
