Skip to content

astaxie/TokenHub

Repository files navigation

TokenHub

TokenHub

TokenHub is a private enterprise AI gateway with role-based workspaces for users, team leaders, and administrators.

License Go 1.26 Next.js 16.2.9 React 19.2.7 SQLite first Docker Compose OpenAI Compatible i18n ZH EN JA

English | 简体中文 | 日本語

Screenshots

Login Console Gateway Overview
Login Console Gateway Overview
API Documentation Provider Channels
API Documentation Provider Channels
Model Catalog Routing Policies
Model Catalog Routing Policies
Usage Analytics System Settings
Usage Analytics System Settings

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

  • OpenAI-compatible model APIs: /v1/chat/completions, /v1/responses, /v1/embeddings; Anthropic Messages APIs: /v1/messages, /v1/messages/count_tokens.
  • Provider channels for OpenAI-compatible, Azure OpenAI, Anthropic, Gemini, DeepSeek, Qwen, local vLLM/Ollama, and custom upstreams.
  • Model catalog and routing policies with priority, weight, failover order, and route health diagnostics.
  • Project-scoped key management with team ownership, member permissions, quotas, and concurrency controls.
  • Usage analytics and request logs attributed to user, project, team, model, and cost center.
  • Identity source configuration for OAuth/OIDC enterprise sign-in, plus RBAC and audit trails.
  • Clean console with compact role-aware navigation, global search, light/dark mode, and split-view API documentation.
  • SQLite-first private deployment with Docker Compose support.
  • PostgreSQL supports multi-instance deployments: share state through remote PostgreSQL, scale frontend and backend replicas horizontally, and configure connection pools. See the deployment guide.
  • Console language switching for English, Chinese, and Japanese.
  • TokenHub can also connect OpenAI Codex subscription resources and route selected local Codex CLI or desktop sessions through an isolated, recoverable Codex profile. See the Codex integration guides.

Quick Start

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
  • Password: the value of TOKENHUB_BOOTSTRAP_ADMIN_PASSWORD

The deployment script validates production credentials, pulls published images, and starts the containers without building locally. Until the images are publicly available, a failed pull of the default latest tag automatically falls back to a local source build; an explicitly selected tag never does. The script reports each unsafe variable without printing secret values. If Compose fails because a backend container created or restarted by that attempt is unhealthy, it automatically shows only that attempt's recent backend logs. Use ./deploy/install.sh --build to request a local build explicitly.

Documentation

Contributors

TokenHub grows through product feedback, gateway integrations, documentation, tests, and the steady care of people who run it in real enterprise environments.

TokenHub contributors

View all contributors · Start contributing

Star History

GitHub Repo stars

Track TokenHub's growth on the live Star History chart.

License

TokenHub is licensed under the Apache License 2.0.

About

TokenHub is a private enterprise AI gateway with role-based workspaces for users, team leaders, and administrators.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages