TokenFlux/TokenRouter

tokenrouter is the next generation llm gateway

What it solves

TokenRouter solves the problem of managing multiple LLM providers separately. Instead of writing code for each vendor's API, a client can use one endpoint and one API key to reach Anthropic, OpenAI, Gemini, and others. It also handles protocol conversion, automatic failover when an upstream fails, user access control, billing, and content moderation in one place.

How it works

TokenRouter accepts requests in several common formats: Anthropic Messages, OpenAI Responses, Chat Completions, and Gemini requests. It converts between these protocols as needed for the chosen upstream provider. The gateway picks an upstream based on the requested model, protocol support, rate limits, and sticky sessions. If an upstream returns an error, it tries the next one.

Administrators set up upstream connections via OAuth, API keys, AWS Bedrock, or Vertex AI. The dashboard manages users, teams, groups, API key quotas, concurrency limits, and rate limits. Sign-in options include email/password, passkeys, two-factor authentication, and social login providers.

Billing is usage-based, with balance, subscription plans, quota packs, redeem codes, and referral rebates. Payment integrations include EasyPay, Alipay, WeChat Pay, Stripe, Airwallex, and EPUSDT.

The system can block requests using keyword and hash rules and automatically ban offending users. An admin dashboard shows usage logs, statistics, alerts, and email reports. The UI is available in Simplified Chinese and English.

Plugins extend functionality without modifying the core. They can add pages, HTTP APIs, and scheduled tasks. Installation is via a catalog, custom source, or uploaded package, and plugins run as trusted code outside a sandbox.

Who it's for

TokenRouter is for developers and organizations that want a single gateway to access multiple LLM providers, with billing, access control, and moderation. It's also for anyone who wants to run their own LLM API service with a customizable frontend and plugin ecosystem.

Highlights

  • Single endpoint for Anthropic, OpenAI, Gemini, and more, with automatic protocol conversion
  • Failover routing based on model, protocol, rate limits, and sticky sessions
  • Built-in billing with balance, subscriptions, quota packs, and redeem codes
  • Extensible plugin system with SDKs for Go and Web (Vue)
  • Content moderation with keyword and hash rules, plus automatic user banning
  • Admin dashboard with usage analytics, alerts, and online upgrades
  • Supports WebSocket, embeddings, images, video, voice, and search endpoints

Related

  • Project
  • Project
  • Project
  • Project