sub2api  by Wei-Shaw

AI API gateway for unified subscription management and cost sharing

Created 3 weeks ago

New!

541 stars

Top 58.7% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Sub2API is an AI API gateway platform designed for managing and distributing API quotas from various AI services like Claude, OpenAI, and Gemini. It targets users and teams seeking unified access, efficient cost-sharing, and streamlined management of AI subscriptions, offering a centralized solution for authentication, billing, and request forwarding.

How It Works

The platform acts as an intermediary, allowing users to obtain generated API Keys that route requests through Sub2API. It handles upstream account authentication (OAuth, API Key), token-level usage tracking for precise billing, intelligent load balancing across multiple accounts, and enforces concurrency and rate limits. The architecture comprises a Go backend (Gin, GORM) and a Vue 3 frontend, leveraging PostgreSQL for data persistence and Redis for caching/queuing.

Quick Start & Requirements

Installation is supported via a one-click Linux script (requiring PostgreSQL 15+ and Redis 7+), Docker Compose (v2+), or building from source (Go 1.21+, Node.js 18+). Prerequisites include a Linux server, PostgreSQL, and Redis. A shared demo is available at https://v2.pincc.ai/ with credentials admin@sub2api.com/admin123.

Highlighted Details

  • Supports multi-account management for various upstream AI providers.
  • Features precise token-level usage tracking and cost calculation.
  • Implements smart scheduling, concurrency control, and rate limiting.
  • Offers an Admin Dashboard for monitoring and management.
  • Provides dedicated endpoints and hybrid scheduling for Antigravity accounts (Claude, Gemini).

Maintenance & Community

The project utilizes modern technologies (Go 1.21+, Vue 3.4+) suggesting active development. No specific community channels (Discord, Slack) or detailed contributor information are provided in the README.

Licensing & Compatibility

Sub2API is released under the MIT License, which is permissive and generally suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The provided demo environment is shared and not automatically provisioned for self-hosted installs. Users must be aware that Anthropic Claude and Antigravity Claude cannot be mixed within the same conversation context due to potential context inconsistencies. Building from source requires more involved setup than the script or Docker methods.

Health Check
Last Commit

22 hours ago

Responsiveness

Inactive

Pull Requests (30d)
135
Issues (30d)
100
Star History
555 stars in the last 24 days

Explore Similar Projects

Feedback? Help us improve.