TokEnable
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
Metadata
Release files for tokenable 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| tokenable-1.0.0.tar.gz | 57.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tokenable-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 105.7 kB
Release files / tokenable-1.0.0.tar.gz
| Download URL | tokenable-1.0.0.tar.gz |
|---|---|
| Size | 57.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8bdd7524d506870c13a0d6c3ba80a4ed87d2c7e797c2dfb85490f764e772b9a8
|
|
BLAKE2b-256 checksum How to use checksums |
847c3ddf740b392d7b2c27f28cee7ee260c751aba31cbbb799a4fd2ee6e84230
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency logRelease files / tokenable-1.0.0-py3-none-any.whl
| Download URL | tokenable-1.0.0-py3-none-any.whl |
|---|---|
| Size | 48.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd2e805338b65b8a3b016e7388eb4712fef7c8156d3cae16e327c54b6aaedc5e
|
|
BLAKE2b-256 checksum How to use checksums |
24c166f87c44dea2afabdb3e40446eb3db023ae344f0d94ed7bf1b4a95c4627c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency logSecurity for tokenable 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for tokenable-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.