Cost Tracking
ANTS Platform tracks the cost of every LLM call it receives as a generation. You attribute that cost by putting the right attributes on your traces; the dashboards do the rest.
Cost is calculated at ingestion from usage and your model prices. A generation without a model name, without usage, or with a model that has no price definition shows no cost.
What is costed
- Generations: LLM calls, priced per usage type (for example input and output tokens).
- Traces: the sum of their generations.
- Budget AI gateway requests: recorded as traces with cost, priced from the same catalog. See Budget AI.
The platform tracks model usage cost only. It does not include your infrastructure, vector database or storage bills.
Attributing cost
| Attribute on the trace | How to set it (Python SDK) | Where the cost shows up |
|---|---|---|
| Trace name (agent or use case) | update_trace(name=...) or the root span name | Cost Dashboard Top 20 Use Cases (Trace) by Cost, P 95 Cost per Trace; AI Optimizer agents |
| Model | model= on the generation | Cost by Model Name, Model costs |
| User | update_trace(user_id=...) | Top 20 Users by Cost, User consumption, Gauge AI → Users |
| Session | update_trace(session_id=...) | Sessions, dashboard filter Session |
| Environment | AntsPlatform(environment=...) or ANTS_PLATFORM_TRACING_ENVIRONMENT | Cost by Environment, Environment filter |
| Tags | update_trace(tags=[...]) | Tags filter on every dashboard |
| Metadata | update_trace(metadata={...}) | Metadata filter on every dashboard |
| Budget AI key | Set automatically for gateway traffic | Cost by Gateway Key, Gateway key filter |
To report spend per team, cost center or customer, put that value in tags or metadata and filter by it, or clone the Cost Dashboard and add a widget grouped by it. See Custom Dashboards.
Viewing cost
- Gauge AI → Cost Dashboard: total spend over time and breakdowns by model, user, trace name, environment and gateway key. See Cost & Latency Dashboards.
- Gauge AI → Cost Performance Metrics: cost and tokens per model next to quality scores. See Cost & Performance Metrics.
- A single trace: open it in Discover AI → Tracing to see the cost of each generation.
For programmatic access, the public Metrics API returns totalCost and totalTokens grouped by the same dimensions. See the API Reference.
Next steps
- Token Monitoring: token usage behind the cost.
- Models & Pricing: make sure every model is priced.
- AI Optimizer: reduce cost for a specific agent.