Cost Tracking
Per-session USD ceilings with built-in pricing for 106 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 106 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.00Bounded 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 and closes 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 tokens, total cost, and the cost of each stepCosts 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.
Built-in prices
Prices are each provider's standard rate for text, taken from the OpenAI, Anthropic, Google and
Mistral pricing pages on 21 October 2026 (SDK 1.1.2 or later). Model names are matched by their start, so
dated ids such as gpt-4o-2024-08-06 or claude-sonnet-4-5-20250929 use the price of their model.
The full list of model ids and prices is on Supported Models.
-latest aliases such as gemini-pro-latest or mistral-large-latest are priced as that family's
current model on 21 October 2026. If a provider moves an alias to a new model, the price here changes
only in a later SDK release.
Long-context tiers and announced future price changes are not included. For example, Gemini 3.8 Flash and 3.6 Flash rise on 1 January 2027, and Gemini 4 Argon on 1 December 2026.
Models that aren't in the table
Audio, image, video, speech, realtime, transcription and embedding models aren't in the table.
Neither are ids with a cloud or router prefix, such as Bedrock's anthropic. ids or provider/model
names. If your model isn't in the table, or you want the cost to match your bill exactly, pass your own
cost for each step. SteerPlane then uses your number for the ceiling and the dashboard.
from steerplane import SteerPlane
sp = SteerPlane(agent_id="my_agent")
with sp.run(max_cost_usd=5.00) as run:
input_tokens, output_tokens = 1200, 300
# Your model's own prices, in USD per 1M tokens
cost = input_tokens * 0.40 / 1e6 + output_tokens * 1.60 / 1e6
run.log_step("call_llm", input_tokens=input_tokens, output_tokens=output_tokens, cost=cost)In TypeScript, pass cost to logStep:
await run.logStep({ action: "call_llm", inputTokens, outputTokens, cost });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.