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
}
FieldWhy it matters
summary.total_costThe total cost for the completed trace.
summary.gross_marginHelpful when you want to compare cost against revenue in the same view.
summary.by_modelShows where spend came from when a trace used multiple models or steps.
summary.by_infrastructureSplits cost between public cloud and private paths.
latency_p50 / p95 / p99Helps compare model choices and detect slow routing paths.
optimization_gradeA coarse optimization signal from the trace.
shadow_scoreA 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...
  1. Create a trace for the request you care about.
  2. Complete the trace after the local work finishes.
  3. Inspect summary.total_cost, by_model, and by_infrastructure.
  4. Replay the trace after you change model routing or policy.
  5. 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.

Was this page helpful?