AI API gateway that distributes and manages subscription quotas for Claude, OpenAI, Gemini and Grok, with API key issuing, token-level billing and load balancing.
AI API gateway that distributes and manages subscription quotas for Claude, OpenAI, Gemini and Grok, with API key issuing, token-level billing and load balancing.
Sub2API is an AI API gateway platform that distributes and manages the quotas of AI product subscriptions. Users reach upstream providers through platform-issued API keys, while the gateway takes care of authentication, billing, load balancing and request forwarding.
This template deploys the complete stack:
https://<your-domain>.admin@sub2api.local and the auto-generated ADMIN_PASSWORD by default; both also appear in the service's variables).https://<your-domain>/v1https://<your-domain>https://<your-domain>/app/data on the Sub2API service holds config.yaml (generated once by AUTO_SETUP) and application logs; it must stay mounted for the generated JWT_SECRET to survive restarts.weishaw/sub2api:latest) keeps the data: the app detects the existing configuration instead of running setup again. You can also upgrade in-place from the dashboard's Check for Updates button.TOTP_ENCRYPTION_KEY on the Sub2API service to a fixed key of 64 hex characters (openssl rand -hex 32); an invalid value prevents the server from starting.JWT_SECRET is generated on first boot and persisted in the volume. Set JWT_SECRET explicitly (32+ bytes, openssl rand -hex 32) if you manage secrets yourself.SECURITY_URL_ALLOWLIST_ALLOW_INSECURE_HTTP=false on the Sub2API service so only HTTPS upstream URLs are accepted.RUN_MODE=simple disables the SaaS/billing features for private use; in production it additionally requires SIMPLE_MODE_CONFIRM=true.Using this project may violate the terms of service of Anthropic and other upstream providers. Use it in compliance with the laws of your country or region; account bans, service interruptions and data loss are the user's own risk. The upstream project does not grant any commercial authorization.
Upstream project: https://github.com/Wei-Shaw/sub2api