Error Fix · As of 2026-11-26

Cursor's Override OpenAI Base URL Breaks Anthropic BYOK: How Routing Works and Setups That Do

Cursor's "Override OpenAI Base URL" is one global switch, not a per-model or per-provider setting. When it's on, Cursor applies the OpenAI key and address to every model that isn't Claude or Gemini, including Composer and Grok. And according to a Cursor staff reply on 2026-11-05, Claude requests sent with your Anthropic key also go to that custom address while the switch is on, which is why you see ERROR_BAD_USER_API_KEY, Invalid API key. Unauthorized User API key or a 422. This guide maps where each kind of model actually goes and gives setups that work with QCode: GPT and Chinese models through https://api.qcode.cc/openai/v1, and Claude only over the Anthropic protocol.

QCode is an independent third-party API service and is not affiliated with Cursor (Anysphere), Anthropic or OpenAI. Cursor's behavior is described from Cursor's help page and staff replies on the official forum, with dates and versions.

Updated 2026-11-26

Key facts

  • Cursor staff (2026-09-23): the OpenAI key and override apply to every model that is not Claude or Gemini, including Composer and Grok. Those run on Cursor's own infrastructure, so an attached custom key gets them rejected.
  • Cursor staff (2026-11-05, Cursor 3.27.22): the override is one global setting. When it's on, Claude requests go to that URL too and the gateway rejects the key. Per-provider base URLs are "not supported yet".
  • On QCode, Claude is served only on the Anthropic protocol (https://api.qcode.cc/api). A Claude model ID sent to the OpenAI-compatible path returns model_not_available_on_endpoint, so the "rename Claude and route it through an OpenAI gateway" workaround doesn't apply to QCode.
  • GPT and Chinese models (GLM, Kimi, DeepSeek, Qwen) work in Cursor through the OpenAI key slot plus https://api.qcode.cc/openai/v1.
  • Tab completion never uses your own keys, and Cursor's Zero Data Retention policy doesn't apply to BYOK requests.

Why it breaks: how Cursor assigns keys and addresses

Cursor Settings → Models has key slots ("OpenAI API Key", "Anthropic API Key", Google and others) plus an "Override OpenAI Base URL" toggle and URL field. Pulling together the 2026 forum reports and staff replies, routing looks like this:

Model you pick Key Cursor uses Where the request goes With the override on
claude-*, Anthropic key on Anthropic API Key Anthropic Also sent to the override URL; gateway rejects the key (staff, 2026-11-05)
claude-*, Anthropic key off none Cursor-managed usage Unaffected
gemini-* Google key Google Staff said on 2026-09-23 it isn't affected by the OpenAI key
Composer, Grok and other Cursor models OpenAI key, if on Cursor infrastructure This model does not support custom API keys or Invalid API key. Unauthorized User API key
Custom models you added OpenAI key Override URL Works; this is what the override is for
Third-party models in Cursor's built-in catalog — Cursor-hosted Override ignored, per a 2026-10-22 forum post

The problem is old. On 2025-12-01 (Cursor 2.1.26) a user reported every Claude model returning 422 once the override was set. On 2025-12-22 (2.2.43) another reported the override switching itself back on after an Anthropic key was entered. New reports followed on 2026-09-23 (3.21.18) and 2026-11-05 (3.27.22). Each time staff called it a known issue, with no fix date.

Context: why more people bring their own key since October 2026

According to a dev.to report dated 2026-11-24, Cursor rebuilt its individual plans around Grok in October 2026: Grok and Composer come with weekly allowances, while Claude, GPT and Gemini are billed at API list price from prepaid credit on paid tiers. Check Cursor's pricing page for the current plan names and prices. Cursor's help page says that on individual plans, requests made with your own key are billed by the provider directly and don't use included usage or prepaid credit; on Teams and Enterprise the Cursor Token Rate of $0.25 per million tokens (as of 2026-11-26) still applies to eligible third-party models, BYOK included. So more users are wiring their own keys or third-party APIs into Cursor, and more of them hit the global toggle.

Three setups that work with QCode

Remember QCode's protocol rule first: Claude only on the Anthropic API, GPT only on the OpenAI API, Chinese models on either. Cursor's custom OpenAI channel maps to QCode's https://api.qcode.cc/openai/v1.

Setup A: GPT and Chinese models in Cursor (recommended, most stable)

  1. Open Cursor Settings → Models.
  2. Paste your QCode cr_ key into "OpenAI API Key" and turn it on.
  3. Turn on "Override OpenAI Base URL" and enter https://api.qcode.cc/openai/v1 (no trailing slash, don't drop /v1).
  4. Click "+ Add model" and add model IDs one by one, for example the two GPT IDs below; add any Chinese model ID exactly as listed on /models:

text gpt-6.2-sol gpt-6.2-astra

  1. Tick the models, click "Verify", then pick one in Chat and send a test message.
  2. Turn off "Anthropic API Key" so Claude requests aren't sent to the OpenAI address.

Notes:

  • Use model IDs exactly as listed on /models; they're case-sensitive.
  • If an ID matches a model in Cursor's built-in catalog (the forum has a report of a built-in model name being "reserved"), Cursor may still use its own hosted version. Untick the built-in model with the same name and test again.
  • To use Composer or Grok for a while, turn off the OpenAI API Key slot first (staff's advice from 2026-09-23) and turn it back on afterwards.
  • Cursor's help page describes OpenAI BYOK as "standard, non-reasoning chat models". Reasoning models such as GPT-6.2 can be called, but test whether settings like reasoning effort take effect.

Setup B: Claude inside the Cursor environment

B1: your Settings page has a separate Anthropic base URL override. QCode's Cursor docs (written against 3.31.x) describe an "Override Anthropic Base URL" field. Cursor's own help page and changelog don't mention it, and staff said on 2026-11-05 that per-provider base URLs aren't supported yet. So check Settings → Models first. If the field is there:

  • put your cr_ key in "Anthropic API Key" and turn it on;
  • set the Anthropic override to https://api.qcode.cc/api (no /v1, no trailing slash);
  • add model IDs such as claude-opus-5-5 and claude-sonnet-5-5;
  • while you use Claude, clear and turn off "Override OpenAI Base URL". QCode's docs note that with both overrides on, Claude traffic can go to the OpenAI address and return 422.

B2: no Anthropic override (the usual case). Then the Anthropic slot can only reach Anthropic itself and can't point at QCode. The reliable route is to run Claude Code in Cursor's integrated terminal and point it at QCode:

# macOS / Linux / Git Bash
export ANTHROPIC_BASE_URL=https://api.qcode.cc/api
export ANTHROPIC_AUTH_TOKEN=cr_your_key
claude
# Windows PowerShell (current window only)
$env:ANTHROPIC_BASE_URL = "https://api.qcode.cc/api"
$env:ANTHROPIC_AUTH_TOKEN = "cr_your_key"
claude

Cursor handles the editor and GPT/Chinese models, Claude Code handles Claude agent work, and both use the same QCode key without stepping on each other. Anthropic also documents a Claude Code extension for VS Code; whether it runs inside Cursor depends on your build, so check Anthropic's current docs (see Related reading).

Why the "rename" workaround doesn't help here. On 2026-11-05 staff suggested that if your gateway can serve Claude upstream with your Anthropic key, you can add Claude as a custom model whose name doesn't start with claude. That only works if the gateway offers Claude on an OpenAI-compatible API. QCode doesn't: Claude models are served only through the Anthropic Messages API, and the OpenAI-compatible path returns model_not_available_on_endpoint before it even checks the key. Don't add Claude models to the OpenAI slot.

B3: use Cursor's built-in Claude. With the Anthropic key and the override both off, Claude runs on Cursor-managed usage and is billed under your Cursor plan.

Setup C: two separate Cursor profiles

The 2026-11-05 reporter described launching a second Cursor profile with --user-data-dir: one profile keeps the override on for custom models, the other stays default. That avoids flipping toggles, at the cost of maintaining two sets of settings, extensions and sign-ins.

When the toggle turns itself back on

Reports from December 2025 to January 2026 describe the override re-enabling itself after an Anthropic key was entered, or the URL field reverting. Staff's troubleshooting steps at the time:

  1. Clear the override URL field.
  2. Turn the override toggle off.
  3. Quit Cursor completely (Cmd+Q on macOS; on Windows close all windows and make sure the process has exited).
  4. Relaunch and check that the toggle is still off.

If your version still does this, update to the latest stable build and repeat.

Test the key and address outside Cursor first

If "Verify" fails, rule out the key and address with curl:

curl https://api.qcode.cc/openai/v1/chat/completions \
  -H "Authorization: Bearer cr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.2-sol","messages":[{"role":"user","content":"ping"}]}'

A normal reply means the key, address and model ID are fine and the problem is in Cursor's settings. model_not_available_on_endpoint means you sent a Claude ID to the OpenAI path.

Error lookup

Error / symptom When Cause Fix
ERROR_BAD_USER_API_KEY / Invalid API key. Unauthorized User API key Anthropic key on + override on, Claude selected Claude request sent to the override URL Turn the override off for Claude, or use setup B
This model does not support custom API keys OpenAI key on, Composer or Grok selected Cursor models refuse custom keys Turn the OpenAI API Key off temporarily
422 Override set, Claude selected Same as above (Dec 2025 report, QCode docs) Clear and disable the override
model_not_available_on_endpoint Claude model added to the OpenAI slot QCode serves Claude only on the Anthropic API Remove it; use setup B
Verify fails but curl works Trailing / or missing /v1 Path is wrong Use https://api.qcode.cc/openai/v1
New model missing from the picker ID typo or not ticked — Check the ID (case-sensitive), tick it, restart
Custom model name "reserved" Same name as a built-in catalog model Cursor prefers its hosted version Untick the built-in model
Tab doesn't use QCode Any setup Tab only uses Cursor's own models By design

For 404s and model_not_found caused by wrong IDs, see our model-not-found guide.

FAQ

Why does turning on the override for GPT break Claude?

Because "Override OpenAI Base URL" is global. Per a Cursor staff reply on 2026-11-05, while it's on, Claude requests sent with your Anthropic key also go to that address and get rejected; per-provider base URLs aren't supported yet.

Is it normal that Composer and Grok fail once the OpenAI key is on?

Yes. Staff explained on 2026-09-23 that the OpenAI key and override apply to every non-Claude, non-Gemini model, and Composer and Grok run on Cursor's infrastructure, which rejects custom keys. Turn the OpenAI API Key off while you use them.

Can I use Claude through QCode in Cursor's OpenAI slot?

No. QCode serves Claude only on the Anthropic Messages API, and the OpenAI-compatible path returns model_not_available_on_endpoint. For Claude in the Cursor environment, use an Anthropic override if your build has one, run Claude Code in the integrated terminal, or use Cursor's built-in Claude.

Does Cursor have an "Override Anthropic Base URL" setting?

Sources disagree. QCode's Cursor docs describe one, but Cursor's help page and changelog don't mention it, and staff said on 2026-11-05 that per-provider base URLs aren't supported yet. Trust what your own Settings → Models page shows.

Does Cursor still charge me when I use my own key?

Per Cursor's help page, on individual plans BYOK requests are billed by the provider directly and don't use included usage or prepaid credit. On Teams and Enterprise, the $0.25 per million token Cursor Token Rate still applies to eligible third-party models. Tab always uses Cursor's own models.

Does BYOK change Cursor's privacy guarantees?

Yes. Cursor's help page says its Zero Data Retention policy doesn't apply to BYOK requests; the provider's policy applies instead, and requests still pass through Cursor's servers for prompt building. Teams that depend on ZDR should stay on built-in models.

Which models should I use in Cursor through QCode?

In the OpenAI slot, gpt-6.2-sol, gpt-6.2-astra and Chinese models such as GLM, DeepSeek and Qwen; check live prices on /models. For Claude, use claude-opus-5-5 or claude-sonnet-5-5 through Claude Code.

Pay-as-you-go: one key for Cursor at official prices

If you only want GPT and Chinese models in Cursor without another monthly plan, QCode's pay-as-you-go packs fit well: packs start at $4 for $30 of usage and are valid 7 days. Anthropic and OpenAI models are billed at official API price ×1.0; Chinese models are billed at the rate shown on /models. The same key covers the OpenAI protocol Cursor uses and the Anthropic protocol Claude Code uses. See /pricing for every plan.

Pay-as-you-go: one key for Cursor at official prices

One key for both the Anthropic Messages API and OpenAI-compatible APIs. Claude and GPT are billed at the official price ×1.0; live rates are on /models.

Not sure where to start?

Try it for a week

Small Pack: $4 for $30 of quota, valid 7 days

Use it every day

Starter: $9.00/month with $5 of quota every day — just $0.060 per $1 of quota, vs about $0.113 for the Medium Pack