explaingit

xuya-dev/token-hub

Analysis updated 2026-06-24

16VueAudience · developerComplexity · 4/5LicenseSetup · hard

TLDR

Self-hosted marketplace that pools spare OpenAI, Anthropic, Google, and DeepSeek quota behind one sk-hub key with usage-based billing.

Mindmap

mindmap
  root((TokenHub))
    Inputs
      Upstream API keys
      OpenAI or Anthropic requests
      Redemption codes
    Outputs
      Unified sk-hub key
      Routed model responses
      Earnings cut
    Use Cases
      Share spare AI quota
      Pool model access
      Self host an AI gateway
    Tech Stack
      Java
      Spring Boot
      MySQL
      Redis
      Vue
      Vite
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Self-host a gateway that pools spare OpenAI and Anthropic quota for a team

USE CASE 2

Earn a cut by selling unused API quota to other callers under one sk-hub key

USE CASE 3

Point the official OpenAI or Anthropic SDK at one endpoint and let TokenHub route it

USE CASE 4

Track per-call billing with pre-deduction, settlement, and refund stages

What is it built with?

JavaSpring BootMySQLRedisVueVite

How does it compare?

xuya-dev/token-hubshuaizai88/chatbiposva/nuxt-examples-data-loaders
Stars161718
LanguageVueVueVue
Setup difficultyhardhardeasy
Complexity4/54/52/5
Audiencedeveloperpm founderdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Needs Java 21, Node 20, MySQL 8, Redis 7, pnpm 10, plus secrets for JWT, AES-GCM encryption, and upstream API keys.

MIT, free to use, modify, and redistribute with attribution.

In plain English

TokenHub is a platform for sharing AI API access. The idea is that some people pay for accounts at OpenAI, Anthropic, Google, or DeepSeek and have spare quota sitting unused. They register that spare quota as a channel on TokenHub. Other people then use one unified key, in the format sk-hub-xxx, to call those models through TokenHub. The channel owner earns a configurable cut, between zero and fifty percent, every time their quota is used. For the caller side, the platform looks like an OpenAI or Anthropic endpoint. The README shows that pointing the official OpenAI or Anthropic SDK at TokenHub, by changing the base URL and API key, is enough to start using it. Behind that single endpoint, TokenHub routes the request to whichever channel has capacity, translates between OpenAI Chat Completions and Anthropic Messages formats when needed, and supports streaming responses through SSE. The billing model is described as three stages: a pre-deduction when the call starts, a real settlement based on actual token usage, and a refund if the call fails. Amounts are tracked in US dollars to eight decimal places. Users can earn free balance through a daily check-in, and admins can generate redemption codes to top up balances in bulk. The backend is Java 21 on Spring Boot 3.3.5, with MyBatis-Plus and Flyway for the database layer, Sa-Token for JWT and API-key authentication, Redis with Redisson for rate limiting and caching, and OkHttp for outbound calls. Upstream keys are stored encrypted with AES-GCM, and user keys are stored as SHA-256 hashes. The frontend is Vue 3 with Vite, TypeScript, Naive UI, UnoCSS, Pinia, and the SoybeanAdmin template. Installation needs Java 21, Node 20, MySQL 8, Redis 7, and pnpm 10. The README shows both a Maven dev-mode launch and a Docker Compose deployment, and lists the production environment variables for JWT secret, encryption key, CORS origins, and database credentials. License is MIT.

Copy-paste prompts

Prompt 1
Walk me through deploying TokenHub with Docker Compose and setting the JWT secret and encryption key
Prompt 2
Show me how a channel owner registers their OpenAI API key in TokenHub and sets the earnings cut
Prompt 3
Help me point the official Anthropic SDK at my TokenHub instance using an sk-hub key
Prompt 4
Explain how TokenHub translates between OpenAI Chat Completions and Anthropic Messages while streaming

Frequently asked questions

What is token-hub?

Self-hosted marketplace that pools spare OpenAI, Anthropic, Google, and DeepSeek quota behind one sk-hub key with usage-based billing.

What language is token-hub written in?

Mainly Vue. The stack also includes Java, Spring Boot, MySQL.

What license does token-hub use?

MIT, free to use, modify, and redistribute with attribution.

How hard is token-hub to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is token-hub for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.