Skip to main content

Slash LLM costs with intelligent context compression, smart routing, and cost tracking

Project description

TokenPak — Cut your LLM token spend by 30–50%, zero config

PyPI version Python 3.10+ License: Apache-2.0

TokenPak is a local proxy that compresses your LLM context before it hits the API — fewer tokens, lower cost, same results. No code changes, no cloud, no credentials stored.


30-second demo

pip install tokenpak
tokenpak serve                          # start proxy at localhost:8766
tokenpak integrate claude-code --apply  # wire Claude Code to the proxy
✅ Applied: Updated ~/.claude/settings.json (2 changes).

Then verify it's working:

tokenpak demo
┌──────────────────────────────────────────────────────┐
│  TokenPak — Live Compression Demo                    │
├──────────────────────────────────────────────────────┤
│  Scenario              DevOps agent (config + logs)  │
│  Savings drivers                      dedup + alias  │
├──────────────────────────────────────────────────────┤
│  Original                                747 tokens  │
│  Compressed                              502 tokens  │
│  Saved                          245 tokens  (32.8%)  │
│  Cost saved (est.)                $0.00073 per call  │
├──────────────────────────────────────────────────────┤
│  Stages: dedup, alias, segmentize, directives        │
└──────────────────────────────────────────────────────┘

Works with

Claude Code · Cursor · Cline · Continue.dev · Aider · OpenAI SDK · Anthropic SDK · LiteLLM · Codex

Run tokenpak integrate to see the full client list with setup guides for each.


Install

pip install tokenpak

See docs/quickstart.md for virtual-env setup and per-client configuration.

Requirements: Python 3.10+. No external dependencies for core functionality.

Exposing the proxy beyond 127.0.0.1? Set TOKENPAK_PROXY_AUTH_TOKEN to a shared secret to require Authorization: Bearer <token> on remote requests (see docs/configuration/proxy-auth.md).


What's included (Free)

  • Context compression — 30–50% token reduction on real agent workloads, <50ms latency Reproduce: make benchmark-headline
  • Client integration — one command wires Claude Code, Cursor, Aider, and 6 other clients
  • Model routing — send requests to the right model automatically, with fallback rules
  • Cost tracking — per model, per session, per agent; local SQLite, zero cloud
  • TIP Spend Guard — pre-send circuit breaker; blocks runaway requests before provider call. Yes/No release or [TIP: allow=once max=$X] directive. Catches both single-request spikes and the death-by-1000-cuts pattern via session-cumulative tracking. See docs/spend-guard.md.
  • Vault indexing + semantic search — index your codebase; search without an LLM call
  • MultiPak Pro Phase 1 OSS surface — read-only Vault Pak adapter, companion journal promotion-candidate marking, tokenpak pak CLI, /pak/v1/* proxy stubs. Full MultiPak (capture pipeline, recall ranking, Handoff Paks, anchor hydration) requires tokenpak-paid (Pro). See docs/multipak.md.
  • CLI + proxy servertokenpak serve, tokenpak cost, tokenpak savings
  • A/B testing and replay/debug — compare compression configs, replay past requests
  • 50 built-in compression recipes — YAML, customizable

80%+ of operations cost zero tokens. See docs/quickstart.md and docs/api-tpk-v1.md to get started.


Pricing

Free Pro Team
Context compression
Client integration (all 9)
Model routing
Cost tracking
Vault indexing + search
CLI + proxy
Advanced compression recipes
Budget enforcement + alerts
Priority support
Multi-agent coordination
Shared vault (team)
RBAC + audit logs
Price Free $99/mo $299/mo

See tokenpak.ai/pricing for full tier details and enterprise options.


Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokenpak-1.7.0.tar.gz (2.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokenpak-1.7.0-py3-none-any.whl (2.7 MB view details)

Uploaded Python 3

File details

Details for the file tokenpak-1.7.0.tar.gz.

File metadata

  • Download URL: tokenpak-1.7.0.tar.gz
  • Upload date:
  • Size: 2.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tokenpak-1.7.0.tar.gz
Algorithm Hash digest
SHA256 a4885c0eca35f263cb5b45368b184251eea4493aa0360bd67bb2fefebd1a6dba
MD5 6f96bdf1c55f3d0fc7de9a654652a867
BLAKE2b-256 3badff73a36cb5472e57a150cc9913afc9a033f03f07063c84b3548def0757d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenpak-1.7.0.tar.gz:

Publisher: release.yml on tokenpak/tokenpak

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokenpak-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: tokenpak-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 2.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for tokenpak-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bb39a5c4010aa9452963db622abfaaf4280dde4d5ec2a0787f3395d87bd498d
MD5 581d0b31028dd7bf0350cf478c36b4c3
BLAKE2b-256 98b486e5857545c022754946796221906f163d2dbd2b820025580e81a28b4c44

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokenpak-1.7.0-py3-none-any.whl:

Publisher: release.yml on tokenpak/tokenpak

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page