How to use Claude Sonnet 4.6 in Cursor
Cursor is one of the most popular AI-first code editors, and Claude Sonnet 4.6 is a strong default for everyday coding: fast, good at long files, and reliable with multi-step edits. The catch is that Cursor's built-in plans bundle models behind a subscription. If you'd rather pay per token and reuse the same key across every model you touch, you can point Cursor at an OpenAI-compatible gateway instead. This guide shows exactly how.
What you'll need
- A Cursor installation (latest version recommended).
- An AnyModel API key. Sign up gets you 1,000,000 free tokens, or 6,000,000 total if you link Telegram — no credit card required.
- Two values to paste into Cursor: a base URL and your key.
AnyModel exposes a single OpenAI-compatible endpoint at https://anymodel.org/v1. One key reaches every model — Claude, GPT, Gemini, DeepSeek, GLM, Kimi, Qwen, and Grok. Switching models later just means changing the model ID, nothing else.
Step 1: Open Cursor's model settings
Go to Cursor Settings → Models (or Settings → AI). Scroll to the OpenAI API Key section. Cursor lets you override the API base URL here, which is what makes a custom gateway work.
Step 2: Set the base URL and key
- Toggle on the OpenAI API key option.
- Paste your AnyModel key into the key field.
- Click Override OpenAI Base URL and enter:
https://anymodel.org/v1
- Save, then hit Verify so Cursor confirms the connection.
Cursor's one-line installers don't cover it — the bash <(curl ...) shortcut from AnyModel only supports codex, claude, opencode, and hermes. For Cursor (and Windsurf, Zed, Cline, Aider, Continue), the manual base-URL setup above is the correct path.
Step 3: Add the Claude Sonnet 4.6 model ID
In the same Models panel, add a custom model and enter the Claude Sonnet 4.6 model ID exactly as listed in the AnyModel model catalog. Cursor sends that ID straight through to the gateway, so the name must match what AnyModel expects.
A quick sanity check from your terminal confirms the key and ID work before you rely on them in the editor:
curl https://anymodel.org/v1/chat/completions \
-H "Authorization: Bearer $ANYMODEL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Reply with: ready"}]
}'
If you get a ready back, Cursor will too.
Step 4: Select it in chat and inline edits
Open the chat panel (or the inline edit box with Cmd/Ctrl+K) and pick Claude Sonnet 4.6 from the model dropdown. Now your prompts, Composer sessions, and inline refactors route through AnyModel.
Choosing the right model for the job
You're not locked in. Because the model ID is the only thing that changes, you can keep several configured and switch per task:
| Task | Good pick |
|---|---|
| Day-to-day edits, refactors | Claude Sonnet 4.6 |
| Cheap bulk operations | DeepSeek, Qwen, GLM |
| Cross-checking an answer | Switch to GPT or Gemini |
Not sure which to keep around? The model comparison page lays out tradeoffs side by side.
A note on privacy
By default, prompts pass through the gateway like any API call, and the model provider always receives your prompt — that's unavoidable for any hosted model. If you want AnyModel to not store prompts or responses on its side, enable Ghost Mode, which uses opt-in zero-retention keys that keep only a token counter. It's a meaningful reduction, not a "100% private" guarantee, since Anthropic still processes the request.
Keeping costs predictable
There's no subscription and no minimum — you pay only for tokens used. To stretch your budget in Cursor:
- Keep Composer context tight; large pasted files cost tokens on every turn.
- Use a cheaper model for boilerplate, then switch to Sonnet 4.6 for the tricky parts.
- Watch your token counter in the AnyModel dashboard rather than guessing.
For more setup walkthroughs and model deep-dives, browse the AnyModel blog.
Ready to start
Grab a key, paste the base URL into Cursor, and you'll have Claude Sonnet 4.6 running in a couple of minutes — with every other model one ID away. Create your free AnyModel account and start building.
AnyModel