# Cost & tokens

Sum or average AI cost and token consumption by token type, model, and action, down to a single function.

<CostChart />

**Path:** Analytics → Event Explorer

Track what your AI-Native agents spend and consume, down to the specific action being performed, so you can attribute, analyze, and budget. Cost and token metrics work by **aggregating** the numeric properties on an event rather than counting occurrences.

:::note
This report is currently in beta.
:::

## What you can aggregate

Pick any of these numeric properties and **Sum** them (total) or **Average** them (per event):

| Property | Measures |
| :--- | :--- |
| **Estimated cost** / **Action call estimated cost** | Money spent, overall or per action call. |
| **Input tokens** | Input tokens for the event (delta), from the AI provider API. |
| **Output tokens** | Output tokens generated. |
| **Cached tokens** | Tokens served from cache. |
| **Thoughts tokens** | Reasoning / thinking tokens. |
| **Total tokens** | Input + output + everything, per event. |
| **Action instructions tokens** | Tokens spent on the action's instructions. |

## Build a cost report

1. In **Events or Metrics**, select the event **Action Called** (it fires every time the agent performs a distinct task).

2. Under the event name, open the counting dropdown (**Unique** / **Total Events**) and choose **Aggregate Property**, then pick the property — **Estimated cost** for spend, or a token type like **Input tokens** — and select **Sum** (total) or **Average** (per event). The metric label reads, for example, `Sum of Estimated cost`.

3. In **Breakdown**, select **Action key** to split the total into one segment per action. Break down by **AI provider LLM model name** or **LLM provider** instead to compare models.

4. Set **Chart Type** to **Stacked Bar** and the **time range** to 7D or 30D.

## Read it

- **Stacked bar chart** — each bar is the total for that day; colored segments are the contribution of each action (or model). A large segment flags the main cost or token driver that day.
- **Data table** — below the chart: **Total** (cumulative over the range), **Average** (typical per day), and the daily breakdown per action.

:::tip
If one action (say `search_knowledge`) is too expensive, optimize its prompt tokens or cache results. Aggregate **Cached tokens** to confirm caching is working.
:::

## Related

- [Action response tokens](/user-guides/analytics/action-response-tokens/): measure the token size of what actions return to the agent (the tool-result payload).
- [Events & metrics](/user-guides/analytics/events-metrics/) and [Properties & filters](/user-guides/analytics/properties-filters/): the events and numeric properties behind these metrics.
- [Actions](/user-guides/analytics/actions/): how often each action runs (the volume behind the cost).
- [Token Quotas](/user-guides/quotas/): cap the spend these metrics report.
