README.md
August 23, 2026 · View on GitHub
TokenHub
TokenHub is enterprise Token Governance infrastructure for AI: model routing, access control, token cost optimization, provider reconciliation, and governed access to every upstream model provider.
Enterprise Token Governance
TokenHub gives enterprises a governance layer for the AI model lifecycle, from provider access and project keys to routing policy, usage attribution, budget control, and bill reconciliation.
The core problem is what happens after every team, application, and workflow starts consuming more models and more tokens. TokenHub puts governance controls in front of every model call:
- Model routing: choose the right model by scenario, cost, performance, health, and fallback policy.
- Permission management: allocate and control token access across people, teams, projects, and applications.
- Token savings: reduce AI spend through caching, model selection, quotas, and call strategy.
- Provider reconciliation: compare internal usage with provider bills so finance, platform, and business teams can explain actual AI cost.
Why TokenHub
Many open source AI gateways focus on provider fan-out: one endpoint that can call many upstreams. That helps developers connect models, but it does not solve the enterprise operating problem by itself. TokenHub is built around the missing governance layer:
- Token distribution is managed by project and team instead of by copying raw provider keys into every application.
- Model access, routing, and fallback are policy decisions that administrators can change without rewriting client code.
- Bills and request history can be compared against internal ownership so finance, platform, and business teams can explain AI spend.
- User, team leader, and administrator workspaces keep daily usage, approval, cost attribution, and platform operations separated by responsibility.
Screenshots
Designed Around Three Roles
TokenHub separates everyday model usage, team governance, and platform administration so enterprise users see the workflows that match their responsibility.
| Role | Workspace Focus | Guide |
|---|---|---|
| User | Find available models, create project-scoped API keys, call the model API, and review personal usage | User Guide |
| Team Leader | Manage project spaces, project members, project keys, team reports, and project cost attribution | Team Leader Guide |
| Administrator | Configure providers, model catalog, routing policies, identity sources, RBAC, audit, and cost controls | Administrator Guide |
Platform Capabilities
- Project-scoped key management with team ownership, member permissions, quotas, and concurrency controls.
- Model catalog and routing policies with priority, weight, failover order, scenario-aware selection, and route health diagnostics.
- Usage analytics and request logs attributed to user, project, team, model, and cost center.
- Cost controls for token budgets, provider spend comparison, model choice, and future caching-driven savings.
- Identity source configuration for OAuth/OIDC enterprise sign-in, plus RBAC and audit trails.
- OpenAI-compatible model APIs:
/v1/chat/completions,/v1/responses,/v1/embeddings; Anthropic Messages APIs:/v1/messages,/v1/messages/count_tokens. - OpenAI-compatible image generation and reference-image editing through
/v1/images/generationsand/v1/images/edits, with asynchronous jobs and server-side image retention. - Clean console with compact role-aware navigation, global search, light/dark mode, and split-view API documentation.
- SQLite-first private deployment with native systemd and Docker Compose options.
- PostgreSQL supports multi-instance deployments: share state through remote PostgreSQL, scale frontend and backend replicas horizontally, and configure connection pools. See the deployment guide and PostgreSQL setup guide.
- Console language switching for English, Chinese, and Japanese.
Provider Ecosystem
Provider support is TokenHub's integration boundary. Hosted APIs, subscription channels, local models, and custom upstreams connect through the Provider abstraction so the same enterprise policies can govern every model path.
Once routing, permissions, token savings, attribution, audit, and reconciliation controls are in place, TokenHub can connect those governed workflows to OpenAI, Azure OpenAI, Anthropic, Gemini, DeepSeek, Qwen, Codex subscriptions, local models, and custom OpenAI-compatible upstreams.
TokenHub includes native Provider adapters for OpenAI, Azure OpenAI, Anthropic, Gemini, DeepSeek, Qwen, Codex subscriptions, and local models, plus a catalog of 150+ provider templates. Popular integrations include:
Provider templates use the matching native adapter when available; otherwise they connect through an OpenAI-compatible endpoint. Models and capabilities vary by upstream service and account, while enterprise policy stays centralized in TokenHub.
Quick Start
Native Release on a Linux systemd host:
curl -fsSL https://raw.githubusercontent.com/astaxie/TokenHub/main/deploy/native/install.sh \
-o /tmp/tokenhub-install.sh
sudo bash /tmp/tokenhub-install.sh install
Docker Compose from a repository checkout:
cp deploy/.env.example deploy/.env
# Replace every change-me value in deploy/.env with a strong secret.
./deploy/install.sh
Open:
- Admin console:
http://localhost:3000 - Backend API:
http://localhost:8080 - Health check:
http://localhost:8080/healthz
Initial admin login:
- Username:
admin - Native install password: printed once by the installer
- Docker password: the value of
TOKENHUB_BOOTSTRAP_ADMIN_PASSWORD
The native installer verifies Release checksums, installs a systemd service, and enables direct update, rollback, and restart controls in the version panel. The default Docker deployment runs the backend and console in one managed container and provides the same direct controls without mounting the Docker socket. Release bundles are stored in the tokenhub-releases volume so ordinary container restarts and recreations preserve a panel-applied update. Multi-instance Docker deployments keep operator-managed Compose updates so every replica changes version together. See the deployment guide for both modes.
Documentation
Contributors
TokenHub grows through product feedback, gateway integrations, documentation, tests, and the steady care of people who run it in real enterprise environments.
|
astaxie |
deepjerry-ai |
legendtkl |
Mr0bean |
cngump |
bailu-ZZ |
coldbrewtea |
excniesNIED |
|
samz406 |
imaben |
wangle201210 |
CLukeLi |
myssl |
exgliuzhi |
hoorayman |
debin-ge |
|
ocass-chen |
AnxForever |
yujiewanwan |
lxm |
susunola |
View all contributors · Start contributing
Star History
License
TokenHub is licensed under the Apache License 2.0.