Use subscriptions in any app
Point Claude Desktop, ChatGPT/Codex Desktop, Cursor, Continue, Cline, Aider, Windsurf, and generic SDKs at the same subscription-backed gateway.
Last updated: 2026-08-28
Run one local gateway with your ChatGPT / Claude / SuperGrok logins, then point whatever client you like at it. Same credentials, same models, two wire dialects.
Claude Desktop ──Anthropic──┐
Claude Code ──Anthropic──┤
Cursor / Continue / Cline ──OpenAI───┼──► llm-gateway ──► subscriptions
ChatGPT Desktop / Codex ──OpenAI────┤
Aider / Windsurf / SDKs ──either────┘| Dialect | Base URL | Credential |
|---|---|---|
Anthropic (/v1/messages) |
https://127.0.0.1:8787 |
edge key e.g. local-dev |
OpenAI (/v1/chat/completions, /v1/responses, /v1/models) |
https://127.0.0.1:8787/v1 |
same edge key |
Related: Claude Code · Claude app · Codex · Cursor · OAuth
Shared setup (do this once)
A. Release binary (recommended)
# 1) Install llm-gateway from GitHub Releases onto PATH
llm-gateway helpers install # or: llm-gateway load-helpers
eval "$(llm-gateway helpers source)"
# → ~/.config/inja-gateway/shell/*.sh + claude-code-subscriptions.yaml
llm-gateway auth login chatgpt # ChatGPT Plus/Pro via Codex OAuth
llm-gateway auth login claude # Claude Pro/Max setup-token
llm-gateway auth import grok # SuperGrok (Grok CLI recommended)
export KEY=local-dev
cc-gateway-up # HTTPS on 127.0.0.1:8787
apps-setup # print every integration
apps-use-gateway # Claude Desktop + settings + Codex → gateway
# apps-use-default # rollback vendor settings later
cc-gateway-logs -f # http + usageB. Git checkout
go build -o llm-gateway ./cmd/gateway
./llm-gateway auth login chatgpt # and/or claude, grok
source examples/shell/claude-code-helpers.sh
source examples/shell/apps-helpers.sh
export KEY=local-dev
cc-gateway-up
apps-setup
apps-use-gatewayBackup / rollback (switch profiles)
Managed files:
| Target | Live path |
|---|---|
| Claude settings | ~/.claude/settings.json |
| Claude Desktop | ~/Library/Application Support/Claude/claude_desktop_config.json (macOS; see OS table below) |
| Codex | ~/.codex/config.toml |
Snapshots live under ~/.local/state/inja-gateway/app-profiles/ (or $XDG_STATE_HOME/inja-gateway/app-profiles):
| Slot | Meaning |
|---|---|
default |
Pre-gateway / vendor settings (saved automatically on first apps-use-gateway) |
gateway |
Last gateway configs (updated on enable; kept when you roll back so you can flip back) |
history/<stamp>-… |
Timestamped copies before each switch/write |
| Command | Effect |
|---|---|
apps-use-gateway |
One-time save of live → default if empty; write gateway configs; save → gateway; set active |
apps-use-default |
Save live → gateway; restore default to live; set active |
apps-switch gateway|default |
Same as above |
apps-backup default |
Force-refresh default from current live files |
apps-backup gateway |
Force-save current live as gateway |
apps-restore-slot default|gateway |
Restore a slot without rewriting gateway templates |
apps-status / apps-list-backups |
Show active mode and stored files |
apps-enable / apps-disable |
Aliases for use-gateway / use-default |
apps-rollback |
Alias for apps-use-default |
Not session-only env: these write real config files. Fully quit Claude Desktop / Codex after switching. Continue, Cline, Aider, Windsurf, Cursor GUI are not auto-managed (print helpers only).
TLS: prefer mkcert -install + ./examples/scripts/gen-localhost-tls.sh so Electron apps trust the cert. Otherwise set NODE_EXTRA_CA_CERTS (and Python SSL_CERT_FILE / REQUESTS_CA_BUNDLE) to examples/certs/localhost.pem.
Live models on your account:
curl -sk -H "Authorization: Bearer local-dev" \
'https://127.0.0.1:8787/v1/models?live=1' | jq -r '.data[].id' | sortClaude Desktop
Full guide: Claude app + subscriptions.
Chat in the Claude app (2026) uses Developer → Configure Third-Party Inference, not ANTHROPIC_BASE_URL. Claude Code inside the app still uses Anthropic env.
export KEY=local-dev
CC_MODEL=grok-4.6 apps-write-claude-desktop
# Import ~/.config/inja-gateway/claude-desktop-3p.json → Apply locallyChatGPT Desktop / Codex (“GPT Desktop”)
Full guide: Codex + subscriptions.
export KEY=local-dev
apps-write-codex
export INJA_GATEWAY_KEY=local-dev
export NODE_EXTRA_CA_CERTS="$HOME/.config/inja-gateway/certs/localhost.pem"
codex
# codex --model grok-4.6ChatGPT chat UI may ignore a custom provider. Codex CLI / coding agent (~/.codex/config.toml) is the supported path.
Cursor
OpenAI key + Override OpenAI Base URL = https://127.0.0.1:8787/v1.
Full steps: Cursor + subscriptions.
source examples/shell/cursor-helpers.sh
cursor-setupClaude Code
KEY=local-dev ./examples/claude-code-multi.sh gpt # or grok, gpt+grok, multi
# or: cc-gpt / cc-grok / cc-multiFull guide: Claude Code + subscriptions.
Continue.dev
Merge models from examples/apps/continue/config.yaml into ~/.continue/config.yaml:
provider: openaiapiBase: https://127.0.0.1:8787/v1apiKey: local-devmodel: gpt|sol|grok-4.5|sonnet| …
apps-continueCline / Roo Code
VS Code / Cursor settings (key names vary by extension version):
{
"cline.apiProvider": "openai",
"cline.openAiBaseUrl": "https://127.0.0.1:8787/v1",
"cline.openAiApiKey": "local-dev",
"cline.openAiModelId": "gpt"
}Snippet: examples/apps/cline/vscode-settings.snippet.json
apps-clineAider
source examples/apps/aider/aider.env
# OPENAI_API_BASE=https://127.0.0.1:8787/v1
# OPENAI_API_KEY=local-dev
aider --model openai/gpt
# aider --model openai/sol
# aider --model openai/grok-4.5apps-aiderWindsurf / Cascade
Settings → AI / Models → OpenAI-compatible or custom provider:
| Field | Value |
|---|---|
| Base URL | https://127.0.0.1:8787/v1 |
| API key | local-dev |
| Models | gateway aliases (gpt, grok-4.5, sonnet, …) |
apps-windsurf
# examples/apps/windsurf/settings.snippet.mdGeneric OpenAI / Anthropic SDKs
# OpenAI-compatible
source examples/apps/generic/openai.env
# Anthropic Messages
source examples/apps/generic/anthropic.envfrom openai import OpenAI
client = OpenAI(base_url="https://127.0.0.1:8787/v1", api_key="local-dev")
client.chat.completions.create(model="gpt", messages=[{"role": "user", "content": "hi"}])from anthropic import Anthropic
client = Anthropic(base_url="https://127.0.0.1:8787", api_key="local-dev")
client.messages.create(model="sonnet", max_tokens=256, messages=[{"role": "user", "content": "hi"}])apps-genericModel names (Jul 2026 defaults)
| Short alias | Typical upstream |
|---|---|
sonnet / opus / haiku / fable |
Claude Sonnet 5 / Opus 4.8 / Haiku 4.5 / Fable 5 |
gpt / terra / sol / luna |
GPT-5.6 Terra / Sol / Luna (ChatGPT sub) |
grok-4.6 / grok-4.5 / composer-2.5 |
Grok 4.6 / 4.5 / grok-build-0.1 |
Always verify with ?live=1. Maintainers: repo AGENTS.md.
What “works perfectly” means (honest matrix)
| App | Supported path | Limits |
|---|---|---|
| Claude Desktop | 3P inference | Chat ignores ANTHROPIC_BASE_URL; picker needs inferenceModels for Grok |
| Claude Code | ANTHROPIC_BASE_URL + combos |
Best fidelity for Anthropic passthrough |
| Cursor | OpenAI override + custom models | Agent may use Responses API (gateway supports it for openai_compat) |
| Codex / ChatGPT coding | ~/.codex/config.toml |
Main ChatGPT chat UI may ignore custom base URL |
| Continue / Cline / Roo / Aider / Windsurf | OpenAI-compatible settings | Extension / UI key names change — check current product UI |
| Any OpenAI SDK | OPENAI_BASE_URL |
Must include /v1 |
| Any Anthropic SDK | ANTHROPIC_BASE_URL |
No /v1 suffix for most SDKs |
“Perfect” for a given app means: correct dialect, TLS trust, edge key, and a model id the gateway can route. Apps that hardcode first-party hosts cannot be forced through the gateway without their own override feature.
Troubleshooting
| Symptom | Fix |
|---|---|
| Connection refused | cc-gateway-up |
| TLS / certificate errors | mkcert -install + regenerate certs; set NODE_EXTRA_CA_CERTS / SSL_CERT_FILE |
| 401 | Edge key mismatch; or auth status missing provider |
| 404 model | Use ?live=1 ids or retarget aliases |
| App ignores base URL | That product may not support overrides (use Codex/Cursor/SDK instead) |
| Claude Desktop no change | Fully quit; Developer → Configure Third-Party Inference (see Claude app guide) |
| Want vendor defaults back | apps-use-default (needs prior apps-use-gateway or apps-backup default) |
| Accidentally overwrote default slot | Restore from apps-list-backups → history/… via apps-restore-slot history/<stamp> |
cc-gateway-status
./llm-gateway auth status
curl -sk https://127.0.0.1:8787/healthz
apps-statusFile map
| Path | Role |
|---|---|
examples/apps/ |
Templates per app |
examples/shell/apps-helpers.sh |
Same scripts embedded in the binary (llm-gateway helpers install) |
~/.config/inja-gateway/shell/ |
Install target for helpers from the release binary |
~/.local/state/inja-gateway/app-profiles/ |
Named slots default / gateway + history/ |
~/.local/state/inja-gateway/gateway.log |
cc-gateway-up process log (cc-gateway-logs) |
examples/configs/claude-code-subscriptions.yaml |
Subscription providers + aliases |
AGENTS.md |
Keep model ids current |