May 19, 20264 min readSetupGPT-5.2 CodexWindsurf

How to use GPT-5.2 Codex in Windsurf

Windsurf is a fast, agentic IDE, and GPT-5.2 Codex is one of the strongest models available for writing, refactoring, and reviewing code. The catch is that Windsurf's built-in plans don't always expose the exact model you want, and juggling separate API keys per provider gets tedious. This guide shows how to wire GPT-5.2 Codex into Windsurf through a single OpenAI-compatible endpoint so you can switch models without touching your config again.

Why route through one endpoint

AnyModel gives you one base URL and one API key that reach every major model — GPT, Claude, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. Switching from GPT-5.2 Codex to, say, Claude or Gemini means changing one string: the model id. Nothing else in your setup changes.

That matters in Windsurf, where you might want a Codex model for heavy refactors and a cheaper model for quick autocomplete-style edits. You can browse everything available on the models page, and if you're weighing cost or capability trade-offs, the compare tool lays them out side by side.

Step 1: Get an API key

Create a free account and grab your key. You start with 1,000,000 tokens on signup, and you can reach 6,000,000 total by linking Telegram — no credit card required. After that it's pay-per-token: no subscription, no monthly minimums.

Keep your key handy; you'll paste it into Windsurf in a moment.

Step 2: Add a custom OpenAI-compatible provider in Windsurf

Windsurf supports custom OpenAI-compatible endpoints. Open Windsurf settings and find the model/provider configuration (under Cascade or AI provider settings, depending on your version). Add a new provider with these values:

Field Value
Base URL https://anymodel.org/v1
API key your AnyModel key
Model id gpt-5.2-codex

The base URL is the OpenAI-compatible root. Windsurf appends the standard /chat/completions path automatically, so you only supply the base URL above.

Note: Windsurf is configured manually like Cursor, Zed, Cline, Aider, and Continue. The one-line installer is only for the codex, claude, opencode, and hermes CLIs — not for IDE extensions.

Step 3: Verify the connection

Before relying on it inside the editor, confirm the endpoint and key work from your terminal:

curl https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $ANYMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.2-codex",
    "messages": [{"role": "user", "content": "Reply with: connected"}]
  }'

A clean JSON response with connected means Windsurf will work too. If you get a 401, recheck the key; a 404 usually means the base URL is missing /v1.

Step 4: Use it in Cascade

Open the Cascade panel, select your custom provider, and pick gpt-5.2-codex. Now you can:

  • Ask for multi-file refactors and let the agent edit across your repo.
  • Paste a stack trace and request a fix with a diff.
  • Generate tests for a function or module.
  • Request a code review of a staged change before you commit.

Because the model id is the only thing tied to a specific model, you can keep a couple of providers configured — one for Codex, one for a lighter model — and switch per task.

Switching models later

Want to try a different model on the same task? Duplicate the provider entry and change the model id. Some ids worth knowing:

  • gpt-5.2-codex — agentic coding, refactors, reviews
  • swap in a Claude, Gemini, or DeepSeek id for comparison

Your base URL and key never change. That's the whole point of a unified gateway.

A note on privacy

By default, prompts and responses pass through to the model provider as normal. If you want zero retention on our side, enable Ghost Mode — an opt-in setting where we don't store your prompts or responses, only a token counter. Be honest with yourself about what that means: the underlying model provider still receives your prompt to generate a response. Ghost Mode covers our side, not theirs.

Troubleshooting quick hits

  • Model not found — double-check the exact model id; typos in the version string are common.
  • Empty completions — make sure Windsurf is pointed at the custom provider and not falling back to a built-in one.
  • Slow first token — large agentic prompts take a moment; this is normal for Codex-class models.

For more setup walkthroughs across editors and CLIs, browse the blog.

Start in two minutes

Grab your free tokens, paste the base URL and key into Windsurf, set the model to gpt-5.2-codex, and you're coding. Create your free account — no credit card, and 6,000,000 tokens once you link Telegram.

Read next