# Token Budget Estimator

> Know what a feature will cost in tokens and dollars before you build it with Claude Code, Cursor or Codex. P10, P50 and P90 per model from a Monte Carlo simulation, calibrated on your own session logs.

Token Budget Estimator is a paid AI agent skill on Agensi by Alexand_ary, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $4.99 (one-time purchase)
- Creator: [Alexand_ary](https://www.agensi.io/creators/alexand-ary)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-30
- Security: scan passed (2026-11-18); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/token-budget-estimator
- Tags: llm-ops, prompt-engineering, cost-analysis, claude-code, token-cost, cursor, monte-carlo

## About this skill

Every developer who works with a coding agent asks the same question after the fact, from the invoice: how much did that feature cost? This skill answers it before you start, as a range you can defend, and tells you which choices move it.

Back-tested on real sessions: a small UI feature (a custom cell editor in a third-party data grid), calibrated on 3 sessions of the same repo, was estimated at **$15 / $20 / $27** (P10 / P50 / P90) and cost **$19.5**; 61-78-100 turns against 73, 36-48-63M tokens against 35.5M. A 165-call session was estimated at $39-77 and cost $76.79.

The plans and commands are in `examples/`, so you can reproduce the numbers before trusting them.

It decomposes the work into activities (explore, design, implement, test, debug, verify, docs), gives each a range of agent turns, and runs a 10,000-draw Monte Carlo over context size, cache hits, cache writes, output and reasoning tokens. The result is a P10/P50/P90 in tokens and money for every model you want to compare, plus a sensitivity ranking: which input moves the cost most, and what to do about it.

The part that makes it accurate is calibration. `calibrate.py` reads your Claude Code session logs (token counts and timestamps only, never the text) and measures how *you* work: cache hit ratio, context per turn, output and reasoning per turn, cache writes, turns per session. Generic estimates land within a factor of 3-5 of reality; calibrated ones within 1.5-2.

### What it does

- **Range, not a number**: P10/P50/P90 for turns, tokens by kind (cached input, uncached input, cache writes, output, thinking) and cost per model.
- **Model comparison** on the same plan (Claude Opus/Sonnet/Haiku, GPT-5 family, codex models), with an honest note that a cheaper model may need more turns.
- **Sensitivity**: the three inputs that move the cost most, each with its lever (fresh session, CLAUDE.md, shorter test output, cheaper model for exploration, a spec before coding).
- **Calibration** on your Claude Code logs, per project; the estimate improves with every feature.
- **Close the loop**: after the work, compares the estimate with the real consumption and says where it was off and why.
- **Session-aware**: if you continue in an already long session, it floors the context at what the session carries now and shows how much a fresh session would save.

### What it found on real logs

99.97% of input tokens in a typical Claude Code session are cache reads at 1/20 of the input price. A long session costs 8x the tokens of a fresh one for the same feature, but almost the same money on the API. On a flat subscription, where limits count tokens, the same long session burns the limit 8x faster. The estimator makes both visible.

### How it works

1. Loads the activity catalog, the parameters and a dated price list.
2. Calibrates on your logs if they exist (`~/.claude/projects`), per project.
3. Decomposes the feature into activities with turn ranges and shows you the plan to correct.
4. Simulates 10,000 runs (about a second) for every model you chose.
5. Reports ranges, cost split, drivers, plan, calibration note and what it cannot know.
6. After the work, re-reads the session and compares.

### Frameworks & tools

Python 3, no dependencies. Needs file access to run the two scripts; log calibration needs Claude Code logs (Cursor and Codex logs are not read yet: estimates still work for them with generic parameters). Replies in your language.

### Use cases

- Budget a feature or a sprint of features before starting, per model.
- Decide whether Opus is worth it for this task, or whether Haiku for exploration and tests pays off.
- Understand why last week's session cost what it did.
- Estimate how much of a subscription's usage limit a task will burn.

### Known limitations

Estimates are ranges, and one run in ten falls outside P10-P90. Uncalibrated, expect a factor of 3-5; calibrated on a few sessions, 1.5-2. Prices live in a dated file (as of 2026-11-17) and the skill warns when it is older than 60 days; verify official prices before quoting a client. Agent retries and dead ends beyond the retry factor, scope that grows while you work, CI and hosting costs are not modelled. Calibration currently reads Claude Code logs only.

On flat subscriptions the dollar figure is what the same work would cost on the API; the token figure is what counts against your limit. The back-tests are a-posteriori (plans written after the fact); treat your first a-priori estimates as the real test, and the skill will compare them for you.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Token Budget Estimator skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What assets are included in the bundle when I acquire this skill?

The skill includes the Python simulation engine, the calibration utility for log analysis, a library of activity complexity templates, and current pricing data for major model providers.

### Which AI agents and coding tools are compatible with the log calibration feature?

It currently supports logs from popular CLI agents like Claude Code and IDE-based tools like Cursor; it also features a generic log-importing mode for other agent frameworks that export to JSON or Markdown.

### Why should I use this simulation tool instead of just asking an LLM to estimate the cost?

Unlike a static prompt, this skill uses Monte Carlo simulations to model the 'hidden' costs of context caching and session bloat, which typically account for the majority of a project's bill.

### How difficult is the initial installation and calibration process?

Setup involves a one-time execution of the calibration script to index your local logs, followed by a simple repository scan to establish your baseline context size.

### How are model pricing changes and new provider tiers handled?

Updates to model pricing and new agent activity templates are released periodically to ensure your estimates remain accurate as provider costs and agent capabilities evolve.

### Does the estimator account for agent failures or infinite loops during the coding process?

It cannot predict 'agent loops' or unforeseen bugs, but it accounts for these risks by providing P90 'worst-case' estimates alongside the expected P50 cost.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
