Can You Use Your ChatGPT Subscription as an API?
Yes, through OpenAI's Codex CLI. Here is how ChatGPT-plan Codex usage works, what it costs next to the API, and how to expose it as an endpoint.
Yes, with an important nuance. ChatGPT plans do not include REST API access, but they do include Codex, OpenAI’s coding agent. The Codex CLI signs in with your ChatGPT account and runs programmatically through codex exec, its documented non-interactive mode. Wrap that in an OpenAI-compatible endpoint and your flat subscription is doing work you would otherwise buy per token.
This article walks through what is actually included in a ChatGPT plan, the three ways to turn it into programmatic capacity, the cost math, and where OpenAI stands on all of it.
Why there is no official ChatGPT-plan API
OpenAI sells two different things. The API is metered: you pay per million input and output tokens, prices vary by model, and the bill scales with usage. ChatGPT plans are flat: $20/month for Plus, $200/month for Pro, with usage limits instead of a meter.
The two have always been firewalled. Your API key does not get cheaper because you pay for ChatGPT, and your ChatGPT login has never worked in the API. People have asked for a bridge for years, mostly in the form of “I already pay for Plus, why am I paying twice?”
What changed: Codex is included in your plan
Codex changed the picture. OpenAI’s coding agent ships as a CLI, and OpenAI recommends signing in with your ChatGPT account to use it as part of your Plus, Pro, Business, Edu, or Enterprise plan. The same plan that caps your chat usage also covers your Codex usage.
Two properties make this useful beyond the terminal:
codex execis non-interactive by design. OpenAI’s documentation describes running Codex from scripts and CI jobs, passing a prompt as an argument and reading the result from stdout. There is also an official SDK and a GitHub Action. Programmatic use is not a loophole; it is a documented mode.- Sign-in works on headless machines. The CLI has a device-code flow for servers without a browser, also documented by OpenAI.
Put those together and a ChatGPT subscription becomes compute you can call from code.
Three ways to use it
Run the CLI on your laptop. Free and fine for personal scripts. It stops when your laptop sleeps, serves one machine, and nothing else can call it.
Run it on your own server. Works, and stays within the one-user-one-account shape. You maintain the container, the auth refresh, the queueing, and the failure handling yourself.
Use a hosted lane. ProxyLLM’s Codex Hosted runs the official, unmodified CLI in an isolated container that belongs to your account alone. You sign in directly with OpenAI through the device-code flow, then point any OpenAI-compatible SDK at one base URL:
export OPENAI_BASE_URL="https://api.proxyllm.ai/v1"
export OPENAI_API_KEY="$PROXYLLM_API_KEY"
Every request your apps send becomes a Codex run billed to your subscription. One caveat to know up front: Codex responses arrive complete rather than streamed, so latency-sensitive chat UIs should keep an API-key lane for streaming.
The cost math
API spend scales linearly; subscriptions do not. Current capacity estimates used by the ProxyLLM calculator:
| Plan | Price | Approximate API-equivalent capacity |
|---|---|---|
| ChatGPT Plus | $20/mo | ~$700 of work |
| ChatGPT Pro 5x | $100/mo | ~$3,500 of work |
| ChatGPT Pro 20x | $200/mo | ~$14,000 of work |
A team spending $3,500/month on the OpenAI API can move that workload to ChatGPT Pro 5x at $100 plus ProxyLLM’s $129 SaaS fee: about $229/month for the same work. These are estimates, not guarantees; limits are set by OpenAI and shift as models rotate, so treat the capacity column as a planning number and check OpenAI’s pricing page for current limits.
Where OpenAI stands
Three facts, stated plainly:
codex execand headless sign-in are documented, intended functionality of the Codex CLI.- Codex usage is included in ChatGPT plans, and OpenAI recommends ChatGPT sign-in for the CLI.
- OpenAI’s Terms of Use still govern your account. You may not share an account, and OpenAI can restrict accounts at its discretion. OpenAI has the final call.
That is why one-user-one-container matters. ProxyLLM never pools accounts, never resells someone else’s subscription capacity, and never sees your password; the sign-in happens between you and OpenAI. The terms say the same thing in legal language, including the commitment to comply immediately if OpenAI directs a change.
If you want the deeper treatment, read is Codex Hosted against OpenAI’s terms?
Limits, and what happens when you hit them
Plan limits reset on rolling windows. When a lane is exhausted, ProxyLLM fails over in order: a second connected ChatGPT account if you have one, then your own OpenAI API key, then back to the subscription lane once the window resets. The request log shows which lane served each call, so the fallback is visible rather than mysterious.
Setting it up
- Connect your ChatGPT account with the device-code flow (about a minute).
- Optionally add a second account or an API key as fallback.
- Set
OPENAI_BASE_URLin whatever you already run. SDKs, n8n, LangChain, and plain curl all work; see the integrations list.
For the deeper mechanics of non-interactive Codex, start with the codex exec guide. For the full price comparison, see OpenAI API vs ChatGPT subscription cost.
Frequently asked questions
Does ChatGPT Plus include API access?
No. ChatGPT plans and the OpenAI API are separate products with separate billing. What ChatGPT plans do include is Codex, OpenAI's coding agent, and the Codex CLI can run programmatically with codex exec. That is the supported path from a flat subscription to programmatic usage.
Is using Codex programmatically against OpenAI's terms?
Programmatic use is documented functionality: OpenAI's docs describe codex exec for scripts and CI, and Codex is included in ChatGPT plans. OpenAI's Terms of Use still apply to your account, and OpenAI has the final call on how its services may be used.
What happens when I hit my plan's usage limit?
Usage limits reset on a rolling window. With ProxyLLM you can connect a second ChatGPT account as a fallback lane or fall back to your own OpenAI API key until the limit resets, so requests keep flowing.
Can I do the same thing with a Claude subscription?
No. Anthropic does not permit third-party services to route requests through Claude subscription credentials, and it blocked tools that tried in January 2026. This approach is specific to OpenAI's Codex.