AB
AiBoss
project

Sub2API - An open-source AI API gateway platform that supports multi-account management.

Sub2API is an open-source AI API gateway platform that supports unified access and management of subscriptions to mainstream AI services such as Claude, OpenAI, Gemini, and Antigravity. The platform provides multi-account management, API Key distribution, ...

What is Sub2API?

Sub2API is an open-source AI API gateway platform that supports unified access and management of subscriptions to mainstream AI services such as Claude, OpenAI, Gemini, and Antigravity. The platform offers features such as multi-account management, API Key distribution, token-level precise billing, intelligent scheduling, and concurrency control, enabling efficient cost sharing in a "carpooling" model. 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, making it suitable for individual developers or teams to build their own private AI API distribution systems.

Main functions of Sub2API

  • Multi-account managementSupports multiple authentication methods such as OAuth and API Key, and provides unified access to mainstream AI service accounts such as Claude, OpenAI, Gemini, and Antigravity.
  • API Key DistributionGenerate and manage independent API keys for downstream users, support custom prefixes, and implement secure access control.
  • Accurate billingProvides token-level usage tracking and real-time cost calculation to ensure transparent and accurate cost allocation.
  • Intelligent schedulingIt selects the optimal account through intelligent algorithms, supports sticky conversations, and ensures that the same conversation is always routed to the same upstream account.
  • Concurrency controlSupports setting concurrency limits by user and account to prevent overload of a single user or account from affecting the overall service stability.
  • Rate LimitingThe platform allows for flexible configuration of request frequency and token consumption rate.
  • Management BackendIt provides a fully functional web management interface that supports real-time monitoring, data statistics, and account management, and can be embedded into external systems such as payment systems.

Key information and usage requirements of Sub2API

  • Official domain:sub2api.org and pincc.ai(All other domains are deployed by third parties)
  • technology stack:Go + Vue3 + PostgreSQL + Redis
  • Open source licenseMIT License
  • Official hosting servicePinCC (No need to build it yourself, it's ready to use immediately)
  • operating systemLinux (amd64 or arm64)
  • Go versionVersion 1.21+ (compiled from source code)
  • Node.js18+ (Front-end development)
  • PostgreSQL15+
  • Redis7+

The core advantages of Sub2 API

  • Cost AllocationIt supports multiple users sharing AI subscription accounts and achieves fair cost sharing through token-level precise billing, significantly reducing the cost of personal use.
  • Unified AccessA single platform integrates mainstream AI services such as Claude, OpenAI, Gemini, and Antigravity, eliminating the need to manage multiple official accounts separately.
  • Native compatibilityDownstream users can directly use the official clients and tools (such as Claude Code and Codex CLI) without modifying the code or learning new interfaces.
  • Intelligent schedulingBuilt-in load balancing and sticky session mechanisms automatically select the optimal account and ensure conversation continuity, improving user experience and stability.
  • Flexible deploymentIt offers three deployment methods: one-click installation via script, Docker Compose, and source code compilation, to meet the needs of different technical levels and scenarios.
  • Fine managementIt supports multi-dimensional management such as concurrency limits, rate limits, and usage monitoring, effectively preventing account overload and triggering platform risk control.

How to use Sub2API

  • Method 1PinCC, the official managed service (recommended for beginners).
    • Access Registration:Open pincc.ai Complete account registration on the official website.
    • Recharge amountChoose a recharge package or pay-as-you-go to get your usage limit.
    • Generate keyCreate an API Key in the console for client authentication.
    • Configuration and useSimply enter the Base URL and API Key into the official client to start using it.
  • Method 2Self-built deployment (recommended for technical users)
    • Preparation stage
      • Environmental preparationPrepare a Linux server and install PostgreSQL 15+ and Redis 7+.
      • Perform installationRun the official one-click script to automatically complete program deployment and system service configuration.
      • Initialization configurationAccess server port 8080 to complete database connection and administrator account creation.
    • Configuration phase
      • Add upstreamAdd AI service accounts such as Claude and OpenAI in the management backend and complete the authorization.
      • Create userGenerate independent API keys for downstream users and assign usage quotas or billing rules.
      • Client accessUsers configure the Base URL and API Key provided by the platform into the official client tool.

Sub2API project address

  • Project official websitehttps://demo.sub2api.org/home
  • GitHub repositoryhttps://github.com/Wei-Shaw/sub2api

Sub2API Competitive Product Comparison

Comparison Dimensions Sub2API One API New API AI Gateway
Open source license MIT License MIT License MIT License Some open source/commercial versions
Deployment method Scripts/Docker/Source Code Docker/Source Code Docker/binary Docker/Cloud Services
Support Model Claude/OpenAI/Gemini OpenAI, Claude, Wenxin, Tongyi, etc. OpenAI, Claude, Gemini, etc. OpenAI/Anthropic/Custom Model
Core positioning Subscription quota distribution and carpooling Unified access and forwarding of multiple models High-performance API relay Enterprise-level API Management and Security
Billing accuracy Token-level precise billing Token-based billing Billing by use or by token Token-based billing
Account Management Multi-account intelligent scheduling + sticky conversations Multi-channel load balancing Multi-key polling Enterprise-level account pool management
User System Complete SaaS user system Simple User Management Basic User Management Enterprise-level RBAC permissions
Special features Carpooling cost sharing, simple model Channel retry, priority control Low-cost transit, high concurrency Audit logs, security compliance

Application scenarios of Sub2API

  • AI-powered carpooling subscriptionsMultiple users share the cost of expensive subscriptions such as Claude Pro and OpenAI Plus, achieving fair cost sharing through token-level precise billing, allowing individual developers to use top-tier AI models at a lower cost.
  • Unified management of team AI resourcesEnterprises or teams can centrally manage multiple AI service accounts, uniformly generate and distribute API keys to members, avoid security risks caused by directly sharing account passwords, and achieve fine-grained permission and usage control.
  • Personal multi-account aggregationIndividual users can integrate their AI accounts scattered across different platforms into a single entry point, eliminating the need to frequently switch between multiple official clients and allowing them to uniformly access various services such as Claude, Gemini, and OpenAI within a single interface.
  • AI service secondary distributionTechnology enthusiasts or small service providers can build private API relay stations to provide stable AI interface services to downstream users or customers, support custom billing strategies and quota management, and achieve lightweight SaaS operation.
  • Development and testing environment isolationProvides independent AI interface access channels for development and testing environments, completely isolated from production environment accounts, to prevent test traffic from triggering platform risk control or exhausting the quota of official accounts.