← Back to Blog

Cursor "Override OpenAI Base URL" Breaks Claude Models — What Works and What Doesn't

2026-07-05·4 min read·CodeRouter Team
cursor override openai base urlcursor anthropic base url bugcursor claude models not working custom apicursor custom api key 422cursor byok router setup

TL;DR — Cursor's "Override OpenAI Base URL" setting redirects Cursor's OpenAI-key traffic to any OpenAI-compatible endpoint, but it interacts badly with Anthropic models: with the override set, Claude model requests can be sent to the wrong endpoint and fail (users report 422s), and enabling an Anthropic BYOK key can silently toggle the override. Separately, only some Cursor features honor custom endpoints at all — several rely on Cursor-hosted models regardless of your settings. The reliable pattern: route through one OpenAI-compatible router endpoint, select models via the router (not via Cursor's per-provider keys), and don't mix native Anthropic BYOK with an OpenAI override.

The two distinct problems

Debugging this is confusing because two independent things fail in similar ways:

Problem 1 — the override hijacks Claude requests. Users on the Cursor forum report that once Override OpenAI Base URL is set, Anthropic models break with 422 errors: Cursor attempts to send Claude traffic through the overridden URL, where the payload doesn't match what the endpoint expects. There's also a report that enabling Anthropic BYOK auto-switches the override on, so the broken state can appear without you touching the OpenAI setting.

Problem 2 — some features never use your endpoint. Custom API keys and base-URL overrides only apply to the features that run on standard chat completions. Features that depend on Cursor-hosted or specialized models — Tab autocomplete being the clearest case, per Cursor's own API-keys documentation — keep using Cursor's backend no matter what you configure. If you expected 100% of traffic to flow through your endpoint (for compliance or cost tracking), verify per-feature.

What actually works

The configurations that hold up in practice:

Option A: one router endpoint, models selected at the router

Instead of juggling per-provider keys inside Cursor, point the OpenAI override at a single OpenAI-compatible router and let it fan out to providers:

  1. Cursor Settings → Models → check Override OpenAI Base URL
  2. Base URL: https://www.coderouter.io/api/v1
  3. API key: your router key (put it in the OpenAI key field)
  4. Turn off the Anthropic/Google native BYOK keys in Cursor — model choice happens at the router (e.g. auto for phase-aware routing, or an explicit model ID)

Because every request leaves Cursor in OpenAI chat-completions format and the router translates to each provider's native API, the "OpenAI payload sent to Anthropic endpoint" class of failure disappears. Claude, GPT, DeepSeek and Gemini all arrive through the same door.

Option B: native Anthropic BYOK, no override

If all you want is Claude with your own Anthropic key: set only the Anthropic key, and make sure Override OpenAI Base URL is off (check it after enabling BYOK — see the auto-toggle report above). You lose multi-provider routing but stay on Cursor's happy path.

What to avoid

The broken middle: Anthropic BYOK enabled and an OpenAI base-URL override set. That's the combination behind most "Claude worked yesterday, 422 today" reports.

Verifying your setup

After changing keys or URLs:

  1. Use Cursor's Verify button on the key settings — but don't trust it alone; it validates the key format/endpoint reachability, not every feature path.
  2. Test chat with an explicit Claude model and an explicit GPT model — both should answer.
  3. If you run your own router or gateway, check its request log: you should see Cursor's chat traffic arriving, and you should not see malformed 4xx bursts when switching models.
  4. Remember Tab autocomplete will not appear in your router logs at all — that's expected, not a misconfiguration.

FAQ

Why 422 and not 401?

A 401 means authentication failed. The 422 class means the request body didn't validate — which is what you get when a payload built for one provider's schema lands on an endpoint expecting another. That's why the fix is about where requests are sent, not about your key.

Can I keep Cursor subscription models AND a custom endpoint?

Yes — BYOK/custom endpoints coexist with Cursor's built-in models; you pick per conversation. Just keep the combinations clean (Option A or B above), because the settings interact.

Does this apply to Windsurf / Continue / Aider too?

The general lesson does: mixed per-provider BYOK plus a global OpenAI-endpoint override is fragile in any IDE agent. Tools that speak pure OpenAI-compatible protocol to one endpoint (Aider with OPENAI_API_BASE, Continue with an explicit apiBase) avoid the problem structurally — one endpoint, one schema.


Sources: Cursor forum: Anthropic models break when Override OpenAI BaseUrl is set, Cursor forum: override auto-switches on with Anthropic BYOK, Cursor docs: Bring your own API key.

Ready to Reduce Your AI API Costs?

CodeRouter routes every API call to the optimal model — automatically. Start saving today.

Get Started Free →

Get weekly AI cost optimization tips

Join 2,000+ developers saving on LLM costs