May 27, 20263 min readSetupGPT-5.2Claude Code

How to use GPT-5.2 in Claude Code

Claude Code is a fast, terminal-native coding agent — but you are not locked into a single model family. With AnyModel you can point Claude Code at GPT-5.2 (or any other model) through one OpenAI-compatible endpoint, and switch between them by changing a single string. This guide shows exactly how.

Why route GPT-5.2 through AnyModel

AnyModel is a unified gateway: one base_url (https://anymodel.org/v1) and one API key reach every model we host — GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. There is nothing else to wire up. To swap models you change the model id and nothing more.

That matters for a workflow like Claude Code, where you might want GPT-5.2 for a reasoning-heavy refactor today and a different model tomorrow. No new keys, no new SDKs, no second billing account.

A few honest facts worth knowing before you start:

  • Free to start: 1,000,000 tokens on signup, and a total of 6,000,000 if you link Telegram. No credit card required.
  • Pay-per-token after that: no subscription, no monthly minimums. You pay only for what you use.
  • One key, every model: the same credential works across the whole catalog.

Step 1: Get your API key

Create an account and grab a key from your dashboard. The signup tokens are enough to run real coding sessions before you ever pay anything. Register here — it takes under a minute.

Step 2: Install with one line

Claude Code is one of the four tools our installer supports directly (codex, claude, opencode, hermes). Run this in your terminal, substituting your real key:

bash <(curl -fsSL "https://anymodel.org/i?tool=claude") <YOUR_API_KEY>

This configures Claude Code to talk to AnyModel's OpenAI-compatible endpoint. The script sets the base URL and key for you, so you do not have to edit config files by hand.

Step 3: Select GPT-5.2

Once installed, tell Claude Code to use GPT-5.2 by setting it as the active model. Because AnyModel is OpenAI-compatible, the model id is all that changes — the endpoint and key stay identical. Browse the exact, current model identifiers on the models page so you copy the right string.

If you ever want to compare GPT-5.2 against, say, a Claude or Gemini model on price or context window before committing, the compare page lays them out side by side.

Using a client the installer doesn't cover

The one-line installer is only for codex, claude, opencode, and hermes. For other editors and agents — Cursor, Windsurf, Zed, Cline, Aider, Continue, or Gemini CLI — use a manual OpenAI-compatible setup instead:

Setting Value
Base URL https://anymodel.org/v1
API key your AnyModel key
Model the GPT-5.2 id from /models

Any tool that speaks the OpenAI Chat Completions format will work with those three values.

A note on privacy: Ghost Mode

If your code or prompts are sensitive, enable Ghost Mode. It's an opt-in setting that issues zero-retention API keys: prompts and responses are not stored on our side — only a token counter for billing.

To be clear and honest: this stops us from retaining your data, but the underlying model provider still receives the prompt to generate a response. Ghost Mode is real zero-retention on the gateway, not a claim that no one anywhere ever sees your text. Treat it as a strong privacy improvement, not a magic shield.

Troubleshooting

  • Auth errors: confirm you pasted the full key and that the base URL ends in /v1.
  • Model not found: copy the exact id from /models; ids change as new versions ship.
  • Unexpected client behavior: if your tool wasn't in the installer's supported list, double-check you used the manual setup above rather than the install script.

Wrap-up

That's the whole process: one key, one install line, and a model id swap to run GPT-5.2 inside Claude Code — with the freedom to switch to any other model whenever you like. For deeper walkthroughs and comparisons, the blog has more.

Ready to try it? Create your free AnyModel account and get GPT-5.2 running in Claude Code today.

Read next