Subscription accounts
Subscription accounts such as Codex, Claude, Antigravity, and Grok can complete OAuth authorization or import existing OAuth JSON. Once connected, they share the same scheduling as API keys.
How subscription accounts differ from API keys §
To the gateway, subscription accounts and API keys are simply credentials in a pool: they share the same rotation, retry, cooldown, and health-isolation mechanisms. No separate operational workflow is required for subscription accounts.
Differences only in three places:
- Access method — Complete an OAuth authorization flow or import existing OAuth JSON.
- Credentials will expire — The gateway refreshes credentials automatically. If authorization fails, try a manual credential refresh or reconnect the account.
- Has a quota window — Subscription quotas reset periodically; the management UI shows remaining quota and reset time.
Connect an account §
Subscription accounts belong to Groups. Open Groups → New Group, select Codex, Claude, Antigravity, or Grok, then connect an account or import credentials.
The authorization panel stays expanded. Remote deployments often require copying the authorization link and callback URL manually, so this is a primary workflow rather than a fallback.
There are three connection methods, depending on the channel and whether you already have authorized credentials:
- Local callback (Codex, Claude, Antigravity) — After browser authorization, the upstream redirects to a fixed local port where the gateway receives the authorization code.
- Device code (Grok) — Enter the code shown by GPT-Load on the upstream website to authorize the account; no callback port is required.
- Import OAuth JSON (all four subscription channels) — Upload or paste existing OAuth JSON; a local callback on this machine is not required.
Import supports CPA-compatible, official Codex, official Claude Code, and sub2api OAuth JSON, including multiple files or account arrays. PATs and files missing required refresh credentials are unsupported.
Subscription Groups may use a custom HTTPS upstream root URL or path prefix. The relay must handle that channel’s calls, model discovery, and quota queries; business requests do not implicitly fall back to official URLs. OAuth authorization and token refresh still use official endpoints.
Callback port §
The three local-callback channels use ports fixed by the upstream clients; they cannot be customized:
| Channel | Callback port | Explanation |
|---|---|---|
| Codex | 1455 | Callback URL http://localhost:1455/auth/callback |
| Claude | 54545 | Fixed by upstream client |
| Antigravity | 51121 | Fixed by upstream client |
| Grok | Not needed | Device code authorization, does not occupy local port |
Docker Compose publishes all three ports by default and, like the main service, bind only to 127.0.0.1:
ports: - "$${BIND_ADDRESS:-${HOST:-127.0.0.1}}:$${PORT:-3001}:$${PORT:-3001}" - "$${OAUTH_CALLBACK_BIND_ADDRESS:-...}:1455:1455" # Codex - "$${OAUTH_CALLBACK_BIND_ADDRESS:-...}:54545:54545" # Claude - "$${OAUTH_CALLBACK_BIND_ADDRESS:-...}:51121:51121" # Antigravity
Because upstream clients fix these ports, only one default Compose instance on a host can use local callback authorization at a time. Other instances can import existing OAuth JSON; Grok can also use device authorization.
How to authorize remote deployment §
This is the most common stumbling block. When the service runs on a remote server, localhost in your browser points to your own computer, not the server, so the post-authorization redirect fails.
There are three ways to solve this; choose one:
- Manually paste callback address — If the redirect fails, copy the complete callback URL from the browser address bar and paste it into the management UI's callback field. The gateway extracts the authorization code and completes the flow. This is the most broadly applicable method and requires no network changes.
- SSH Port Forwarding — Forward the server's callback port to your computer so
localhostreaches the server:
ssh -L 1455:127.0.0.1:1455 user@your-server # Claude uses 54545, Antigravity uses 51121 # Forwarding: complete authorization during connection maintenance
If you already have OAuth JSON, upload or paste it directly; no callback port is needed.
Callback ports must not be exposed publicly. Paste the callback manually, use SSH forwarding, or import existing OAuth JSON; do not set OAUTH_CALLBACK_BIND_ADDRESS to 0.0.0.0.
Four authorization states §
Each subscription account has an authorization status; check it first when troubleshooting:
| Status | Meaning | What to do |
|---|---|---|
| Ready | Credential is valid, participating in scheduling normally | No Processing Required |
| Refreshing | The gateway is refreshing the credentials | Just wait, usually completes in a few seconds |
| Reauthorization required | The upstream rejected the refresh, or the existing authorization is no longer valid | Try refreshing the credentials; reconnect or import the account if it still fails |
| Unknown result | The refresh request did not get a clear result, possibly a network issue | Try refreshing the credentials; reconnect or import the account if it still fails |
Use Refresh credentials in the account card menu to restore authorization. Refresh quota updates quota information and also clears quota cooldowns when recovery conditions are met. Manually disabled accounts must be enabled before refreshing credentials.
Quota windows, reset times, and authorization status appear on the same screen.
How to interpret quota information §
After the first import, sync quota to fetch the current quota and reset time. If quota data does not update or looks incorrect after an upgrade, refresh it manually once.
Quota values do not determine rotation order; upstream rate-limit responses still trigger cooldowns and switching. Quota is updated through active synchronization and upstream responses and may be delayed.
When a fresh quota observation shows a drop of at least 5 percentage points in the used quota of a uniquely matched window, the account and its models are released from quota cooldowns. This applies to active synchronization and passive updates. Other cooldowns, including custom rules, authorization, disabled or blacklisted states, and failure counts are unchanged.
Use the quota column to let you decide whether to add another account, not to predict which account the gateway will choose next. To confirm candidate Groups and available credentials, use Route Check in Monitoring and troubleshooting.
Open a Codex group and click Sync quota in Modern or Sync in Classic. Account cards show Credits when the upstream reports a positive balance or unlimited credits. An absent label does not establish a zero balance.
Credits are displayed separately from periodic quotas and reset credits. They are not added together and do not affect scheduling.
Codex and Claude accounts may offer reset credits; account cards show available credits and expiration. Credits are consumed only after manual confirmation, never automatically. Refresh quota information afterward to verify the result. If the outcome is unknown, check the original operation rather than starting another reset.
Usage prerequisites §
- Only connect to accounts you are authorized to use and follow each provider's subscription terms. Sharing or reselling subscription quota is usually prohibited.
- Subscription channels depend on upstream OAuth and compatible protocols. You may need to update when upstream changes; these changes are outside the gateway's control.
- Credentials are encrypted locally, but the key that can decrypt the credentials and the database must be backed up together. See Security and production.