May 4, 20263 min readSetupClaude Sonnet 4.6Windsurf

How to use Claude Sonnet 4.6 in Windsurf

Windsurf is a fast, agentic IDE — but you don't have to live inside its default model menu. With an OpenAI-compatible gateway you can route Windsurf's chat and agent features to Claude Sonnet 4.6, Anthropic's strong coding-and-reasoning model, using a single key that also unlocks GPT, Gemini, DeepSeek, and more. This guide shows the exact setup.

Why run Claude Sonnet 4.6 through AnyModel

AnyModel exposes one OpenAI-compatible endpoint for every model. The base URL is always https://anymodel.org/v1, and one API key reaches all providers. Want to switch from Claude to GPT or Gemini later? Change the model id — nothing else.

A few practical reasons this matters for Windsurf:

  • No separate billing per provider. Pay-per-token, no subscription, no minimums.
  • Free to start. You get 1,000,000 tokens on signup, and a total of 6,000,000 if you link Telegram — no credit card.
  • One config, many models. Test Claude Sonnet 4.6 against other models without re-wiring your editor.

Step 1 — Get your API key

Create a free account at AnyModel and copy your API key from the dashboard. Keep it handy; you'll paste it into Windsurf once.

Step 2 — Add AnyModel as a custom provider in Windsurf

Windsurf isn't one of our one-line install tools (those are limited to codex, claude, opencode, and hermes). Instead, use the standard manual OpenAI-compatible setup — Windsurf supports custom providers natively.

  1. Open Windsurf Settings → Cascade / Models (the model configuration panel).
  2. Add a custom OpenAI-compatible provider.
  3. Fill in the two fields that matter:
Field Value
Base URL https://anymodel.org/v1
API Key your AnyModel key
Model ID the Claude Sonnet 4.6 id (see below)

That's the whole connection. Because the endpoint speaks the OpenAI protocol, Windsurf's chat and agent calls flow straight through.

Step 3 — Set the model id

The only thing that selects Claude Sonnet 4.6 is the model string. Use the Sonnet 4.6 id exactly as listed on the models page, then save. If Windsurf lets you pin a default model for Cascade, set it there so every new conversation uses Claude automatically.

Step 4 — Verify it works

Before relying on it inside the editor, confirm the key and model respond. Run this from a terminal:

curl https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Reply with: Windsurf is connected."}]
  }'

A normal JSON completion means your base URL, key, and model id are all correct. If you get a 401, recheck the key; a 404 on the model usually means the id string doesn't match the one on the models page.

Using Sonnet 4.6 well in Windsurf

Once connected, a few habits keep results sharp:

  • Give Cascade context. Open the relevant files or let it index the repo so the model reasons over real code, not guesses.
  • Be explicit about scope. Ask for a specific function, test, or refactor rather than "fix everything."
  • Watch your token budget. Long agent runs over a big codebase consume tokens quickly; your dashboard shows usage in real time.

A note on privacy

If you handle sensitive code, enable Ghost Mode — opt-in, zero-retention API keys where your prompts and responses aren't stored on our side (only a token counter runs). To be clear: this is not "100% privacy," because the underlying model provider still receives your prompt to generate a response. It simply removes retention on AnyModel's side.

Wrapping up

Connecting Claude Sonnet 4.6 to Windsurf is a two-field change: point the base URL at https://anymodel.org/v1, paste your key, and set the model id. From there you can swap models any time, compare outputs, and only pay for the tokens you use. For more setup walkthroughs and model comparisons, browse the blog.

Ready to try it? Create a free AnyModel account and get your key in under a minute — 1,000,000 tokens to start, no credit card.

Read next