
Who sub2api is for#
Solo developers routing Claude Pro through CLI tools
Developers who pay for Claude Pro but do most work in Claude Code can use Sub2API to route their subscription quota through the CLI without paying separate per-token API costs. Sub2API bridges the gap between the browser-based subscription and the tool's API key expectation.
Skip if:
Skip if you already have a direct Anthropic API account with sufficient credits. The API path avoids the relay infrastructure and ToS risk entirely; Sub2API is most useful when the cost difference between subscription and per-token API pricing is large enough to justify the added complexity.
Small teams sharing AI subscription costs
A team of three to five developers can pool one or two AI subscriptions behind a Sub2API instance, splitting the flat monthly fee instead of each member paying individual API credits. The multi-user carpool feature is designed specifically for this workflow.
Skip if:
Skip if your team uses AI tools at low volume where per-token billing is already inexpensive. The infrastructure overhead of PostgreSQL, Redis, and an application server outweighs the cost saving unless usage volume is high enough that subscription pricing is meaningfully cheaper.
LLMOps engineers experimenting with multi-provider routing
Engineers building agent pipelines or evaluation harnesses can use Sub2API to route requests across Claude, OpenAI, and Gemini through one endpoint, comparing provider behavior without managing separate credentials per model family.
Skip if:
Skip for production LLMOps workloads where provider ToS compliance is a hard requirement. The relay architecture may violate provider agreements, which introduces account risk in regulated or commercial deployment environments.
The problem it solves#
Official API access to Anthropic, OpenAI, and Google AI is metered per token. For developers building with AI-assisted tools, costs scale fast: a heavy Claude Code session can consume millions of tokens in a week, and paying per-token API rates for that volume costs significantly more than a flat Pro subscription.
The gap is structural. Personal AI subscriptions include quota that browser-based products consume, but development tools (Claude Code, Codex, Gemini CLI) require an API key rather than a browser session. Teams end up paying both: a subscription for manual use and API credits for automated workflows. Developers holding multiple AI subscriptions have capacity sitting unused by the tools they depend on most.
How it solves it#
OpenAI-compatible API endpoint
Exposes all connected subscription accounts behind a single OpenAI-compatible HTTP interface. Tools that already speak the OpenAI protocol (Claude Code, Codex, Gemini CLI) need only a Base URL and API key change to connect, with no modification to the client application.
Multi-provider subscription aggregation
Accepts accounts from Claude, OpenAI, Gemini, and Grok subscriptions simultaneously and routes incoming API requests across them. Developers manage one gateway rather than maintaining separate credentials and endpoint configs for each provider.
Cost-sharing carpool mode
Multiple users share the same subscription quota through one Sub2API instance, splitting the flat monthly cost across a team. One Claude Pro or ChatGPT Plus subscription is distributed across several developers rather than each paying per-token API rates independently.
Go backend with Vue 3 admin interface
The server is written in Go 1.26.5 for low-overhead request proxying, with a Vue 3.4+ web interface for managing accounts, users, and routing configuration. PostgreSQL 15+ stores persistent state; Redis 7+ handles sessions and caching.
Docker-ready deployment stack
The full stack ships as Docker-ready services. Teams with a PostgreSQL database and Redis instance can deploy Sub2API without building from source. Container configuration covers the Go API server, the Vue frontend, and the required data stores.
Strengths and trade-offs#
Strengths
- LGPL-3.0 license with full self-hostingLGPL-3.0 lets you run Sub2API on your own infrastructure, modify it, and use it in proprietary internal tooling without releasing your source changes. Unlike commercial relay services, there are no per-call fees or subscription costs for the gateway itself.
- 38,000+ stars and active maintenanceThe repository reached 38,787 stars within months of its December 2025 creation and received its last push on 2026-08-22, indicating active development. That adoption rate reflects strong developer demand for subscription-based API relay tooling.
- Native compatibility with AI coding toolsSub2API exposes an OpenAI-compatible endpoint, so Claude Code, Codex, and Gemini CLI connect without custom adapters. The GitHub topics list claude-code and codex explicitly, reflecting tested compatibility with the tools developers actually run daily.
Trade-offs
- -Terms of service risk with upstream providersThe README explicitly warns that using Sub2API may violate the terms of service of Anthropic, OpenAI, and other upstream providers. Accounts used through the relay risk suspension or termination. The developers disclaim all liability; each user is responsible for reviewing provider agreements before deploying.
- -Requires PostgreSQL 15+ and Redis 7+This is not a single-binary or single-container install. Running Sub2API means provisioning and maintaining PostgreSQL and Redis alongside the application server. Teams without existing infrastructure for these services will need to stand them up from scratch.
- -2,800 open issues relative to project ageThe project has 2,800 open issues against 38,787 stars, a ratio that suggests either a high defect rate or an under-resourced maintainer team given the project's rapid growth. Review recent issues before deploying Sub2API in any critical workflow.
sub2api vs alternatives#
Sub2API vs OpenRouter
OpenRouter is a commercial service that provides unified API access to hundreds of AI models at per-token billing. Both Sub2API and OpenRouter expose an OpenAI-compatible API endpoint, but they serve fundamentally different deployment models.
| Feature | Sub2API | OpenRouter |
|---|---|---|
| License | LGPL-3.0 (self-hosted) | Proprietary (managed) |
| Self-hosting | Yes (Docker, PostgreSQL, Redis) | No |
| Billing model | Flat subscription sharing | Per-token billing |
| Provider support | Claude, OpenAI, Gemini, Grok | 200+ models across providers |
| Setup complexity | Moderate (three-service stack) | None (API key only) |
| ToS compliance | At risk (see README warning) | Uses official provider APIs |
Sub2API is the stronger choice when you already hold AI subscriptions and want to avoid adding per-token costs on top of them. At high usage volumes, per-token billing from commercial aggregators scales sharply; a flat subscription routed through Sub2API keeps costs fixed. Self-hosting also means the relay layer adds no third-party data exposure beyond the upstream AI providers.
OpenRouter is the better choice when you need access to a wider model catalog beyond the four providers Sub2API supports, when ToS compliance is non-negotiable, or when your team lacks the infrastructure to run PostgreSQL and Redis. OpenRouter also provides production SLAs and automatic failover that a self-hosted relay does not guarantee out of the box.
Sub2API vs Direct Provider APIs
Using each provider's official API (Anthropic API, OpenAI API, Google AI API) is the baseline alternative. Direct API access uses official per-token pricing and is fully compliant with each provider's terms.
| Feature | Sub2API | Direct Provider APIs |
|---|---|---|
| Billing | Subscription-based (shared) | Per-token |
| ToS compliance | At risk | Fully compliant |
| Multi-provider | Yes (one endpoint) | No (separate keys per provider) |
| Self-hosting | Yes | No (managed service) |
| Setup | Three-service relay stack | API key configuration only |
Direct provider APIs are the right choice for any production or commercial application where ToS compliance is a hard requirement, or where usage volume is low enough that per-token pricing is already affordable. Sub2API is relevant for individual developers or teams who are already paying for subscriptions and want to route high-volume development tool usage through that existing spend, with the understanding that account risk is borne entirely by the user.
What it's built on#
- Languages
- GoTypeScript
- Frameworks
- Vue
FAQ#
Is Sub2API free to use?
Sub2API itself is LGPL-3.0 licensed and free to self-host. You still need to pay for the underlying AI subscriptions (Claude Pro, ChatGPT Plus, Gemini Pro, etc.) that feed into it. Infrastructure costs for PostgreSQL and Redis are additional. There is no managed hosted version of Sub2API offered by the project maintainers.
Does using Sub2API violate AI provider terms of service?
The README explicitly warns that it may. Anthropic, OpenAI, and other providers have terms of service that may prohibit sharing subscription access or using subscriptions via automated API relay. The developers disclaim all liability for account suspensions or service interruptions. Review each provider's terms before deploying.
What AI providers does Sub2API support?
Based on the README and GitHub topics, Sub2API supports Claude (Anthropic), OpenAI (ChatGPT Plus), Gemini (Google), and Grok. The relay layer exposes an OpenAI-compatible API, so any tool that speaks the OpenAI protocol can connect through it without modification.
What infrastructure does Sub2API require to self-host?
Sub2API requires Docker, PostgreSQL 15+, and Redis 7+. The application server is written in Go 1.26.5. No minimum hardware specification is documented in the project README, but running three services (application server, PostgreSQL, Redis) typically needs at least 2GB of RAM on the host.
What does the LGPL-3.0 license mean for Sub2API users?
LGPL-3.0 lets you run and self-host Sub2API in internal or proprietary tooling without releasing your own source code. If you modify Sub2API itself and distribute those changes, you must release the modifications under LGPL. The project developers also note explicitly that no commercial operation has been authorized based on this project.
Similar open-source tools#
vexa
Self-hosted meeting bot API for Meet, Teams, Zoom, and Jitsi
whisper-asr-webservice
Self-hosted speech recognition API built on OpenAI Whisper
Switchyard
LLM proxy with API translation and multi-backend routing
Embabel
Agentic AI framework for the JVM
Agent-Reach
Give agents local web and social-source access
Remodex
Control Codex agents from your iPhone, open source and free

