Sub2API is an independently maintained AI API gateway for routing, managing, and operating multiple AI upstream accounts behind OpenAI-compatible and Anthropic-compatible APIs.
This branch keeps the deployable name sub2api for compatibility, but its releases are owned by this repository and start from v1.0.0.
This repository is maintained independently from upstream Wei-Shaw/sub2api.
- We do not automatically rebase or merge upstream
main. - Upstream pull requests are reviewed individually before being accepted.
- Local releases use independent SemVer tags starting at
v1.0.0. - Existing binary, service, and image basenames remain
sub2apiso current deployments do not need a rename.
Sub2API originated from Wei-Shaw/sub2api, but this branch is no longer an upstream-tracking branch. Upstream changes are treated as review candidates. A change is merged only when it matches this branch's architecture, operating assumptions, and user-facing behavior.
- Multi-upstream AI API gateway for subscription and API-key based accounts.
- OpenAI-compatible, Anthropic-compatible, and Claude Code oriented request handling.
- Account selection, failover, concurrency control, and rate-limit cooldown handling.
- Web administration UI for accounts, groups, keys, models, and operational settings.
- Docker Compose and binary/systemd deployment paths.
- Release artifacts built under the compatible
sub2apiname.
The recommended container image is the GHCR image for this repository:
docker pull ghcr.io/is7qin/sub2api:latestFor a prepared Docker Compose deployment:
curl -sSL https://raw.githubusercontent.com/is7Qin/sub2api/main/deploy/docker-deploy.sh | bash
docker compose -f docker-compose.local.yml up -dcurl -sSL https://raw.githubusercontent.com/is7Qin/sub2api/main/deploy/install.sh | sudo bashThe installer downloads release assets from is7Qin/sub2api and installs the sub2api binary and systemd service.
Download archives from:
https://github.com/is7Qin/sub2api/releases
Choose the archive matching your OS and CPU architecture, then follow the deployment notes in deploy/README.md.
Start from the deployment examples under deploy/:
deploy/config.example.yamlfor binary/systemd configuration.deploy/docker-compose.local.ymlfor Docker Compose with local data directories.deploy/docker-compose.ymlfor Docker Compose with named volumes.deploy/docker-compose.standalone.ymlwhen PostgreSQL and Redis are provided separately.
For Docker deployments, set secrets and database credentials in .env before starting the service.
- First independent release:
v1.0.0. - Patch releases (
v1.0.x) contain small fixes, documentation updates, and reviewed upstream PR cherry-picks. - Minor releases (
v1.x.0) contain new features or notable behavior changes. - Major releases (
v2.0.0+) are reserved for breaking configuration, deployment, API, or data-model changes.
The runtime VERSION value is generated from the tag by the release workflow. For example, tag v1.0.0 produces runtime version 1.0.0.
When an upstream PR is considered, review includes:
- Intent and user impact.
- Implementation risk and architectural fit.
- Tests and operational behavior.
- Interaction with local changes.
- Known edge cases and accepted limitations.
PRs are merged or cherry-picked only after explicit approval for that PR.
This is an independently maintained branch. It is not an official upstream release and is not endorsed by upstream maintainers. Use it according to your own operational and compliance requirements.