Cost Intelligence
Compare model cost, inspect routing decisions, and identify which infrastructure path carried each request — at the trace level, not from a separate billing dashboard.
Cost, latency, and routing behavior are tied back to the exact request that caused them — not estimated from provider dashboards.
What To Look At
The most useful cost fields live in the trace summary returned by
GET /api/v1/traces/{trace_id}.
{
"summary": {
"total_cost": 0.0028,
"revenue": 0.12,
"gross_margin": 0.1172,
"by_model": {
"standard-model": 0.0028
},
"by_infrastructure": {
"public_cloud": 0.0028,
"private": 0
},
"latency_p50": 640,
"latency_p95": 910,
"latency_p99": 1045
},
"optimization_grade": 88,
"tool_fidelity_score": 96,
"shadow_score": 84
}
| Field | Why it matters |
|---|---|
summary.total_cost | The total cost for the completed trace. |
summary.gross_margin | Helpful when you want to compare cost against revenue in the same view. |
summary.by_model | Shows where spend came from when a trace used multiple models or steps. |
summary.by_infrastructure | Splits cost between public cloud and private paths. |
latency_p50 / p95 / p99 | Helps compare model choices and detect slow routing paths. |
optimization_grade | A coarse optimization signal from the trace. |
shadow_score | A comparison signal for how a replay or alternate route behaved. |
Common Questions
Which model is expensive?
Look at summary.by_model on completed traces. If a single model dominates the
cost, you can compare it against a replay or alternate route before changing
production traffic.
Which path actually executed?
Use summary.by_infrastructure and distribution.replay_execution_mode to see
whether the work ran in the public cloud or in a private path.
How do I compare two runs?
Create a trace, complete it, then replay it after changing the model or routing policy. Compare the summary fields and the routing decision rather than reading provider logs in isolation.
olyx trace --metadata '{"source":"checkout-worker","feature":"refund-assistant"}'
olyx replay trace_01J6AF...
Recommended Workflow
- Create a trace for the request you care about.
- Complete the trace after the local work finishes.
- Inspect
summary.total_cost,by_model, andby_infrastructure. - Replay the trace after you change model routing or policy.
- Compare the new summary against the previous one.
Cost, latency, and routing behavior are tied back to the exact request that caused them — not estimated from provider dashboards.
For the evidence trail around those same decisions, see Governance.