
tokencast
io.github.krulewisPublished by GitHub account krulewisv0.1.1Updated Oct 27, 2026
Pre-execution cost estimation for LLM agent workflows with calibration learning
Overview
Estimates the API cost of a planned LLM agent task before it runs, then learns from reported actuals to improve later estimates.
- What you can do
- Estimate cost for a planned task from size, file count and complexity, with optimistic, expected and pessimistic bands
- Check calibration status and browse past estimates against actuals
- Report a session's actual cost or a single pipeline step's cost to feed the calibration model
- Disable anonymous telemetry from within the assistant
- When to use it
- Useful when you plan multi-step agent workflows with paid model calls and want a rough budget before committing, or want estimates that improve as you report real spend.
- Requirements
- Runs locally over stdio as a Python package (pip install tokencast or uvx); uv is required for the Claude Code plugin path. Optional flags set the calibration directory and project root. No accounts or API keys are declared.
Installation
In SourceWeft
- Open tokencast in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
tokencast
Pre-execution cost estimation for LLM agent workflows. Get a cost estimate before running any agent task, then let tokencast learn from actuals to improve accuracy over time.
Available as a Claude Code plugin (recommended — one command delivers everything) or as an MCP server for Cursor, VS Code + Copilot, and Windsurf.
Installation
Claude Code (Recommended)
Install tokencast as a Claude Code plugin — delivers the MCP server, calibration hooks, and estimation skill in two commands:
The first command registers the tokencast marketplace. The second installs the plugin from it.
Prerequisites:
uvmust be installed for the MCP server to function. Install with:curl -LsSf https://astral.sh/uv/install.sh | sh
This delivers:
- MCP server (
estimate_cost,get_calibration_status,get_cost_history,report_session,report_step_cost) - Calibration hooks (auto-learning at session end, mid-session cost warnings, agent timeline tracking)
- SKILL.md (estimation algorithm auto-trigger after plans)
Calibration data is stored in ~/.tokencast/calibration/ (global across projects, preserved on uninstall).
Scope options:
--scope user(recommended — installs globally for all projects) or--scope project(per-project only).
Other IDEs (MCP Server)
Install the package:
Or with uvx (no install required — runs directly from PyPI):
Configure your IDE — replace /path/to/your/project with your actual project path in the config snippets below.
Cursor
Create or update .cursor/mcp.json in your project root:
VS Code + GitHub Copilot
Create or update .vscode/mcp.json in your project root:
Windsurf
Add to your Windsurf MCP config:
Full config examples are in docs/ide-configs/.
Available tools
Once configured, tokencast exposes five MCP tools in your IDE:
Example — estimate before starting work:
Example — report actuals after finishing:
Telemetry
tokencast includes opt-out anonymous usage telemetry. It is on by default — data is collected unless you explicitly disable it.
What is collected: session count, mean accuracy ratio, calibrated factor count, client name, framework, tool name, package version. What is NOT collected: project names, file paths, cost amounts, or any personal data.
To disable:
- Call the
disable_telemetryMCP tool (permanent opt-out, creates~/.tokencast/no-telemetry) - Pass
--no-telemetryto the MCP server command - Set
TOKENCAST_TELEMETRY=0in your environment
Precedence (highest to lowest):
TOKENCAST_TELEMETRY=0→ always disablesTOKENCAST_TELEMETRY=1→ always enables (overrides--no-telemetryand the no-telemetry file)~/.tokencast/no-telemetryfile exists → disables- Default (no flags, no env var) → enabled
To delete your install ID: rm ~/.tokencast/install_id.
Data is sent to PostHog (US region). A random UUID is generated locally as your install ID — it contains no personal information. See the wiki for full details.
MCP Server Flags
Claude Code Skill (Legacy)
The Claude Code plugin (recommended) delivers everything in one command. Use this only if you prefer the SKILL.md workflow without the plugin system.
If you use Claude Code and prefer the skill-based (SKILL.md) workflow, you can install tokencast as a Claude Code skill instead:
Paths with spaces: Always wrap the project path in quotes. Without them the install script will fail on paths like
/Volumes/Macintosh HD2/....
This does three things:
- Symlinks the skill into
<project>/.claude/skills/tokencast/ - Adds a
Stophook for auto-learning at session end - Adds a
PostToolUsehook to nudge estimation after planning agents
The SKILL.md workflow is Claude Code-specific. The MCP server works in any MCP-compatible client and is the recommended path for new users.
How It Works
- Infers size, file count, complexity from the plan in conversation
- Reads reference files for pricing and token heuristics
- Loads learned calibration factors (if any exist)
- Computes per-step token estimates using activity decomposition
- Applies complexity multiplier, context accumulation
(K+1)/2, and cache rates - Splits into Optimistic / Expected / Pessimistic bands
- If PR Review Loop is in scope, computes loop cost using geometric decay across N review cycles
- Applies calibration correction to Expected band
- Records the estimate for later comparison with actuals
Example output:
Confidence Bands
Calibration
Calibration is fully automatic once you report actuals:
- 0-2 sessions: No correction applied. "Collecting data" status.
- 3-10 sessions: Global correction factor via trimmed mean of actual/expected ratios (trim_fraction=0.1).
- 10+ sessions: EWMA with recency weighting. Per-size-class factors activate when a class has 3+ samples.
- Outlier filtering: Sessions with actual/expected ratio >3.0x or <0.2x are excluded from calibration.
Calibration data lives in ~/.tokencast/calibration/ (gitignored, local to each user).
Python API
Manual Invocation (Skill mode)
In Claude Code with SKILL.md installed, you can invoke explicitly:
Files
Limitations
- Pipeline step names reflect a default workflow — map your own steps to the closest defaults. Formulas are pipeline-agnostic (see
references/heuristics.md) - Heuristics assume typical 150-300 line source files
- Calibration requires 3+ completed sessions before corrections activate
- Pricing data embedded; check
last_updatedin references/pricing.md - Multi-session tasks only capture the session containing the estimate
License
MIT
Source: README.md at commit f06e225
Tools
0Version history
1- v0.1.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts