One email each morning — yesterday's AI, sortedGet it in your inbox

METAL LAB

Wei-Shaw/sub2api

38,699+673 todayGo

A relay server that lets one Claude/OpenAI/Gemini/Grok subscription be shared by many users

Sub2API is a gateway program: you register subscription or API-key accounts for services like Claude, OpenAI, Gemini, and Grok, and it issues separate API keys so multiple users can share the pooled quota. It tracks usage down to the token level for accurate billing and automatically spreads requests across healthy accounts. It's an open-source Go project you self-host via Docker or an install script.

What it does

  1. Issues individual API keys against a shared pool of subscription accounts and calculates cost at the token level so usage can be split fairly among users
  2. Supports both OAuth-login accounts and API-key accounts, auto-routes requests to healthy accounts, and enforces per-user and per-account concurrency and rate limits
  3. Provides compatible endpoints so coding tools like Claude Code, Codex, and Gemini CLI connect the same way they normally would, plus dedicated support for Grok and Antigravity accounts
  4. Includes a built-in payment system (Alipay, WeChat Pay, Stripe, EasyPay) and an admin dashboard, so users can self-service top up without a separate billing system
  5. Backend built on Go 1.26.5, Gin, PostgreSQL, and Redis with a Vue 3 frontend, deployable via install script, Docker Compose, or building from source

Why it matters

It's a practical piece of infrastructure for developers or small teams trying to cut costs by pooling expensive AI subscriptions. The README explicitly warns that using it may violate upstream providers' terms of service, so there's real legal and account-ban risk attached.

Terms in this repo

  • OAuth · a standard way of delegating login authentication using tokens instead of passwords
  • API gateway · a server that centrally handles authentication, billing, and routing for requests to other services
  • sticky session · routing a given user's requests to the same account/backend every time

Repository description (English)

Sub2API 一站式开源中转服务,让 Claude、Openai 、Gemini、Grok订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。

Open on GitHub

Trending repos

All repos →

Latest from METAL LAB