Skip to main content
Every LLM call and API request costs money. Output tracks costs automatically from your trace files, so you can see exactly what a workflow run costs before it ever hits production.

Quick start

Make sure tracing is enabled, run a workflow, then check what it cost:
That’s it. The command reads the trace, looks up pricing for every LLM call and API request, and prints a breakdown:
Use --verbose for a per-call breakdown showing individual steps, token counts, and usage details:
You can also point at a specific trace file:

How it works

The cost calculator walks the trace tree and extracts two kinds of billable events:
  1. LLM calls — Reads the model from the loaded prompt config and the token usage (input, output, cached, reasoning). Multiplies each by the model’s per-million-token price.
  2. HTTP calls — Matches the request URL against known service patterns in the pricing config. Calculates cost from token usage, API units, per-request pricing, or a cost field in the response body, depending on the service type.
Failed HTTP calls (status >= 400) are excluded — most APIs don’t charge for errors.

Pricing configuration

Output ships with built-in pricing for common LLM models (Anthropic, OpenAI, Google, Perplexity) and API services (Jina, Tavily, Semrush, Exa, DataForSEO). For most workflows, this works out of the box. To add or override pricing, create config/costs.yml in your project root:
The CLI loads the built-in config first, then merges your file on top. You only need to include entries you want to add or change.

Model pricing

Each entry under models maps a model identifier to its per-million-token prices:
costs.yml
Model names are matched by exact key first, then by prefix — claude-sonnet-4 matches both claude-sonnet-4 and claude-sonnet-4-20250514.

Service pricing

Each entry under services defines how to calculate cost for HTTP calls to a specific API. The url_pattern field matches against the request URL, and the type determines the calculation method. Four pricing types are supported:

token — Price per million tokens

For APIs that report token usage in their response (like Jina Reader):
costs.yml
For APIs with separate input/output token counts:
costs.yml

unit — Price per API unit

For APIs that charge by units (like Semrush):
costs.yml

request — Fixed price per request

For APIs with simple per-request pricing (like Tavily):
costs.yml

response_cost — Cost reported in response

For APIs that return the actual cost in their response (like Exa):
costs.yml

Service config reference

Unknown models

When the calculator encounters a model that isn’t in the pricing config, it reports the cost as $0 and prints a warning:
Add the model to your project’s config/costs.yml to include it in future calculations.

CLI reference

See output workflow cost for the full command reference.