How to use GPT-5.2 Codex in Cursor
Cursor is one of the most popular AI-native code editors, and GPT-5.2 Codex is a strong model for agentic coding, refactors, and multi-file edits. The catch: Cursor's built-in plans don't always expose the exact model you want, and switching providers usually means juggling separate accounts and keys. This guide shows you how to point Cursor at GPT-5.2 Codex through a single OpenAI-compatible endpoint, so you can swap models later without touching your setup again.
Why route Cursor through one endpoint
Cursor supports custom OpenAI-compatible base URLs. That means you don't have to depend on whichever models Cursor bundles. With AnyModel, one API key reaches every major model — GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. To switch models you change one string (the model id); nothing else in your config moves.
That's useful in Cursor specifically, because you often want GPT-5.2 Codex for tight code edits but a different model for long-context reasoning or cheaper bulk work. One endpoint, one key, many models.
Step 1: Get an API key
Create an account and grab your key — no credit card required. You start with 1,000,000 free tokens, and 6,000,000 total if you link Telegram. After that it's pay-per-token: no subscription, no monthly minimums.
Step 2: Configure Cursor
Cursor isn't a CLI tool, so the one-line installer doesn't apply here (that's reserved for codex, claude, opencode, and hermes). For Cursor you use the manual OpenAI-compatible setup, which takes about a minute:
- Open Cursor Settings → Models (or Cursor Settings → AI).
- Find the OpenAI API Key section and enable Override OpenAI Base URL.
- Set the base URL to:
https://anymodel.org/v1
- Paste your AnyModel API key into the API key field.
- In the custom model list, add the GPT-5.2 Codex model id and enable it.
- Click Verify so Cursor confirms the connection, then save.
Once verified, GPT-5.2 Codex appears in Cursor's model picker for chat, inline edits (Cmd/Ctrl+K), and Composer.
Sanity-check the endpoint first
Before fiddling with editor settings, it's worth confirming your key works with a plain request. This is the same endpoint Cursor will hit:
curl https://anymodel.org/v1/chat/completions \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.2-codex",
"messages": [{"role": "user", "content": "Write a Python function to reverse a string."}]
}'
If you get a completion back, Cursor will work too. If you see an auth error, re-copy the key; if you see a model error, check the exact model id on the models page.
Step 3: Switch models without re-configuring
This is the payoff. Say you want to compare GPT-5.2 Codex against Claude or Gemini on the same refactor. You don't add a new provider or key — you just add another model id to Cursor's custom model list and toggle between them in the picker. Everything routes through the same base URL and key.
If you're unsure which model fits a task, the compare page lays out tradeoffs side by side so you can pick deliberately instead of guessing.
| What you want | What to change |
|---|---|
| Try a different model | The model id only |
| New base URL | Never (stays https://anymodel.org/v1) |
| New API key per provider | Never (one key for all) |
A note on privacy
By default, requests pass through normally. If you don't want prompts and responses retained on our side, enable Ghost Mode — opt-in zero-retention keys where we keep only a token counter, not your code or outputs. Be honest with yourself about the limits, though: the model provider still receives the prompt to generate a response, so this isn't "100% privacy" — it's zero retention on our end.
Troubleshooting
- Model doesn't show up: make sure you added the exact id and enabled it in the custom list.
- 401 / auth failed: the base URL must be the
/v1root, not a full path; re-paste the key. - Cursor "verify" fails: test with the curl above to isolate whether it's Cursor or the key.
For more setup walkthroughs and model deep-dives, browse the blog.
Start in two minutes
Wiring GPT-5.2 Codex into Cursor is a one-time, one-minute config — and once it's done, every other model is a dropdown away. Create your free account, grab a key, and paste it into Cursor today.
AnyModel