STEERPLANE

Cost Tracking

Per-session USD ceilings across 25+ models, with overshoot bounded to a single step.

SteerPlane enforces hard financial limits on agent runs. The cost tracker maintains built-in pricing tables for 25+ models across OpenAI, Anthropic, Google, Meta, and Mistral, accounts for input and output tokens separately, and accumulates the running session cost in real time.

from steerplane import guard

@guard(agent_name="research_agent", max_cost_usd=5.00)
def run():
    agent.run()   # terminates the moment cumulative cost crosses $5.00

Bounded overshoot

When the ceiling is reached, SteerPlane terminates (or pauses, in alert mode) immediately after the step that crossed it — so no more than a single step ever exceeds the configured limit.

On streaming responses, the gateway enforces the ceiling mid-stream, chunk by chunk — closing the connection the instant the limit is hit rather than waiting for the call to finish.

Per-model accounting

The CostTracker computes per-step cost from built-in pricing, accumulates the session total, and enforces the ceiling.

from steerplane import CostTracker

tracker = CostTracker(max_cost_usd=5.00, model="gpt-4o")

# Cost a step from token usage, then add it to the running total
step = tracker.calculate_step_cost(input_tokens=1200, output_tokens=300)
tracker.add_step(step)

summary = tracker.get_summary()   # total cost, step count, remaining budget

Costs are computed per model from the built-in pricing tables, so multi-provider agents get a single, accurate running total. project_final_cost() can estimate the final spend partway through a run, and reset() clears the tracker between runs.

Where it shows up

Every step's token count and cost is captured and streamed to the dashboard for live monitoring and historical trend analysis.

On this page