You can use your ChatGPT subscription for a coding agent without an API key. Codex CLI, OpenAI’s own agent, signs in with your ChatGPT account. OpenCode and Contenox offer the same browser sign-in. Claude Code can’t: it runs Claude models only. Usage counts against your plan, not a per-token bill.
Use your ChatGPT subscription with your agent
| Agent | Supported? | How | Note |
|---|---|---|---|
| Claude Code | No | Claude Code runs Claude models only, through Anthropic, Amazon Bedrock, Google Cloud’s Agent Platform (Vertex AI) or Microsoft Foundry. Anthropic doesn’t support routing it to other models. | |
| Codex CLI | Yes | codex login, then sign in in the browser | OpenAI’s own agent. codex login --device-auth for a one-time code. |
| OpenCode | Yes | /connect → OpenAI → ChatGPT Plus/Pro | Signs in through your browser. |
| Contenox | Yes | Backends → Providers → ChatGPT subscription (Codex) | One-time code in your browser. |
Which ChatGPT plans include it?
OpenAI says Codex is included in ChatGPT Free, Go, Plus, Pro, Business, Edu and Enterprise. On Free it is limited to quick coding tasks; for real agent work you want a paid plan. The current list is on OpenAI’s Codex pricing page.
A ChatGPT plan does not include API credit. If you want per-token billing instead, use an OpenAI API key.
Codex CLI
Install it. Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"
macOS or Linux:
curl -fsSL https://chatgpt.com/codex/install.sh | sh
npm install -g @openai/codex works on all three. Then sign in:
codex login
Finish the sign-in in your browser and run codex in your project folder. On a machine
without a browser, or over SSH, use codex login --device-auth and enter the one-time
code on the page it shows.
Codex keeps the sign-in in ~/.codex/auth.json or in your system’s credential store.
Treat that file like a password.
OpenCode
Install it. On Windows, OpenCode recommends running it in WSL; natively, use npm:
npm install -g opencode-ai
macOS or Linux:
curl -fsSL https://opencode.ai/install | bash
Start opencode in your project, type /connect, choose OpenAI, then
ChatGPT Plus/Pro, and finish the sign-in in your browser. Pick a model with /models.
OpenCode stores the credentials in ~/.local/share/opencode/auth.json.
”There’s no field for the code”
Device code sign-in has to be turned on before it works. Turn it on in your ChatGPT
security settings, then try again. On a Business, Edu or Enterprise workspace, an admin
turns it on in the workspace permissions. OpenAI describes this in its
Codex sign-in guide. This applies to
codex login --device-auth and to Contenox.
Does it share limits with ChatGPT?
Yes. Codex and ChatGPT Work inside ChatGPT draw from the same usage limits. Limits are checked over a short recurring window, and weekly limits can apply as well. Agent sessions send far more than a chat does, so they use the allowance faster. You can see your current limits and reset times in OpenAI’s usage dashboard.
What happens when I hit the limit?
OpenAI lets a task that is already running finish its current turn, within fair use. After that, new requests fail until the limit resets. Your options:
- Wait for the reset.
- Buy credits, if your plan allows it. OpenAI offers this on Plus and Pro, and on Business, Edu and Enterprise workspaces with flexible pricing.
- Switch to an API key for the rest of the day, billed per token: OpenAI API key, or another provider such as Anthropic.
Limits differ by plan and change over time. Check the Codex pricing page for the current rules.
Subscription or API key?
A subscription is the simpler choice if you already pay for ChatGPT and work alone. An API key fits better when you need predictable access during long sessions, share an account across a team, or run agents unattended, because you pay for what you use instead of waiting for a reset. The trade-offs for Codex in detail: Codex API key vs subscription.
Contenox
Contenox signs in with the same one-time code and lets you keep the subscription and API-key providers side by side, switching per session.
- Open Backends → Providers and, under Recommended, choose ChatGPT subscription (Codex).
- Select Sign in with ChatGPT, enter the code shown on the ChatGPT page and allow access. The status changes to Signed in with ChatGPT.
- Pick one of your plan’s models in the Model chip on the message box.
If the status changes to Sign-in expired or Sign-in required, select Sign in with ChatGPT again. Sign out removes the stored sign-in.
Related
- Codex API key vs subscription: which one to use when
- AI coding subscription comparison: ChatGPT next to Claude, Copilot and others
- Codex on Windows: install and sandbox on Windows
- OpenAI API key
- AI coding costs: subscription, API key or local model
- How to choose a model for coding
- Anthropic (Claude)
- Run models locally