Cursor Custom Base URL Errors: Verify Failures, 404s & Streaming Fixes
Key Takeaways
- Exact error payloads:
404 {"error":{"message":"Invalid URL (POST /chat/completions)"}},404 {"error":{"code":"model_not_found"}}during Verify,401 invalid_api_key, orConnection failed. If the problem persists, please check your internet connection or VPN.- Root causes: Missing
/v1(or doubled/v1/v1) in Override OpenAI Base URL, Cursor's Verify probe testing an unsupported built-in model toggle, Anthropic API Key shadowing the OpenAI Base URL route, or HTTP/2 stream resets across VPNs/proxies.- 1-minute fix: In Cursor Settings → Models, turn OFF Anthropic/Google keys, paste your
sk-key in OpenAI API Key, toggle Override OpenAI Base URL ON withhttps://byesu.com/v1(no trailing slash), addclaude-sonnet-5-5orgpt-6.2-solvia + Add Custom Model, disable unused default toggles, and click Verify.
Enabling Override OpenAI Base URL in Cursor lets you call GPT, Claude, Gemini, and DeepSeek models through a single OpenAI-compatible endpoint. Because Cursor routes BYOK traffic differently from CLI tools like Claude Code, five specific configuration traps account for nearly all setup failures.
Symptom-to-Fix Quick Matrix
| What Cursor shows | Underlying cause | Jump to fix |
|---|---|---|
404 Invalid URL (POST /chat/completions) or POST /v1/v1/chat/completions | Base URL is missing /v1 (https://byesu.com) or has /v1/v1 / /chat/completions appended | Fix 1 |
Clicking Verify fails (model_not_found / Verify failed), even though curl succeeds | Verify probes a built-in default model toggle not served by your gateway/group, or the Override toggle switch is still OFF | Fix 2 |
401 Incorrect API key provided or authentication_error on claude-* models | Anthropic API Key is enabled (sending requests to api.anthropic.com), or Override OpenAI Base URL wasn't saved before enabling the key | Fix 3 |
| Chat / Composer works, but Cursor Tab autocomplete is greyed out or asks for Pro | Honest architectural boundary: BYOK covers Chat / Cmd+K / Composer, while Cursor Tab uses Cursor's proprietary hosted model | Fix 4 |
Connection failed. If the problem persists, please check your internet connection or VPN or mid-answer stream stalls | HTTP/2 multiplexing reset over VPN/proxy, or using localhost (unreachable from Cursor's cloud backend) | Fix 5 |
Fix 1: Set Override OpenAI Base URL With a Single /v1
Developers switching between Claude Code CLI and Cursor get tripped up because the two tools follow opposite path conventions:
- Claude Code (
ANTHROPIC_BASE_URL) appends/v1/messagesautomatically → expects barehttps://byesu.com. - Cursor (
Override OpenAI Base URL) appends/chat/completionsdirectly → requires/v1at the end.
# Wrong — sends POST https://byesu.com/chat/completions -> HTTP 404
https://byesu.com
# Wrong — sends POST https://byesu.com/v1/v1/chat/completions -> HTTP 404
https://byesu.com/v1/v1
# Wrong — sends POST https://byesu.com/v1/chat/completions/chat/completions -> HTTP 404
https://byesu.com/v1/chat/completions
# Correct — Cursor requests POST https://byesu.com/v1/chat/completions -> HTTP 200
https://byesu.com/v1Raw gateway logs when /v1 is omitted look like this:
{
"error": {
"message": "Invalid URL (POST /chat/completions)",
"type": "invalid_request_error",
"param": "",
"code": ""
}
}Leave off the trailing slash (https://byesu.com/v1, not https://byesu.com/v1/) so request signing and path normalization stay clean across Cursor updates.
Fix 2: Pass Cursor's Verify Check by Selecting a Valid Custom Model
Cursor's Verify button does not merely ping /v1/models — it dispatches an actual test completion using one of the currently checked models in Cursor Settings → Models. That triggers two frequent false negatives:
- A retired or unserved built-in model is checked. If
gpt-4o,gpt-5(retiring in the 2026-12-11 OpenAI shutdown), or a Cursor-internal alias is enabled at the top of your model list, Cursor probes that model ID against your gateway and receives HTTP 404 (model_not_found) or no available channel. - The URL text box is filled, but the Override toggle is OFF. Cursor resets or collapses the Override OpenAI Base URL sub-panel in some versions until you click Save next to the URL field and flip the toggle ON. If the toggle is OFF, Verify sends your gateway key straight to
https://api.openai.com/v1and fails with401 invalid_api_key.
Clean Verification Sequence
- Open Cursor Settings → Models.
- Uncheck built-in OpenAI/Anthropic model toggles that you do not plan to route through the gateway.
- Click + Add Custom Model (or + Add model), enter an exact active model ID such as
claude-sonnet-5-5orgpt-6.2-sol, and keep it checked. - Paste
https://byesu.com/v1under Override OpenAI Base URL, click Save, and confirm the Override switch is ON. - Paste your
sk-...token into OpenAI API Key and click Verify (or toggle the OpenAI API Key switch ON).
If a model ID still returns model_not_found, check OpenAI API 404 model_not_found Fixes or Claude API 404 model_not_found Fixes.
Fix 3: Fix 401 Errors and API Key Slot Precedence
Cursor exposes separate credential slots under Models → API Keys:
| Cursor Settings Slot | Uses Override OpenAI Base URL? | Where requests actually go |
|---|---|---|
| OpenAI API Key | Yes (when Override toggle is ON) | https://byesu.com/v1/chat/completions |
| Anthropic API Key | No | Hardcoded to https://api.anthropic.com |
| Google API Key | No | Hardcoded to Google's Gemini endpoint |
If you paste an OpenAI-compatible gateway token into Anthropic API Key, or leave an old key active inside Anthropic API Key while picking a Claude model, Cursor bypasses Override OpenAI Base URL and sends the request directly to Anthropic's official servers — returning:
{
"type": "error",
"error": {
"type": "authentication_error",
"message": "invalid x-api-key"
}
}Fix:
- Turn Anthropic API Key, Google API Key, and Azure API Key completely OFF.
- Put your
sk-...token only in OpenAI API Key. - Add custom model names (
claude-opus-5-5,claude-sonnet-5-5,gpt-6.2-sol,gemini-4-argon) under the custom model list so Cursor treats them as OpenAI-compatible chat models routed viahttps://byesu.com/v1. For general key diagnostics, see OpenAI 401invalid_api_keyTroubleshooting.
Fix 4: Cursor Agent / Composer vs Tab Autocomplete Boundaries
Understanding what Cursor allows over a custom Base URL saves hours of chasing non-existent bugs:
| Cursor Feature | Works with Custom OpenAI Base URL? | Engineering Details |
|---|---|---|
Chat (Cmd+L / Ctrl+L) | Yes | Full streaming chat on any custom model (claude-sonnet-5-5, gpt-6.2-sol, etc.) |
Inline Edit (Cmd+K / Ctrl+K) | Yes | Uses your selected custom model via /v1/chat/completions |
| Composer / Agent Mode | Yes (model-dependent) | Works with strong tool-calling models (claude-opus-5-5, claude-sonnet-5-5, gpt-6.2-sol). Some Cursor releases gate specific proprietary Agent sub-tools on Free accounts |
| Cursor Tab (Next-Edit Autocomplete) | No | Powered exclusively by Cursor's proprietary low-latency Fusion model on Cursor's own servers; requires a Cursor plan |
| Fast Apply & Codebase Indexing | No | Handled by Cursor's hosted infrastructure, never sent to your custom Base URL |
If you want a coding workflow with zero IDE subscription dependency where every single request runs through your own API key, combine Cursor Chat/Edit with Claude Code CLI, Codex CLI, or the open-source VS Code extension Cline.
Fix 5: Fix HTTP/2 Streaming Stalls and Proxy Disconnects
Two network architecture details make Cursor behave differently from a local Python script:
- Cursor relays BYOK requests through Cursor's cloud backend. When you hit Enter in Chat, your IDE talks to Cursor's backend (
api2.cursor.sh), and Cursor's servers call yourOverride OpenAI Base URL. Because of this, local URLs (http://localhost:3000/v1,http://127.0.0.1:11434/v1, or LAN IPs) always fail unless exposed over public HTTPS. Public HTTPS gateways likehttps://byesu.com/v1are reachable directly from Cursor's servers without extra tunnels. - HTTP/2 bi-directional streams drop behind VPNs, TUN proxies, or corporate firewalls. Cursor uses gRPC / HTTP/2 between the desktop client and Cursor's backend. Packet inspection or MTU mismatches often trigger mid-response freezes or
Connection failed. If the problem persists, please check your internet connection or VPN.
Fix for HTTP/2 stalls: Open Cursor Settings → General → Network and set HTTP Compatibility Mode to HTTP/1.1 (or open VS Code settings.json via Cmd+Shift+P → Preferences: Open User Settings (JSON) and add):
{
"cursor.general.disableHttp2": true
}Restart Cursor after saving. For deeper proxy buffering diagnostics, see SSE Streaming Connection Dropped Fixes.
5-Second Gateway Diagnostic Test
Before debugging Cursor's UI state, confirm your token, network, and model ID outside the IDE in 5 seconds:
curl -fsSL https://docs.byesu.com/setup/test.sh | sh
# Or pass your token directly:
curl -fsSL https://docs.byesu.com/setup/test.sh | bash -s -- sk-YOUR_TOKENOr test the exact /v1/chat/completions payload Cursor sends during Verify:
curl -sS https://byesu.com/v1/chat/completions \
-H "Authorization: Bearer sk-YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5-5",
"messages": [{"role": "user", "content": "Reply OK"}],
"max_tokens": 16
}'- If
curlreturns HTTP 200 with"choices", your key andhttps://byesu.com/v1are healthy — any remaining error is inside Cursor's model toggles or API key switches (Cursor Setup Guide). - Generate ready-to-paste configs for Cursor, Claude Code, and Codex with the AI Client & SDK Config Generator.
FAQ
Should Cursor Override OpenAI Base URL end with /v1?
Yes. Cursor appends /chat/completions directly to the Override OpenAI Base URL value. Enter https://byesu.com/v1 (with /v1, no trailing slash). Entering https://byesu.com without /v1 sends POST /chat/completions and fails with HTTP 404, while https://byesu.com/v1/v1 doubles the prefix.
Why does Cursor Verify fail when my API key works in curl?
When you click Verify, Cursor sends a test completion using one of the currently enabled models in your Models list (often a built-in default like gpt-4o or a retired snapshot). Disable unsupported built-in model toggles, add an active gateway model ID such as claude-sonnet-5-5 or gpt-6.2-sol via + Add Custom Model, ensure the Override OpenAI Base URL switch is toggled ON, and click Verify again.
Why do Claude models in Cursor return 401 when using an OpenAI-compatible gateway?
Override OpenAI Base URL only applies to the OpenAI API Key slot. If Anthropic API Key is enabled or you select a locked Anthropic-native preset, Cursor sends the request straight to api.anthropic.com instead of your custom Base URL. Turn OFF Anthropic API Key and Google API Key, put your sk- token in OpenAI API Key, and add claude-sonnet-5-5 as a custom model.
Does Override OpenAI Base URL power Cursor Tab autocomplete?
No. Custom OpenAI Base URL (BYOK) powers Chat, Composer, Inline Edit (Cmd+K / Ctrl+K), and custom-model Agent turns. Cursor Tab next-edit autocomplete, fast Apply, and codebase indexing run on Cursor's proprietary hosted models and require a Cursor plan.
How do I fix Connection failed or stalled streaming in Cursor with a custom Base URL?
Open Cursor Settings → Network (or set "cursor.general.disableHttp2": true in settings.json) to switch HTTP Compatibility Mode to HTTP/1.1. Also note that Cursor routes custom OpenAI Base URL calls through its cloud backend, so 127.0.0.1 or localhost URLs are unreachable without a public HTTPS endpoint.