opencode on Your ChatGPT Subscription via ProxyLLM

Add ProxyLLM to opencode.json with @ai-sdk/openai-compatible and coding sessions bill to your ChatGPT plan. The config block, session cost math, and limit behavior.

opencode talks to any OpenAI-compatible endpoint through @ai-sdk/openai-compatible, so one provider block in opencode.json puts your coding sessions on a flat bill. Point it at https://api.proxyllm.ai/v1 with a ProxyLLM key and OpenAI-model calls run through Codex Hosted on your own ChatGPT subscription instead of per-token API billing. The config is below, along with the session math and what happens to long sessions at a usage limit.

The provider block

Drop this into opencode.json in your project, or into ~/.config/opencode/opencode.json to apply it everywhere:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "proxyllm": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "ProxyLLM",
      "options": {
        "baseURL": "https://api.proxyllm.ai/v1",
        "apiKey": "{env:PROXYLLM_API_KEY}"
      },
      "models": {
        "gpt-5": { "name": "GPT-5" },
        "gpt-5-mini": { "name": "GPT-5 mini" }
      }
    }
  }
}

Export PROXYLLM_API_KEY in your shell, or store the key inside opencode with the /connect command and skip the env var. The models you list appear in the /models picker under ProxyLLM; pick one and the session routes through the gateway. Connecting the ChatGPT account behind it is OpenAI’s device-code flow, done once.

Responses on the Codex lane arrive complete rather than streamed. For an agent harness this matters less than it sounds: opencode needs the full model response before it can run the next tool step anyway, so steps land whole instead of typing out.

Why this works for OpenAI models and not Claude plans

opencode is a harness where a ChatGPT subscription is actually usable. OpenAI ships Codex in ChatGPT plans, recommends ChatGPT sign-in in the Codex README, and documents device-code auth and non-interactive use. Running OpenAI-model sessions against your own plan through a Codex-backed endpoint is that documented functionality, with the standard footnote: intended functionality, but OpenAI has the final call on its services.

Anthropic took the opposite position. Its docs state it does not permit third-party developers to offer Claude.ai login or to route requests through Free, Pro, or Max plan credentials on behalf of their users, and it enforced that in January 2026 against opencode and similar tools. That is Anthropic’s call to make, and it is why the subscription lane here is OpenAI-only; the background is in why there is no Claude Code support. Cursor users face a narrower version of the same picture, covered in the Cursor guide.

What a session costs, metered vs flat

Coding agents re-send file context on nearly every call, which is why sessions cost more than their visible output suggests. A representative long session: 140 model calls averaging 9,000 input and 600 output tokens per call, on GPT-5.4 (OpenAI’s June 2026 list: $2.50 per million input, $15 per million output).

Input:  140 × 9,000 = 1.26M tokens × $2.50/M = $3.15
Output: 140 × 600   = 84K tokens  × $15/M    = $1.26
Per session                                  ≈ $4.40

Multiply by how often you actually run it, over 22 working days:

UsageAPI cost/mo (GPT-5.4)Flat path
1 session/day~$97Meter is cheaper; stay on your key
2 sessions/day~$194Plus $20 + ProxyLLM $129 = $149
4 sessions/day~$388$149, window ≈ $700 API-equivalent
8 sessions/day~$776Pro 5x $100 + $129 = $229

The honest crossover sits around $150 a month of metered spend. One session a day does not clear it; a daily-driver habit does. Window capacities are our planning estimates, never guarantees, and the request log shows your real consumption per lane.

Long sessions and usage limits

ChatGPT plans meter Codex in rolling windows plus a weekly cap, and a long opencode session can cross one mid-task. Through the gateway that is a lane change, not a stop: requests fall back to a second connected ChatGPT account if you have one, then to your own OpenAI API key, until the window resets. The session continues and the per-request log shows which lane served each call, so you can see exactly when a session went to fallback and what it cost there.

Two accounts deserve a precise word. Owning and connecting two of your own ChatGPT accounts is a different thing from sharing one account across people, which OpenAI’s terms do not allow. Each connected account runs in its own isolated container, never pooled. The strategies and the rules are laid out in Codex with multiple accounts.

A session that loops on a hard refactor is exactly the workload the meter punishes and a window absorbs. On a flat lane, the tenth retry of a stubborn test costs the same as the first: nothing beyond the plan you already pay for.

The short version of this setup lives on the opencode integration page. If you know your current monthly spend from coding sessions, the calculator tells you which side of the crossover you are on.

Frequently asked questions

Can opencode use a ChatGPT subscription?

For OpenAI models, yes. opencode speaks to any OpenAI-compatible endpoint through @ai-sdk/openai-compatible, so a provider block pointed at a Codex-backed endpoint like ProxyLLM bills sessions to your ChatGPT plan. Claude subscriptions are the opposite case: Anthropic does not permit third-party tools like opencode to use them.

How do I add a custom provider to opencode?

Add a provider block to opencode.json in your project, or to ~/.config/opencode/opencode.json for every project. Set npm to @ai-sdk/openai-compatible, baseURL to https://api.proxyllm.ai/v1, and your key as apiKey, then list the models you want in the /models picker.

What does an opencode session cost on the OpenAI API?

A long session commonly makes 100 to 150 model calls with file context re-sent each step. At GPT-5.4 list prices (June 2026), a 140-call session averaging 9,000 input and 600 output tokens per call runs about $4.40. Two sessions a working day is roughly $194 a month on the meter.

What happens if I hit a usage limit mid-session?

Requests fall back to a second connected ChatGPT account if one exists, then to your own OpenAI API key, until the window resets. The session keeps going, and the request log shows which lane served each call.

More on Integrations
Codex Hosted · the main feature

Run your AI workloads on your ChatGPT subscription.

ProxyLLM runs OpenAI's Codex for you, signed in with your own ChatGPT account. Your apps call one OpenAI-compatible endpoint and the work bills to your flat plan instead of per-token API pricing.