Quick start
Make sure tracing is enabled, run a workflow, then check what it cost:--verbose for a per-call breakdown showing individual steps, token counts, and usage details:
How it works
The cost calculator walks the trace tree and extracts two kinds of billable events:- 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.
- 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.
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, createconfig/costs.yml in your project root:
Model pricing
Each entry undermodels maps a model identifier to its per-million-token prices:
costs.yml
| Field | Required | Description |
|---|---|---|
provider | Yes | Provider name (informational) |
input | Yes | Price per 1M input tokens |
output | Yes | Price per 1M output tokens |
cached_input | No | Price per 1M cached input tokens |
reasoning | No | Price per 1M reasoning tokens. Falls back to output price if not set |
claude-sonnet-4 matches both claude-sonnet-4 and claude-sonnet-4-20250514.
Service pricing
Each entry underservices 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
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
| Field | Used by | Description |
|---|---|---|
type | All | Pricing type: token, unit, request, response_cost |
url_pattern | All | Substring matched against HTTP request URL |
usage_path | token | Dot-path to token count in response |
per_million | token | Price per 1M tokens (single count) |
input_field / output_field | token | Field names for separate input/output counts |
input_per_million / output_per_million | token | Prices for separate input/output tokens |
price_per_unit | unit | Price per API unit |
endpoints | unit, request | Endpoint-specific patterns and pricing |
model_path | request | Dot-path to model name in request |
models | request | Map of model names to per-request prices |
default_price | request | Fallback price when model not matched |
cost_path | response_cost | Dot-path to dollar cost in response |
billable_method | response_cost | HTTP method to count when no cost data present |
fallback_models | response_cost | Map of model names to fallback prices |
default_fallback | response_cost | Fallback price when no cost data and no model match |
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:config/costs.yml to include it in future calculations.
CLI reference
Seeoutput workflow cost for the full command reference.