StepCost documentation

FinOps for LLM agents: a priced, typed cost graph for every agent run — by step, by feature, by customer — reconciled against what your provider actually bills.

What StepCost is

Your provider bill tells you the total. Your observability tool tells you cost per request. Neither can answer the question that matters for a product: which step of which agent, serving which feature and which customer, is burning the money?

StepCost is an open-source Python SDK that treats agent cost as a first-class typed graph:

trace  support-bot / customer=acme                     $0.0152
├─ agent_step: plan                                    $0.0003
│  └─ llm_generation gpt-4o-mini                       $0.0003
├─ agent_step: retrieve
│  └─ embedding text-embedding-3-small                 $0.0002
└─ agent_step: execute
   └─ llm_generation gpt-4o                            $0.0148

The three guarantees

The two-sided ledger

The SDK sees why you spent (step, feature, customer). Your provider's billing API knows what you'll pay. stepcost sync pulls the provider side into the same local database, and every report shows drift (does StepCost match the invoice?) and coverage (how much of the bill did instrumented code account for?). Each side audits the other's blind spot.

Privacy & deployment

Metadata-only by default: token counts, models, and your business dimensions — never prompt or response content. Fully offline: local SQLite, no account, no cloud. MIT licensed.