tokenpak

Installing TokenPak

Requirements


pip install tokenpak

Verify the install:

tokenpak --help

Install with Optional Dependencies

Token counting (for accurate savings reports)

pip install "tokenpak[tokens]"

This installs tiktoken for exact token counts instead of estimates.

Development dependencies

pip install "tokenpak[dev]"

Includes pytest and testing tools.


Install from Source

git clone https://github.com/kaywhy331/tokenpak.git
cd tokenpak
pip install -e .

For development:

pip install -e ".[dev]"

Using pipx (Isolated Install)

If you want the CLI globally without polluting your Python environment:

pipx install tokenpak

Upgrading

pip install --upgrade tokenpak

Verify Installation

# Check version
tokenpak --version

# Start the proxy
tokenpak serve --port 8766

# View CLI help
tokenpak --help

Uninstalling

pip uninstall tokenpak

Troubleshooting

tokenpak: command not found

Make sure your Python scripts directory is on your PATH. With pip, scripts go to:

With pipx, it handles this automatically.

ImportError on Python < 3.10

TokenPak requires Python 3.10+. Check your version:

python --version

Use python3.10, python3.11, or python3.12 explicitly if needed.

Port 8766 already in use

tokenpak serve --port 8767

Or kill the existing process:

lsof -ti:8766 | xargs kill -9

See TROUBLESHOOTING.md for more detailed diagnostics.