Docs/Aigovernance/Aicost/Cost Tracking

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 traceHow to set it (Python SDK)Where the cost shows up
Trace name (agent or use case)update_trace(name=...) or the root span nameCost Dashboard Top 20 Use Cases (Trace) by Cost, P 95 Cost per Trace; AI Optimizer agents
Modelmodel= on the generationCost by Model Name, Model costs
Userupdate_trace(user_id=...)Top 20 Users by Cost, User consumption, Gauge AI → Users
Sessionupdate_trace(session_id=...)Sessions, dashboard filter Session
EnvironmentAntsPlatform(environment=...) or ANTS_PLATFORM_TRACING_ENVIRONMENTCost by Environment, Environment filter
Tagsupdate_trace(tags=[...])Tags filter on every dashboard
Metadataupdate_trace(metadata={...})Metadata filter on every dashboard
Budget AI keySet automatically for gateway trafficCost 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

© 2026 ANTS Platform, Inc.Docs v1.0 · Last updated June 2026