What is Sub2API
Sub2API is an open-source AI API relay gateway platform that supports unified access and management of subscriptions to mainstream AI services such as Claude, OpenAI, Gemini, and Antigravity. The platform provides features including multi-account management, API Key distribution, Token-level precise billing, intelligent scheduling, and concurrency control, enabling a "carpool sharing" model to efficiently share subscription costs. Users can access upstream AI services through API Keys generated by the platform, and native client tools can be used seamlessly. Sub2API uses a Go + Vue technology stack and is suitable for individual developers or teams to build a private AI API distribution system.
Main features of Sub2API
-
Multi-account management: Supports multiple authentication methods such as OAuth and API Key, and provides unified access to accounts for mainstream AI services including Claude, OpenAI, Gemini, and Antigravity.
-
API Key distribution: Generates and manages independent API Keys for downstream users, supports custom prefixes, and enables secure access control.
-
Precise billing: Provides Token-level usage tracking and real-time cost calculation, ensuring transparent and accurate cost sharing.
-
Intelligent scheduling: Selects the optimal account through intelligent algorithms and supports sticky sessions, ensuring that the same conversation is always routed to the same upstream account.
-
Concurrency control: Supports setting concurrency limits by user and by account, preventing overload of a single user or account from affecting overall service stability.
-
Rate limiting: The platform can flexibly configure request frequency and Token consumption rate.
-
Admin panel: Provides a fully featured web management interface with real-time monitoring, data statistics, and account management, and can integrate external systems such as payment.
Key information and usage requirements for Sub2API
-
Official domains:
sub2api.organdpincc.ai(all other domains are third-party deployments) -
Technology stack:Go + Vue3 + PostgreSQL + Redis
-
Open-source license:MIT License
-
Official hosted service: PinCC (no self-hosting required, ready to use immediately)
-
Operating system: Linux (amd64 or arm64)
-
Go version: 1.21+ (source code compilation)
-
Node.js: 18+ (frontend development)
-
PostgreSQL:15+
-
Redis:7+
Core advantages of Sub2API
- Cost sharing: Supports multiple people sharing AI subscription accounts, achieves fair cost sharing through Token-level precise billing, and greatly reduces individual usage costs.
- Unified access: A single platform integrates mainstream AI services such as Claude, OpenAI, Gemini, and Antigravity, eliminating the need to manage multiple official accounts separately.
- Native compatibility: Downstream users can directly use official clients and tools (such as Claude Code and Codex CLI) without modifying code or learning a new interface.
- Intelligent scheduling: Built-in load balancing and sticky session mechanisms automatically select the optimal account and ensure conversation continuity, improving user experience and stability.
- Flexible deployment: Provides three deployment methods: one-click script installation, Docker Compose, and source code compilation, meeting the needs of different technical skill levels and scenarios.
- Fine-grained control: Supports multi-dimensional controls such as concurrency limits, rate limits, and usage monitoring, effectively preventing account overload and triggering platform risk controls.
How to use Sub2API
- Method 1: Official hosted service PinCC (recommended for beginners)
- Visit and register: Open the
pincc.aiofficial website to complete account registration. - Top up credits: Choose a subscription plan to top up or pay-as-you-go to obtain usage credits.
- Generate a key: Create an API Key in the console for client authentication.
- Configure and use: Enter the Base URL and API Key into the official client to start using it.
- Visit and register: Open the
- Method 2: Self-hosted deployment (recommended for technical users)
- Preparation stage
- Environment preparation: Prepare a Linux server and install PostgreSQL 15+ and Redis 7+.
- Run the installation: Run the official one-click script to automatically complete program deployment and system service configuration.
- Initial configuration: Access port 8080 on the server to complete the database connection and create an administrator account.
- Configuration stage
- Add upstreams: Add AI service accounts such as Claude and OpenAI in the admin backend and complete authorization.
- Create users: Generate independent API Keys for downstream users and allocate usage credits or billing rules.
- Client integration: Users configure the Base URL and API Key provided by the platform into the official client tools.
- Preparation stage
Sub2API project address
- Project official website:https://demo.sub2api.org/home
- GitHub repository:https://github.com/Wei-Shaw/sub2api
Comparison of Sub2API with similar competitors
| Comparison dimension | Sub2API | One API | New API | AI Gateway |
|---|---|---|---|---|
| Open-source license | MIT License | MIT License | MIT License | Partially open source/commercial version |
| Deployment method | Script/Docker/Source code | Docker/Source code | Docker/Binary | Docker/Cloud service |
| Supported models | Claude/OpenAI/Gemini | OpenAI/Claude/ERNIE/Tongyi, etc. | OpenAI/Claude/Gemini, etc. | OpenAI/Anthropic/Self-hosted models |
| Core positioning | Subscription quota distribution and carpooling sharing | Unified multi-model access and forwarding | Cost-effective API relay | Enterprise-grade API management and security |
| Billing precision | Token-level precise billing | Token-level billing | Per-request or token billing | Token-level billing |
| Account management | Multi-account intelligent scheduling + sticky sessions | Multi-channel load balancing | Multi-key polling | Enterprise-grade account pool management |
| User system | Complete SaaS user system | Simple user management | Basic user management | Enterprise-grade RBAC permissions |
| Featured functions | Carpooling cost sharing, simple mode | Channel retry, priority control | Low-cost relay, high concurrency | Audit logs, security compliance |
Sub2API Use Cases
- AI Subscription Carpooling and Sharing: Multiple people jointly share the cost of expensive subscriptions such as Claude Pro and OpenAI Plus, achieving fair cost sharing through precise token-level billing, allowing individual developers to use top-tier AI models at a lower cost.
- Unified Management of Team AI Resources: Enterprises or teams centrally manage multiple AI service accounts, uniformly generate and distribute API Keys for members to use, avoiding the security risks caused by directly sharing account passwords, while also achieving fine-grained permission and usage control.
- Personal Multi-Account Aggregation: Individual users integrate AI accounts scattered across different platforms into a single entry point, eliminating the need to frequently switch between multiple official clients, and uniformly call various services such as Claude, Gemini, and OpenAI within one interface.
- Secondary Distribution of AI Services: Tech enthusiasts or small service providers can set up private API relay stations to provide stable AI interface services for downstream users or customers, support custom billing strategies and quota management, and achieve lightweight SaaS-style operations.
- Development and Testing Environment Isolation: Provide independent AI interface access channels for development and testing environments, completely isolated from production environment accounts, preventing test traffic from triggering platform risk controls or exhausting the quota of official accounts.