How to use GPT-5.2 Codex in Claude Code
Claude Code is one of the best agentic coding terminals available, but you are not locked into a single model family. With an OpenAI-compatible gateway you can point Claude Code at GPT-5.2 Codex — OpenAI's coding-tuned model — and keep every Claude Code workflow you already know. This guide shows exactly how.
Why pair GPT-5.2 Codex with Claude Code
Different models have different strengths. GPT-5.2 Codex is tuned for code generation, refactors, and long agentic edit loops, and many developers prefer its style for certain languages or test-heavy tasks. Running it inside Claude Code means you get Codex reasoning with Claude Code's file editing, planning, and tool execution.
The trick is that Claude Code speaks the OpenAI-compatible Chat Completions format. AnyModel exposes one such endpoint that reaches GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok — all behind a single API key. Switching models is just changing one string.
Step 1: Get an API key
Create a free account and grab your key. You start with 1,000,000 tokens on signup, and a total of 6,000,000 tokens if you link Telegram — no credit card required. After that it is simple pay-per-token: no subscription, no monthly minimums.
Step 2: Install with one line
AnyModel ships a one-line installer for a handful of supported tools (codex, claude, opencode, hermes). For Claude Code, use the tool=claude variant:
bash <(curl -fsSL "https://anymodel.org/i?tool=claude") <YOUR_API_KEY>
This configures Claude Code to use the AnyModel base URL (https://anymodel.org/v1) and your key. That is the entire setup — no proxy to babysit, no environment file to hand-edit.
If you prefer to wire things up manually, set the base URL to https://anymodel.org/v1 and supply your API key as the bearer token. The same pattern works for other OpenAI-compatible clients (Cursor, Windsurf, Zed, Cline, Aider, Continue, Gemini CLI), which do not have the one-line installer.
Step 3: Select the GPT-5.2 Codex model
Once Claude Code is pointed at AnyModel, choosing GPT-5.2 Codex is a matter of setting the model id. Nothing else in your config changes. To confirm the endpoint works, you can run a quick request directly:
curl https://anymodel.org/v1/chat/completions \
-H "Authorization: Bearer $ANYMODEL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.2-codex",
"messages": [{"role": "user", "content": "Write a Python function to debounce calls."}]
}'
If you get a completion back, Claude Code will too. Want to compare Codex against Claude or Gemini on the same prompt? Swap the model value and rerun — that is the whole workflow. Our model comparison page helps you decide which one to keep open for a given task.
One key, many models
The real advantage shows up over a week of real work. You might draft an architecture with one model, let GPT-5.2 Codex grind through a large refactor, and hand off documentation to another — all without juggling separate accounts, billing, or SDKs.
| What you change | What stays the same |
|---|---|
The model id |
Base URL https://anymodel.org/v1 |
| Which provider answers | Your single API key |
| Cost per token | Your Claude Code setup |
A note on privacy
By default, API traffic passes through normally. If you want stricter handling, Ghost Mode is an opt-in zero-retention setting: we do not store your prompts or responses, only a token counter for billing. Be clear-eyed about what that means — the underlying model provider still receives your prompt to generate a response, so this is not a claim of total privacy. It simply removes retention on our side.
Wrapping up
Running GPT-5.2 Codex inside Claude Code takes one install line and one model id. You keep the editor agent you like, gain access to a coding-tuned model, and can switch between providers whenever a task calls for a different tool — all on a single key and a single endpoint. For more setup guides and model deep-dives, browse the blog.
Ready to try it? Create a free account, claim your starter tokens, and run your first Codex prompt in Claude Code today.
AnyModel