Set up
Runs on your computer. Pick your agent and operating system.
Before you start
- uv (`curl -LsSf https://astral.sh/uv/install.sh | sh`)
{
"mcpServers": {
"tokenable": {
"command": "uvx",
"args": [
"tokenable"
]
}
}
}same format Cursor, GitHub Copilot CLI, Junie, JetBrains AI Assistant, Augment (Auggie CLI), Factory Droid, Kiro, Devin CLI +12
Values in angle brackets are placeholders. Restart Claude Desktop after editing its config.Claude Desktop docs
README
synced Oct 25, 2026TokEnable
FinOps CLI for LLM API costs. Scan code, estimate token spend, recommend cheaper models, and block over-budget PRs.
Quick Start
pip install tokenable
tokenable estimate .
┌──────────────────────────────────────────────────────────────────────────┐
│ TokEnable Estimate │
├─────────────┬──────┬───────────┬──────────────────┬─────────┬────────────┤
│ File │ Line │ Provider │ Model │ $/call │ $/month │
├─────────────┼──────┼───────────┼──────────────────┼─────────┼────────────┤
│ src/chat.py │ 42 │ anthropic │ claude-opus-4-6 │ $0.0450 │ $45.00 │
│ src/sum.py │ 15 │ openai │ gpt-4o │ $0.0035 │ $3.50 │
└─────────────┴──────┴───────────┴──────────────────┴─────────┴────────────┘
Total estimated monthly cost: $48.50
Features
| Feature | Description |
|---|---|
| Code Scanner | Detects LLM API calls in .py, .ts, .js files |
| Cost Estimation | Projects monthly costs from token counts and pricing data |
| Smart Recommendations | Suggests cheaper models with equivalent capabilities |
| Auto-Fix | Rewrites model IDs in source files automatically |
| Budget Enforcement | Pre-commit hooks and CI gates for cost control |
| MCP Integration | AI agent tools via Model Context Protocol |
| Calibration | Corrects estimates with real provider usage data |
| Multi-Provider | Anthropic, OpenAI, Google, xAI, Perplexity |
CLI Commands
tokenable estimate . # Estimate costs
tokenable check . --max-monthly-cost 500 # CI budget gate
tokenable audit . # Find savings opportunities
tokenable fix . --dry-run # Preview model swaps
tokenable diff . --base main # Cost diff between branches
tokenable price anthropic claude-sonnet-4-6 # Look up pricing
tokenable calibrate . --provider openai # Calibrate from production
tokenable init # Set up config + hooks
tokenable update-pricing # Refresh pricing data (--dynamic for live)
CI Integration
# .github/workflows/tokenable.yml
- run: pip install tokenable
- run: tokenable check . --max-monthly-cost 500
Fails the build if estimated costs exceed your budget. See CI Integration docs.
Pricing Updates
TokEnable ships with bundled pricing data updated each release. For the latest prices:
tokenable update-pricing # Refresh from static provider data
tokenable update-pricing --dynamic # Fetch live prices from LiteLLM community DB
A GitHub Actions workflow runs daily to keep pricing in sync automatically.
MCP for AI Agents
TokEnable runs as an MCP server for Claude Code, Cursor, and other AI agents:
{
"mcpServers": {
"tokenable": {
"command": "python",
"args": ["-m", "tokenable.mcp"]
}
}
}
Tools: suggest_model, estimate_cost, audit, apply_recommendations. See MCP docs.
Configuration
Create tokenable.config.json:
{
"defaultVolume": 1000,
"ignore": ["**/test/**"],
"overrides": [
{ "pattern": "src/batch/**", "volume": 50000 }
],
"budgets": {
"block": 0.05,
"maxMonthlyCost": 500
}
}
Supported Providers
| Provider | Example Models |
|---|---|
| Anthropic | claude-opus-4-6, claude-sonnet-4-6, claude-haiku-3-5 |
| OpenAI | gpt-4o, gpt-4o-mini, o3, o3-mini |
| gemini-3.1-pro-preview, gemini-2.5-flash | |
| xAI | grok-3, grok-3-mini |
| Perplexity | sonar-pro, sonar-reasoning-pro, sonar |
Full list: Supported Models
Documentation
- Installation
- Quick Start
- CLI Reference
- Supported Models
- CI Integration
- MCP Integration
- FAQ
- Contributing
Development
git clone https://github.com/pardhusrepo/tokenable.git
cd tokenable
pip install -e '.[dev]'
make test
License
Apache-2.0