astaxie/TokenHub

TokenHub gives enterprises a private gateway to unify AI model access and governance, making every request controllable, traceable, and attributable.

TokenHub – Enterprise‑grade AI model gateway & governance

What it does
TokenHub sits in front of any OpenAI‑compatible LLM provider (OpenAI, Azure, Anthropic, Gemini, DeepSeek, Qwen, local models, etc.) and adds a thin‑but‑powerful governance layer for enterprises.
It lets you:

  • Route calls to the best model for a scenario, cost, health or fallback policy.
  • Control who can use which tokens – project‑scoped API keys, team‑level permissions, quotas and concurrency limits.
  • Save money – automatic caching, model‑selection rules and budget caps.
  • Reconcile bills – compare internal usage logs with provider invoices so finance can explain spend.

Who it’s for

  • Users – developers who just need an API key to call a model and see their own usage.
  • Team leaders – manage projects, members, cost attribution and reports.
  • Administrators – configure providers, routing policies, RBAC, audit trails and cost controls.

Key technical bits

  • Written in Go 1.26 with a SQLite‑first deployment option; PostgreSQL can be used for multi‑instance scaling.
  • Provides OpenAI‑compatible endpoints (/v1/chat/completions, /v1/embeddings, /v1/images/generations, etc.) plus Anthropic‑style messages and token‑count APIs.
  • Supports Docker‑Compose or native systemd installation; release bundles are version‑checked and can be rolled back from the admin console.
  • Includes 150+ provider templates and adapters for the major commercial LLM services; custom upstreams can be added via the generic OpenAI‑compatible interface.
  • UI offers light/dark mode, role‑aware navigation and analytics dashboards (usage per user, project, model, cost centre).

Getting started

  1. Native install – run a curl‑downloaded script that installs a systemd service and prints an admin password.
  2. Docker‑Compose – copy .env.example, fill in secrets, run ./deploy/install.sh.
  3. Open the console at http://localhost:3000 (admin login admin).

Documentation

  • Architecture overview, user/leader/admin guides, deployment instructions and contribution guide are all in the docs/ folder.
  • The project is Apache‑2.0 licensed and welcomes contributions.

TokenHub is a genuine, production‑oriented open‑source project that tackles the real‑world problem of governing AI model consumption in large organisations.

Related

  • Project
  • Project
  • Project
  • Project
  • Project