Self-host a gateway that pools spare OpenAI and Anthropic quota for a team
Earn a cut by selling unused API quota to other callers under one sk-hub key
Point the official OpenAI or Anthropic SDK at one endpoint and let TokenHub route it
Track per-call billing with pre-deduction, settlement, and refund stages
Needs Java 21, Node 20, MySQL 8, Redis 7, pnpm 10, plus secrets for JWT, AES-GCM encryption, and upstream API keys.
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.
Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.