Open Source Alternatives LogoOpen Source Alternatives
AlternativesBlogAdvertise
Open Source Alternatives LogoOpen Source Alternatives

Stay Updated

Subscribe to our newsletter for the latest news and updates about Alternatives

Open Source Alternatives LogoOpen Source Alternatives

Handpicked Open Source Alternatives to Paid Softwares

Product
  • Categories
  • Tag
  • Sign In
Resources
  • Blog
  • Collection
  • Submit
  • Advertise your tool
Company
  • Privacy Policy
  • Terms of Service
  • Refund Policy
  • Sitemap
Copyright © 2026 All Rights Reserved.
Home/Categories/AI & Machine Learning/sub2api
icon of sub2api

sub2api

Connect Claude, OpenAI, Gemini, and Grok subscription accounts into a shared API gateway. LGPL-3.0, self-hosted with Docker, PostgreSQL, and Redis.

38.8K starsGoLGPL-3.0Active this week
Visit websiteGitHub repo
image of sub2api
Contents
  1. 01Who sub2api is for
  2. 02The problem it solves
  3. 03How it solves it
  4. 04Strengths and trade-offs
  5. 05sub2api vs alternatives
  6. 06Tech stack
  7. 07FAQ
  8. 08Similar open-source tools
TL;DR

sub2api is an open source API gateway that converts personal AI subscription accounts (Claude Pro, ChatGPT Plus, Gemini Pro, and Grok) into a unified OpenAI-compatible endpoint. It targets developers who already hold AI subscriptions and want to avoid separate per-token API billing by routing those accounts through a self-hosted relay with multi-user cost sharing. Licensed under LGPL-3.0, the stack requires Docker, PostgreSQL 15+, and Redis 7+. Best for small teams building with Claude Code, Codex, or Gemini CLI who want subscription-rate economics instead of per-token API pricing.LGPL-3.0 · Go · 38.8K stars · Active this week

who it's for

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

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 sub2api solves it

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 · trade-offs

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.
versus alternatives

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.

FeatureSub2APIOpenRouter
LicenseLGPL-3.0 (self-hosted)Proprietary (managed)
Self-hostingYes (Docker, PostgreSQL, Redis)No
Billing modelFlat subscription sharingPer-token billing
Provider supportClaude, OpenAI, Gemini, Grok200+ models across providers
Setup complexityModerate (three-service stack)None (API key only)
ToS complianceAt 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.

FeatureSub2APIDirect Provider APIs
BillingSubscription-based (shared)Per-token
ToS complianceAt riskFully compliant
Multi-providerYes (one endpoint)No (separate keys per provider)
Self-hostingYesNo (managed service)
SetupThree-service relay stackAPI 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.

tech stack · detected from GitHub

What it's built on#

Languages
GoTypeScript
Frameworks
Vue
frequently asked

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.

also worth a look

Similar open-source tools#

vexa

vexa

Self-hosted meeting bot API for Meet, Teams, Zoom, and Jitsi

2.7KPythonApache-2.0
whisper-asr-webservice

whisper-asr-webservice

Self-hosted speech recognition API built on OpenAI Whisper

3.3KPythonMIT
Switchyard

Switchyard

LLM proxy with API translation and multi-backend routing

825RustApache-2.0
Embabel

Embabel

Agentic AI framework for the JVM

4KKotlinApache-2.0
Agent-Reach

Agent-Reach

Give agents local web and social-source access

67.6KPythonMIT
Remodex

Remodex

Control Codex agents from your iPhone, open source and free

3.3KSwiftApache-2.0

Repository

Stars
38.8K
Forks
8K
License
LGPL-3.0
Latest
v0.1.179
Last commit
today
Last verified
Aug 23, 2026
Repo
Wei-Shaw/sub2api ↗

Additional details

Language
Go
Open issues
2,800
Contributors
363
First release
2025

Categories

AI & Machine LearningAPIs & IntegrationDeveloper Tools

Tags

API InfrastructureAI Coding AssistantDeveloper ToolsLLMOps