Skip to content

About

tokenrouter is the next generation llm gateway

Resources

Stars

380 stars

Watchers

1 watching

Forks

Latest commit

 

History

9,348 Commits

Folders and files

Repository files navigation

TokenRouter

TokenRouter

An open source unified LLM gateway

CI Release Container License: LGPL-3.0-or-later

简体中文 | English

Join our Discord community

Overview

TokenRouter is an open source unified LLM gateway. It puts model services from Anthropic, OpenAI, Gemini, and other vendors behind one endpoint, so a client can call models from different vendors with a single API key.

Warning

Commercial API gateway services are permitted under the applicable open-source licenses. You must not impersonate the official TokenFlux service or use names, logos, domains, interfaces, or promotional materials that misleadingly suggest official operation, authorization, partnership, or endorsement by TokenFlux. Commercial operators are encouraged to customize the frontend and clearly identify the actual operator. The relevant rights holders reserve the right to seek corrective action under applicable law for infringement or such confusion. See the Commercial Use and Branding Notice.

Screenshots

Light mode

Dashboard

TokenRouter Dashboard · Light mode

Model Marketplace

TokenRouter Model Marketplace · Light mode
Dark mode

Dashboard

TokenRouter Dashboard · Dark mode

Model Marketplace

TokenRouter Model Marketplace · Dark mode

Visit the service officially operated by TokenFlux at tokenflux.dev.

Capabilities

Area What you can do
Model access Accept Anthropic Messages, OpenAI Responses, Chat Completions, and Gemini requests, and convert between the protocols a group allows
Upstream platforms Connect Anthropic, OpenAI, Gemini, Antigravity, Grok, Qoder, Kimi, Zhipu, and DeepSeek through OAuth accounts, API keys, AWS Bedrock, or Vertex AI
Routing and retries Pick an upstream by model, protocol support, rate limit state, and sticky sessions, and move to the next one when an upstream fails
Access control Manage users, teams, groups, and API key quotas, concurrency, and RPM limits. Sign in with email and password, passkeys, two-factor authentication, GitHub, Google, LinuxDo, OIDC, WeChat, or DingTalk
Billing and payments Charge by usage, with balance, subscription plans, quota packs, redeem codes, and referral rebates. Built-in payments support EasyPay, Alipay, WeChat Pay, Stripe, and Airwallex
Content moderation Block requests with keyword and hash rules, and ban offending users automatically
Admin dashboard Browse usage logs and statistics, set up alerts and email reports, and upgrade or roll back online. The creative studio generates and edits images in the browser. The UI is available in Simplified Chinese and English

Protocols and Endpoints

Type Common endpoints
Anthropic Messages POST /v1/messages
OpenAI Responses / Chat POST /v1/responses, POST /v1/chat/completions
Gemini POST /v1beta/models/{model}:generateContent, POST /v1beta/models/{model}:streamGenerateContent
WebSocket GET /v1/responses, GET /v1/realtime
Embeddings POST /v1/embeddings
Images /v1/images/generations, /v1/images/edits, /v1/images/batches
Video /v1/videos/generations, /v1/videos/edits, /v1/videos/extensions
Voice /v1/tts, /v1/stt, /v1/custom-voices
Search /v1/web_search, /v1/x_search, /v1/alpha/search
Models and usage GET /v1/models, GET /v1/usage

The upstream provider capability matrix (Chinese) lists which upstream platforms serve each endpoint.

Quick Start

Deploy with Docker Compose:

mkdir -p tokenrouter-deploy && cd tokenrouter-deploy

# Download the Compose file and .env, and generate the database password and secrets
curl -sSL https://raw.githubusercontent.com/TokenFlux/TokenRouter/main/deploy/docker-deploy.sh | bash

docker compose up -d

Then open http://localhost:8080. You can set the admin password with ADMIN_PASSWORD in .env. If it is not set, TokenRouter generates a random password and prints it to the log:

docker compose logs tokenrouter | grep "admin password"

The deployment guide (Chinese) covers other options such as the install script and standalone containers.

Development

The backend is written in Go and the frontend in Vue 3. To run the full stack from source:

docker compose -f deploy/docker-compose.dev.yml up --build

Development workflow (Chinese) lists the required toolchain versions, how to run the backend and frontend separately, and the test commands.

Documentation

License

This project is distributed under the GNU Lesser General Public License v3.0 or later.

Copyright (c) 2026 Wesley Liddick & TokenFlux

Star History

Star History Chart

About

tokenrouter is the next generation llm gateway

Resources

Stars

380 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages