Repolode
TokenFlux

TokenFlux/TokenRouter

An open source unified LLM gateway that exposes Anthropic, OpenAI, Gemini and other vendor models behind one endpoint and API key.

Open-source alternative to:OpenRouter

Stars
385
Forks
53
Open issues
8
Last commit
2 days ago

What is it?

TokenRouter is an open source LLM gateway written in Go, with a Vue 3 frontend. It places model services from Anthropic, OpenAI, Gemini and other vendors behind a single endpoint, so a client can call models from different providers with one API key.

It accepts Anthropic Messages, OpenAI Responses and Chat Completions, and Gemini requests, and can convert between protocols that a group allows. Upstreams can be connected through OAuth accounts, API keys, AWS Bedrock or Vertex AI. Requests are routed by model, protocol support, rate limit state and sticky sessions, with failover to another upstream when one fails.

The project also includes user, team and API key management with quotas, concurrency and RPM limits, usage-based billing with subscriptions and payment integrations, keyword-based content moderation, and an admin dashboard for logs, statistics and alerts. It can be deployed with Docker Compose.

Key features

  • 01Exposes Anthropic, OpenAI, and Gemini request formats through one endpoint.
  • 02Connects upstreams via OAuth accounts, API keys, AWS Bedrock, or Vertex AI.
  • 03Routes requests by model, protocol support, rate limits, and sticky sessions, with failover.
  • 04Manages users, teams, and API key quotas, concurrency, and RPM limits.
  • 05Supports usage-based billing, subscriptions, and payment providers such as Stripe and Alipay.
  • 06Provides an admin dashboard with usage logs, statistics, and a Chinese/English UI.

Use cases

  • Giving a team one API key and one endpoint for models from several LLM vendors.
  • Running a shared internal LLM gateway with per-user quotas and usage tracking.
  • Operating a commercial API resale service with billing and payments built in.
  • Adding failover across multiple upstream accounts for the same model.

Quick start

  1. 1

    Create a deployment folder

    mkdir -p tokenrouter-deploy && cd tokenrouter-deploy
  2. 2

    Run the official install script from the README to download the Compose file and .env and generate secrets

  3. 3

    Start the services with Docker Compose

    docker compose up -d
  4. 4

    Find the generated admin password in the logs, then open http://localhost:8080

    docker compose logs tokenrouter | grep "admin password"

Things to know

  • Deployment is self-hosted and requires Docker and Compose setup.
  • You must supply your own upstream vendor accounts or API keys.
  • The LGPL-3.0 license is copyleft, and the project forbids impersonating the official TokenFlux service.

Topics

FAQ

What is TokenRouter?
An open source unified LLM gateway that exposes Anthropic, OpenAI, Gemini and other vendor models behind one endpoint and API key. TokenRouter is an open source LLM gateway written in Go, with a Vue 3 frontend. It places model services from Anthropic, OpenAI, Gemini and other vendors behind a single endpoint, so a client can call models from different providers with one API key.
Is TokenRouter free to use? What license does it have?
TokenRouter is open source under the LGPL-3.0 license. Check the license terms before using it in commercial products.
Is TokenRouter still maintained?
Actively maintained. The last commit to TokenRouter was on Oct 19, 2026.
What can I use TokenRouter for?
Giving a team one API key and one endpoint for models from several LLM vendors. Running a shared internal LLM gateway with per-user quotas and usage tracking. Operating a commercial API resale service with billing and payments built in. Adding failover across multiple upstream accounts for the same model.
How do I install TokenRouter?
Create a deployment folder: mkdir -p tokenrouter-deploy && cd tokenrouter-deploy Run the official install script from the README to download the Compose file and .env and generate secrets Start the services with Docker Compose: docker compose up -d Find the generated admin password in the logs, then open http://localhost:8080: docker compose logs tokenrouter | grep "admin password"
Where can I get TokenRouter?
The source code and installation instructions are on GitHub: https://github.com/TokenFlux/TokenRouter

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects