Skip to main content

Token Buffet — CLI LLM Proxy Router

Expose your flat-rate CLI subscriptions (Claude, Codex, Grok, agy) as a local OpenAI/Ollama/Anthropic-compatible API. Route requests by semantic tier (fast/medium/reasoning), smart load balance by quota, and power your downstream tools without paying per token.

Learn the Concept

For an overview of the LLM Wiki pattern and how this fits in, watch:

Karpathy LLM Wiki Overview

(Note: The video uses Claude Code as the example, but explains the LLM Wiki concepts and patterns well. Token Buffet applies the same pattern to any CLI-based LLM subscription — Claude, Codex, Grok, agy — and powers Obsidian vaults, community plugins, and agent frameworks.)

This shows how to turn your subscriptions into a local knowledge-synthesis engine for tools like Obsidian, chatbot clients, and AI agents.

Features

  • Small runtime: The proxy, router, and dashboard use Python's standard HTTP server. Extractor capture needs its optional pseudo-terminal dependencies, and the Responses endpoint needs the OpenAI SDK.
  • Semantic Routing: Translates generic model requests (fast, medium, reasoning) into specific provider models based on remaining usage quotas.
  • Smart Load Balancing: Reads exported CLI quota files and routes requests to the provider with the most remaining quota.
  • True Parallelism: Spawns sandbox directories to bypass SQLite locking limits in native CLIs.

Quick Start

Token Buffet always works in the folder you run it from. Make one folder for it:

mkdir TokenBuffet && cd TokenBuffet
pip install token-buffet               # Python 3.12+; installs everything it needs
tbuffet init                           # scaffold, register the provider CLIs found on PATH, check app integrations
tbuffet demo init                      # optional: copy the demos, add them to their apps, list which can run
tbuffet start                          # proxies + router (8090) + dashboard (8080); Ctrl+C stops this session's process trees
tbuffet start --background             # explicitly leave services running in the background
tbuffet status | stop | restart | doctor

Log in to each vendor CLI (claude, codex, grok, agy) once. init doesn't check logins; a provider that isn't signed in reports its error at tbuffet start.

Demos (pre-configured)

tbuffet demo init copies ready-to-use demos into demo/. Each one already points at the router, so after tbuffet start:

  • Obsidian LLM Wiki (needs Obsidian installed): run tbuffet open obsidian conference-notes (or daily-notes), then choose Trust author and enable plugins. See the demo README.
  • Chatbots and Claudia: see demo/README.md.

Providers and your own apps

tbuffet add-provider claude --validate        # register a built-in provider + login/quota check
tbuffet add-provider mine --from config.json  # import a config authored with the register-provider skill
tbuffet list-providers | remove-provider NAME
tbuffet add-app obsidian my-vault --path "/path/to/vault" --vault-type daily-notes
tbuffet list-apps | reconfigure-app TYPE NAME

Directory Structure

  • src/tokenbuffet/: proxy, router, dashboard and launcher
  • src/tokenbuffet/extractors/: provider usage and model capture/parse engine
  • src/tokenbuffet/default_templates/: what tbuffet init copies into your folder:
    • config/
    • integrations/ (built-in app types, and providers/ with the built-in provider configs)
    • scripts/
    • demo/ and the demo registrations in registered_apps/ are copied by tbuffet demo init

In your Token Buffet folder:

  • integrations/providers/: built-in provider configs (what Token Buffet supports)
  • registered_providers/: the providers registered on this machine
  • data/: runtime state (providers_status/, provider_homes/, temp/)
  • logs/: proxy, router and extractor logs

From a repository checkout

Install editable with pip install -e ., then run tbuffet init and tbuffet start from the repository root.

tbuffet init also copies legacy launchers into scripts/ (both .ps1 and .sh):

.\scripts\start_all_proxies.ps1   # each provider proxy; reports listening / already running / failed
.\scripts\start_router.ps1        # port 8090
.\scripts\start_dashboard.ps1     # port 8080

The router listens on port 8090, and the dashboard is at http://127.0.0.1:8080/. See the documentation index for the bridge guides.

Metadata

Release files for token-buffet 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for token-buffet 0.1.0
File Size Uploaded Provenance
token_buffet-0.1.0.tar.gz 3.2 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for token-buffet 0.1.0
File Interpreter ABI Platform
token_buffet-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 MB

Release files / token_buffet-0.1.0.tar.gz

Download URL token_buffet-0.1.0.tar.gz
Size 3.2 MB
Tags Source
SHA-256 checksum
How to use checksums
7ac770e0c5cbc4d81f564f6aaa4f2daf997bad2a1508b918e8ab9317e56a060d
BLAKE2b-256 checksum
How to use checksums
484dfaf23565bc20f3a1b92c050919dccd074bead4fd9f4fff44d8116f7b1789
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / token_buffet-0.1.0-py3-none-any.whl

Download URL token_buffet-0.1.0-py3-none-any.whl
Size 3.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
894ca6b94b04d267d4aa38d79ffd37b066b52a55862e7768e963514894e688a6
BLAKE2b-256 checksum
How to use checksums
dcb19687abe0672d8ff566052a7e227bc1197604e81427a27fc6eab773bbd3b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for token-buffet 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page