HubLensGoWei-Shaw/sub2api
// archived 2026-04-27
Wei-Shaw

sub2api

Backend#Go#Vue#PostgreSQL#Redis#Docker
View on GitHub
26

// summary

Sub2API is an AI API gateway platform designed to manage and distribute API quotas from various AI product subscriptions. It provides essential features such as multi-account management, precise token-level billing, and intelligent request scheduling. The platform also includes a built-in payment system and an admin dashboard to streamline user management and monitoring.

// technical analysis

Sub2API is an AI API gateway platform built with a modern stack (Go, Vue, PostgreSQL, Redis) designed to centralize the management and distribution of AI subscription quotas. It solves the complexity of managing multiple upstream AI accounts by providing a unified interface for authentication, billing, and request routing. The platform prioritizes operational control through features like smart scheduling, concurrency limits, and a built-in payment system, making it a robust solution for developers or service providers looking to monetize or share AI model access.

// key highlights

01
Supports multi-account management by integrating various upstream AI service types including OAuth and API Keys.
02
Provides precise, token-level usage tracking and cost calculation to ensure accurate billing for end-users.
03
Implements smart scheduling and sticky sessions to optimize request routing across multiple upstream accounts.
04
Features a built-in payment system supporting Alipay, WeChat Pay, and Stripe, eliminating the need for external billing services.
05
Offers granular control over API usage through configurable concurrency limits and request rate limiting.
06
Includes an extensible admin dashboard that supports iframe integration for managing external systems like ticketing.

// use cases

01
Centralized management and distribution of AI API quotas
02
Token-level usage tracking and automated billing
03
Intelligent load balancing and concurrency control for AI services

// getting started

To begin, you can deploy the platform using the provided one-click script for Linux or the Docker Compose configuration for a containerized setup. After deployment, access the web interface on port 8080 to complete the initial setup wizard, which configures your database, Redis connection, and administrative credentials. For developers, the project also supports building from source with Go and Node.js for custom environments.