Sub2API is a self-hosted gateway written in Go that sits between your AI coding tools and the upstream APIs of Claude, OpenAI, Gemini, and Grok. It's built for people who want to pool subscription quota across multiple accounts or multiple users (often called "quota carpooling") and expose it through a single, unified API endpoint. The project targets developers and small teams running tools like Claude Code, Codex, or Gemini CLI who want to share costs on subscription-based AI access rather than pay full price per seat.
The stack pairs a Go backend with a Vue 3 frontend, backed by PostgreSQL for storage and Redis for caching/session handling. It ships with Docker support, which is the expected way to run it in production.
Before using it, read the project's own disclaimer: routing subscription-tier access through a gateway like this may violate the terms of service of Anthropic and other upstream providers. The maintainers state the project is for technical learning and research, that all risk from use falls on the user, and that no individual or organization is authorized to run commercial operations under the project's name.
Sub2API fits a small group or team that already holds multiple AI subscriptions (Claude, ChatGPT, Gemini, Grok) and wants to centralize access behind one gateway so tools and scripts don't need per-provider credentials scattered everywhere. It also fits someone experimenting with API gateway patterns for AI providers, or running a personal lab where several coding assistants need to hit different backends through one interface.
It is not a good fit if you need a commercially licensed, provider-sanctioned relay: the project explicitly disclaims any commercial use and warns that this kind of usage can violate upstream terms of service, risking account suspension. It's also not the right tool if you need guaranteed uptime or an SLA-backed integration; the project is community-run open source with no warranty. Teams with strict compliance requirements around vendor ToS should look at officially sanctioned enterprise API plans instead.
The repository is set up for container-based deployment, matching the Docker badge in its documentation. The general flow for standing it up:
git clone https://github.com/Wei-Shaw/sub2api.git
cd sub2api
Provision the required backing services (PostgreSQL 15+ and Redis 7+), then configure connection details for your database and cache as expected by the app's configuration. From there, build and run via Docker:
docker compose up -d
If you prefer running from source, the backend requires Go 1.25.7, and the frontend requires Node.js with npm/yarn to build the Vue 3 application:
# backend
go build ./...
# frontend
cd frontend
npm install
npm run build
Consult the project's full README and configuration files for exact environment variables, ports, and database migration steps, since specifics can vary by deployment target (bare metal vs. Docker vs. reverse proxy setup).