TokTab CLI
LLM pricing data at your fingertips
A command-line interface for accessing TokTab, a free API providing pricing data for 2000+ LLM models. Powered by LiteLLM and updated nightly.
Installation
# Using uvx (recommended)
uvx toktab gpt-4o
# Or install with pip
pip install toktab
Usage
Get pricing info for a specific model
toktab gpt-4o
toktab claude-3-opus
toktab gemini-1-5-flash
Output:
╭──────────────────────────────────────────────────────────────────────────────╮
│ gpt-4o (openai) │
╰──────────────────────────────────────────────────────────────────────────────╯
Pricing
Type Cost / 1M tokens
Input $2.50
Output $10.00
Context Window
Limit Tokens
Max input 128K
Max output 16K
Capabilities
✓ Vision · ✓ Functions · ✓ Tool choice · ✓ System msgs
Search for models
toktab search claude
toktab search "gemini 3"
toktab search provider:anthropic
JSON output
All commands support --json for machine-readable output:
toktab --json gpt-4o
toktab search --json claude
Options
Options:
--json Output raw JSON
--version Show version
--help Show this message and exit.
AI Agent Integration
TokTab CLI is designed to work well with AI agents and automated pipelines.
Auto-detection
When stdout is not a TTY (e.g. piped to another process), output switches to JSON automatically — no flags needed.
# Human at a terminal gets rich tables
toktab gpt-4o
# Piped to another process gets JSON
toktab gpt-4o | jq .input_cost_per_token
Environment variable
Set OUTPUT_FORMAT to force a specific format:
export OUTPUT_FORMAT=json # Always JSON
export OUTPUT_FORMAT=text # Always rich tables
Schema introspection
Agents can discover CLI capabilities at runtime:
toktab schema
This outputs a machine-readable JSON description of all commands, arguments, options, and API endpoints.
Structured errors
When JSON output is active, errors are written to stderr as structured JSON:
{"error": true, "message": "Model 'nonexistent' not found"}
Model Slugs
Model identifiers are derived from LiteLLM model names with special characters replaced by hyphens.
For example:
gemini/gemini-pro→gemini-gemini-proanthropic/claude-3-opus→anthropic-claude-3-opus
Use the search command to find the exact slug for a model.
Features
- 🚀 Fast: Lightweight CLI with minimal dependencies
- 📊 Rich output: Beautiful tables with cost color-coding (green=cheap, yellow=medium, red=expensive)
- 🔍 Fuzzy search: Find models by name or provider
- 💰 Cost per million tokens: Easy-to-read pricing format
- 🎨 JSON output: Perfect for scripting and automation
- 🆓 Free: No API key required
Development
# Clone the repo
gh repo clone tomdyson/toktab-cli
cd toktab-cli
# Install with dev dependencies
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
# Run tests
pytest
# Test locally
toktab gpt-4o
Publishing a New Release
-
Update the version in pyproject.toml:
version = "0.2.0" # Bump version number
-
Commit and push your changes:
git add pyproject.toml git commit -m "Bump version to 0.2.0" git push
-
Create and push a git tag:
git tag v0.2.0 git push origin v0.2.0
-
Create a GitHub release:
gh release create v0.2.0 --title "v0.2.0 - Release Title" --notes "Release notes here"
-
Done! GitHub Actions will automatically build and publish to PyPI.
The package will be live at pypi.org/project/toktab within 1-2 minutes.
License
MIT License - see LICENSE for details.
Credits
Release files for toktab 0.2.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 | |
|---|---|---|---|
| toktab-0.2.0.tar.gz | 13.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toktab-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.0 kB
Release files / toktab-0.2.0.tar.gz
| Download URL | toktab-0.2.0.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6c59f4e5acc030430f542ff5ea67f549d0a067ef5cf90311dbf5fd47e4666a0
|
|
BLAKE2b-256 checksum How to use checksums |
3b8d63a0652ba5be163c93dcf9ae9b23d04a4443d6ccd72a99cebd932b3d086e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 21, 2026.
Transparency logRelease files / toktab-0.2.0-py3-none-any.whl
| Download URL | toktab-0.2.0-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8c9aa48ea01c504914d69f530e54db6e0f622698076fb13a09cb888549f365ea
|
|
BLAKE2b-256 checksum How to use checksums |
fbb43fe58c2ea3e22c5823ee871a94d28f2887fac8cc862754deba3042ea08bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Mar 21, 2026.
Transparency log