Sub2API: The Complete Guide to the AI API Gateway for Subscription Management
Sub2API is an AI API gateway platform designed to distribute and manage API quotas from AI product subscriptions. Unify Claude, OpenAI, Gemini, and Antigravity access through platform-generated API keys with token-level billing, smart scheduling, concurrency control, and rate limiting. 4,000+ stars, Go, MIT.
What Is Sub2API?
An open-source API gateway that sits between users and AI services. Organizations purchase AI subscriptions (like Claude Code at $200/month) and distribute access to team members through Sub2API-generated API keys. The platform handles authentication, billing, load balancing, and request forwarding.
- Stars: 4,000+ ⭐
- Forks: 656
- Releases: 82
- Contributors: 59
- Language: Go
- License: MIT
- Topics: claude-code, codex, gemini, crs2
Key Features
👥 Multi-Account Management
Support multiple upstream account types including OAuth and API Key authentication. Manage pools of accounts for load distribution.
🔑 API Key Distribution
Generate and manage API keys for individual users. Each key tracks usage independently.
💰 Precise Token-Level Billing
Track usage at the token level for accurate cost calculation. Know exactly what each user consumes.
🧠 Smart Scheduling
Intelligent account selection with sticky sessions — ensures consistent routing while optimizing load distribution.
🔒 Concurrency Control
Per-user and per-account concurrency limits prevent any single user from monopolizing resources.
⏱️ Rate Limiting
Configurable request and token rate limits protect upstream services and ensure fair usage.
📊 Admin Dashboard
Web interface for monitoring usage, managing users, and system configuration.
🔧 Simple Mode
For individual developers or internal teams who want quick access without full SaaS features. Set RUN_MODE=simple to skip billing.
Deployment Options
| Method | Command |
|---|---|
| Script Install (Recommended) | One-line install script |
| Docker Compose (Recommended) | Docker stack |
| Build from Source | go build |
Sub2API vs Alternatives
Category: This is an AI API gateway for subscription quota management.
| Feature | Sub2API | One API | LiteLLM | OpenRouter |
|---|---|---|---|---|
| Focus | AI subscription gateway | OpenAI API proxy | LLM proxy | LLM routing |
| Stars | 4K ⭐ | ~20K ⭐ | ~18K ⭐ | N/A (SaaS) |
| Token Billing | ✅ Precise | ✅ | ✅ | ✅ |
| Smart Scheduling | ✅ Sticky sessions | Basic | ✅ | ✅ |
| Concurrency Control | ✅ Per-user/account | Limited | ✅ | N/A |
| Multi-Account Pool | ✅ | ✅ | ✅ | N/A |
| API Key Distribution | ✅ | ✅ | ✅ | ✅ |
| Admin Dashboard | ✅ Web UI | ✅ | ✅ | ✅ |
| Simple Mode | ✅ | ❌ | ❌ | ❌ |
| Self-Hosted | ✅ Go | ✅ Go | ✅ Python | ❌ Cloud |
| Rate Limiting | ✅ | ✅ | ✅ | ✅ |
When to choose Sub2API: You want a self-hosted AI API gateway specifically designed for managing subscription quotas with precise billing and multi-account scheduling.
When to choose One API: You want a general OpenAI-compatible API proxy with broader model support.
When to choose LiteLLM: You want a Python-based LLM proxy with extensive model provider support.
Conclusion
Sub2API is a focused, well-engineered AI API gateway for organizations that need to distribute AI subscription access efficiently. With token-level billing, smart scheduling, concurrency control, and an admin dashboard, it turns expensive AI subscriptions into manageable, accountable shared resources. 4K stars and 82 releases in Go.
