Cost Traces is on the roadmap and not yet available. Today you can already
attach a
_cost to every event you ingest — see
Cost Events. Traces will group those
events automatically once shipped.Why trace-level costs
Per-event costs are precise but granular. To reason about margin, you usually want the cost of a unit of work — an agent task, a chat conversation, a checkout flow — not each underlying token call. Cost Traces will let you:- Group events into sessions using a trace key you control (a conversation ID, a job ID, an agent run ID).
- See the fully-loaded cost of each session: model spend, tool calls, and retries rolled into one number.
- Compare cost to value. Pair a session’s cost (COGS) with the revenue or agentic outcome it produced to get true per-run margin.
How it will work
The model is intentionally simple: tag the events that belong together, and Macropay aggregates them into a trace.1
Add a trace key to your events
Include a stable identifier in event metadata so Macropay knows which events
share a session.
2
Ingest events as usual
Keep emitting cost events the same way
you do today — no separate API.
3
Query the trace
Retrieve the aggregated cost for a session, or analyze traces in the
Dashboard alongside your other metrics.
Example: costing one agent run
Imagine a support agent that resolves a ticket across several model calls and a knowledge-base lookup. Tag each event with the same_trace so they roll up into one session:
TypeScript (SDK)
ticket_7841 — total cost $0.0061 — instead of three disconnected line items.
cURL
Where it fits
Cost Traces is the session layer on top of Cost Events. Costs still ride along in event metadata; traces just give them shape. And because Macropay is your merchant of record — remitting sales tax and VAT worldwide so you don’t carry that liability — the cost numbers you see here are your real cost of goods, cleanly separated from the tax and fees we handle on your behalf.Cost Events
Attach a
_cost to any event you ingest — the foundation traces build onCost Metrics
Query costs, profits, and customer lifetime value across your account