sub2api
Sub2API 一站式开源中转服务,让 Claude、Openai 、Gemini、Grok订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。
- 44.7k stars
- 9.6k forks
- 3,714 open issues
- Language: Go
- License: LGPL-3.0
- updated
Install
git clone https://github.com/Wei-Shaw/sub2api- Clone the repository.
- Follow the README for installation and usage instructions.
Editor's note
Sub2API is a self-hosted API gateway written in Go that converts Claude, OpenAI, Gemini, and Antigravity subscription accounts into a shared OpenAI-compatible endpoint, letting multiple users consume upstream quota through platform-issued API keys. Operators deploy it via Docker with PostgreSQL and Redis backing, then manage accounts through a Vue 3 admin dashboard that covers load balancing, sticky session scheduling, per-user and per-account concurrency limits, and token-level billing. The platform includes a built-in payment system supporting Stripe, Alipay, WeChat Pay, and EasyPay so end users can top up without a separate service. It is directly compatible with Claude Code, OpenAI Codex, and Gemini CLI by presenting a unified endpoint those tools can target. A notable detail is the concurrency control layer, which enforces simultaneous request caps at both the user and upstream account levels to prevent quota exhaustion. The primary audience is developers or small teams who want to pool subscription costs across multiple users without each person managing their own credentials.
Tools overview
Sub2API
AI API Gateway Platform for Subscription Quota Distribution
⚠️ Important Notice
Please read the following carefully before using this project:
🚨 Terms of Service Risk: Using this project may violate the terms of service of Anthropic and other upstream providers. Please review the relevant providers' user agreements before use; all risks arising from such use are borne solely by the user.
⚖️ Compliant Use: Use this project only in compliance with the laws and regulations of your country or region. Any unlawful use is strictly prohibited.
📖 Disclaimer: This project is provided for technical learning and research purposes only. The authors assume no liability for account bans, service interruptions, data loss, or any other direct or indirect damages resulting from the use of this project.
🚫 No Commercial Authorization: The developers of this project have never authorized any individual or organization to conduct any form of commercial operation based on this project. Any commercial activity conducted in the name of or based on this project is unrelated to this project and its developers, and all resulting disputes, losses, and legal liabilities shall be borne solely by the party conducting such activity.
❤️ Sponsors
Thanks to CCTK.AI for sponsoring this project! CCTK.AI is an AI API gateway focused on stability and cost-effectiveness, offering fast relay services for Claude, OpenAI, Gemini, and other popular models. It works seamlessly with Claude Code, Codex, and other mainstream coding tools, delivering the same model capabilities at a fraction of the official cost. Register via this link for faster, more stable, and more affordable AI API access.
One API, every top model! OpenModel is a production-grade, high-availability AI API gateway that makes your applications truly fast and stable: automatic failover, smart routing to the best-performing channel, and a production-grade SLA. An SLA that far surpasses any single provider — making stability your core competitive advantage. Works directly with Claude Code, Codex, and Gemini CLI. Register via this link to get started.
Thanks to ETok.ai for sponsoring this project! ETok.ai is dedicated to building a one-stop AI programming tool service platform. We offer professional Claude Code packages and technical community services, with support for Google Gemini and OpenAI Codex. Through carefully designed plans and a professional tech community, we provide developers with reliable service guarantees and continuous technical support, making AI-assisted programming a true productivity tool. Click here to register!
Thanks to APIKEY.FUN for sponsoring this project! APIKEY.FUN is one of the core contributors to the sub2api open-source project, dedicated to providing open, stable, and cost-effective AI API access. The platform supports API relay services for Claude, OpenAI, Gemini, and other popular models, with pricing starting from as low as 7% of the original rate. Register via the exclusive link: APIKEY to enjoy up to 5% off on all recharges.
Thanks to AIGoCode for sponsoring this project! AIGoCode is an all-in-one platform that integrates Claude Code, Codex, and the latest Gemini models, providing you with stable, efficient, and highly cost-effective AI coding services. The platform offers flexible subscription plans, zero risk of account suspension, direct access with no VPN required, and lightning-fast responses. AIGoCode has prepared a special benefit for sub2api users: if you register via this link, you'll receive an extra 10% bonus credit on your first top-up!
Real GPT-5.6 series at 3% of OpenAI pricing — CodexEverywhere is democratizing access to frontier models for developers worldwide. We believe in transparency and honesty, with model quality verified by active community oversight for months. USD and crypto friendly. Start with a free $20 trial at codex-everywhere.com.
Thanks to Bestproxy for sponsoring this project! Bestproxy provides high-purity residential IPs with dedicated one-IP-per-account support. By combining real home networks with fingerprint isolation, it enables link environment isolation and reduces the probability of association-based risk control.
Thanks to PatewayAI for sponsoring this project! PatewayAI is a premium API relay built for heavy AI developers, offering the full Claude and Codex series sourced 100% from official providers, with transparent token-level billing. Enterprise plans include high concurrency, dedicated management, contracts, and invoicing. Register now to get $3 in trial credits, top-ups from 60% off, and referral bonuses up to $150.
Thanks to PPToken.cc for sponsoring this project! PPToken.cc specializes in GPT model API relay services, supporting Codex, Claude Code, OpenAI-compatible clients, and Gemini CLI integration. Top-ups are 1:1 (¥1 = $1 credit); GPT models start at 0.16x rate multiplier, with overall cost at roughly 2.2% of official pricing and first-token latency around 1 second — ideal for developers seeking low-cost, high-speed access to GPT model capabilities. Technical support: 24/7 real human responses (no bots), @tech in the group chat and get a reply within 10 minutes. Sponsor benefit: the first 200 users who register via the exclusive registration link and enter promo code SUB2API can claim free Codex / Claude Code trial credits — no minimum spend, no card required.
Thanks to Veilx for sponsoring this project! Veilx CDN is purpose-built for large-scale AI API traffic, deeply optimized for relay services and call chains across OpenAI, Claude, Gemini, and scenarios like chat, image generation, embeddings, and streaming — delivering lower latency and higher stability under heavy concurrency. It also offers China three-network optimized return lines, making it ideal for global AI relay platforms, overseas AI SaaS, and cross-border high-concurrency deployments.
Thanks to RoxyBrowser for sponsoring this project! RoxyBrowser RoxyBrowser is the perfect partner for Sub2API: it features a built-in native Roxy AI Agent and high-quality native residential IPs, supports batch automation via simple commands, and significantly boosts security and efficiency for multi-account management! Click this link to sign up and receive a free residential IP package plus a 10% lifetime discount.
What people ask about sub2api
What is Wei-Shaw/sub2api?
Wei-Shaw/sub2api is tools for the Claude AI ecosystem. Sub2API 一站式开源中转服务,让 Claude、Openai 、Gemini、Grok订阅统一接入,支持拼车共享,更高效分摊成本,原生工具无缝使用。 It has 44.7k GitHub stars and its last recorded update is dated 2026-10-23.
How do I install sub2api?
You can install sub2api by cloning the repository (https://github.com/Wei-Shaw/sub2api) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.
Is Wei-Shaw/sub2api safe to use?
Our security agent has analyzed Wei-Shaw/sub2api and assigned a Trust Score of 97/100 (tier: Verified). See the full breakdown of passed checks and flags on this page.
Who maintains Wei-Shaw/sub2api?
Wei-Shaw/sub2api is maintained by Wei-Shaw. The last recorded GitHub activity is dated 2026-10-23, with 3714 open issues.
Are there alternatives to sub2api?
Yes. On ClaudeWave you can browse similar tools at /categories/tools, sorted by popularity or recent activity.
Maintain this repo? Show its Trust Score in your README
The badge shows this repository's current Trust Score and verdict, and links back to this page. It follows the catalogue data: nobody can buy or edit the score it displays.
[](https://claudewave.com/en/repo/wei-shaw-sub2api)<a href="https://claudewave.com/en/repo/wei-shaw-sub2api"><img src="https://claudewave.com/api/badge/wei-shaw-sub2api" alt="ClaudeWave Trust Score for Wei-Shaw/sub2api" width="320" height="64"></a>