TL;DR — Cursor's "Override OpenAI Base URL" setting lets you redirect all OpenAI-format traffic through any OpenAI-compatible endpoint — your own proxy, a cost-saving router, or an alternative provider like DeepSeek. This guide walks through the full custom model configuration: what the override does, when you'd want it, step-by-step setup for the most common providers, the model settings that matter, and how to verify everything works. If you've already hit errors with the override, see our companion troubleshooting article for the specific failure modes.
What "Override OpenAI Base URL" Actually Does
Before configuring anything, it helps to understand the mechanism.
By default, when you use Cursor with your own OpenAI API key (BYOK), requests go directly to https://api.openai.com/v1. The Override OpenAI Base URL setting replaces that destination with any URL you choose — as long as the endpoint speaks the OpenAI chat completions protocol (POST /chat/completions with the standard request body).
This means you can point Cursor at:
- An OpenAI-compatible provider — DeepSeek, Together AI, Fireworks, Groq, etc.
- A routing proxy — CodeRouter, LiteLLM, or your own gateway that fans out to multiple providers
- A local model server — Ollama, vLLM, LM Studio, or any local inference server
- A logging/compliance proxy — anything that intercepts, logs, and forwards requests
The override applies to all traffic that would otherwise go to OpenAI. It does not affect Cursor's built-in subscription models or features like Tab autocomplete, which use Cursor's own backend regardless of your settings.
When to Use the Override
You'd configure the override when you want to:
- Use a cheaper or faster provider — route through DeepSeek V4, Gemini, or a mix
- Control costs with a router — let a smart proxy pick the right model per task
- Run models locally — point at Ollama or vLLM for offline or air-gapped development
- Comply with data policies — route through an auditing proxy before requests reach any provider
- Access multiple providers through one endpoint — instead of managing separate API keys for OpenAI, Anthropic, Google, and DeepSeek, use a single router that translates between protocols
When NOT to Use It
Skip the override if:
- You only want to use Cursor's built-in models with your subscription — just use Cursor normally
- You only need Anthropic models with your own key — use the dedicated Anthropic BYOK field instead and leave the override off (mixing them causes problems)
Step-by-Step: Cursor Custom Model Configuration
Step 1: Open Cursor Model Settings
- Open Cursor
- Press
Cmd+Shift+J(macOS) orCtrl+Shift+J(Windows/Linux) to open Settings - Navigate to Models (in the sidebar or search for "models")
- Scroll to the API Keys section
You'll see fields for:
- OpenAI API Key
- Anthropic API Key
- Google API Key
- Override OpenAI Base URL (with a checkbox)
Step 2: Enter Your API Key
Put your API key in the OpenAI API Key field. Even if you're not using OpenAI directly, this is the field Cursor uses for the overridden endpoint's authentication.
For example:
- Using DeepSeek directly? Enter your DeepSeek API key here
- Using CodeRouter? Enter your CodeRouter API key here
- Using a local Ollama instance? You can enter any placeholder (Ollama doesn't require auth by default)
Step 3: Enable and Set the Override URL
- Check the "Override OpenAI Base URL" checkbox
- Enter your endpoint URL in the field that appears
The URL format matters. Most providers expect the base URL without a trailing /chat/completions — Cursor appends the path automatically.
✅ Correct formats:
https://api.deepseek.com/v1
https://www.coderouter.io/api/v1
http://localhost:11434/v1
https://api.together.xyz/v1
❌ Wrong formats:
https://api.deepseek.com/v1/chat/completions (Cursor appends this)
https://api.deepseek.com (missing /v1 path)
Step 4: Configure Model Names
This is the part most guides skip, and it's where custom model settings in Cursor get interesting.
After setting the override URL, you need to tell Cursor which model names to send. Go to the model dropdown in the chat panel — by default you'll see standard models like gpt-4o, claude-sonnet-4-6, etc.
The key insight: the model name Cursor sends in the request must be one that your endpoint recognizes. If your endpoint is DeepSeek, sending gpt-4o won't work. If it's a router, it depends on what the router supports.
To add custom models:
- In the Models settings, scroll to Model Names
- Click + Add Model
- Type the model identifier your endpoint expects — e.g.,
deepseek-chat,deepseek-reasoner,auto, orclaude-sonnet-4-6 - The model will appear in Cursor's model dropdown for chat and Composer
Step 5: Verify the Connection
Click the Verify button next to your API key. Cursor will make a test request to your overridden endpoint.
⚠️ Important caveat: the Verify button checks basic connectivity and authentication, but it doesn't test every feature path. After verifying, actually run a chat message with your selected model to confirm end-to-end functionality.
Provider-Specific Setup Guides
DeepSeek (Direct)
DeepSeek's API is natively OpenAI-compatible, making it the simplest override.
| Setting | Value |
|---|---|
| OpenAI API Key | Your DeepSeek API key (sk-...) |
| Override OpenAI Base URL | https://api.deepseek.com/v1 |
| Model name to add | deepseek-chat or deepseek-reasoner |
Notes:
deepseek-chat= DeepSeek V4 (general chat, very fast)deepseek-reasoner= DeepSeek R1 (reasoning model, usesreasoning_contentfield)- DeepSeek is cheap: ~$0.27/M input, $1.10/M output for V3. Good for high-volume coding
Ollama (Local Models)
Run models locally with zero API costs.
| Setting | Value |
|---|---|
| OpenAI API Key | ollama (any non-empty string) |
| Override OpenAI Base URL | http://localhost:11434/v1 |
| Model name to add | Whatever you've pulled — e.g., llama3.1, codestral, qwen2.5-coder |
Setup prerequisite:
# Install Ollama
brew install ollama # macOS
# or curl -fsSL https://ollama.com/install.sh | sh
# Pull a coding model
ollama pull qwen2.5-coder:32b
# Ollama serves on localhost:11434 by default
Notes:
- Performance depends entirely on your hardware. 32B+ models need a beefy GPU
- No data leaves your machine — ideal for sensitive codebases
- Ollama exposes
/v1/chat/completionsautomatically at the/v1path
Together AI / Fireworks / Groq
These providers all offer OpenAI-compatible endpoints with their own model catalogs.
Together AI:
| Setting | Value |
|---|---|
| Override OpenAI Base URL | https://api.together.xyz/v1 |
| Model names | meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo, etc. |
Fireworks:
| Setting | Value |
|---|---|
| Override OpenAI Base URL | https://api.fireworks.ai/inference/v1 |
| Model names | accounts/fireworks/models/llama-v3p1-405b-instruct, etc. |
Groq:
| Setting | Value |
|---|---|
| Override OpenAI Base URL | https://api.groq.com/openai/v1 |
| Model names | llama-3.1-70b-versatile, mixtral-8x7b-32768, etc. |
Multi-Provider Router (CodeRouter)
If you want access to models from multiple providers (OpenAI, Anthropic, Google, DeepSeek) through a single endpoint, a routing proxy is the cleanest approach.
| Setting | Value |
|---|---|
| OpenAI API Key | Your CodeRouter API key |
| Override OpenAI Base URL | https://www.coderouter.io/api/v1 |
| Model name to add | auto (phase-aware routing) or specific model IDs |
Why use a router instead of direct provider access:
- One endpoint, all models — Claude, GPT, DeepSeek, Gemini all accessible through the same override URL. No need to toggle settings when switching models
- Automatic model selection —
automode analyzes each request and routes to the best model for the task (planning → Opus, implementation → Sonnet/DeepSeek) - Cost optimization — smart routing can cut costs 50–80% while maintaining output quality
- Protocol translation — the router converts OpenAI-format requests to each provider's native API, so Anthropic models work without the 422 errors that plague direct override setups
This is particularly useful for the Cursor override because it sidesteps the biggest limitation: the override only speaks OpenAI protocol, but many top models (Claude, Gemini) use different APIs. A router bridges that gap.
Check CodeRouter's pricing for current rates — there's a free tier for trying it out.
Anthropic Models via the Override
Cursor has a dedicated Anthropic API Key field. If all you want is Claude with your own key, use that — don't use the OpenAI override.
But if you want Claude and other models through a single override endpoint, you need a translation layer. Cursor's override sends OpenAI-format requests. Anthropic's API expects a completely different schema (/v1/messages with a different body format). Sending OpenAI-shaped requests directly to https://api.anthropic.com will fail.
Your options:
- Use a router (CodeRouter, LiteLLM) that accepts OpenAI format and translates to Anthropic's API
- Run a local proxy like LiteLLM that does the same translation on your machine
- Don't mix — use the Anthropic BYOK field for Claude and the override for everything else (but be aware of the interaction bugs)
Advanced Custom Model Configuration Settings
Adjusting Model Parameters
Cursor passes standard OpenAI parameters in its requests. Depending on your endpoint, you can influence behavior through:
- Temperature — Cursor sets this per-feature (lower for code, higher for chat). Your endpoint receives whatever Cursor sends
- Max tokens — Cursor manages this internally. If your endpoint has a lower limit than what Cursor requests, you'll get truncated responses
- Streaming — Cursor uses streaming by default. Your endpoint must support
stream: trueresponses in SSE format
Managing Multiple Configurations
Cursor doesn't support multiple override URLs simultaneously. You can only have one active override at a time. If you need to switch between providers:
Option A: Switch manually — Change the URL and API key in settings when you want a different provider. Tedious but works.
Option B: Use a router — Point the override at one router endpoint and select models through the model dropdown. The router handles dispatching to different providers. This is the "set it and forget it" approach.
Option C: Use .cursor/settings.json — For per-project configuration, you can create a .cursor/settings.json file in your project root. This lets different projects use different endpoints:
{
"openai.baseUrl": "https://www.coderouter.io/api/v1",
"openai.model": "auto"
}
What the Override Doesn't Affect
Important to understand the boundaries of custom model settings in Cursor:
- Tab autocomplete — Uses Cursor's own models. Your override is ignored entirely
- Cursor-hosted models — When you use models through your Cursor subscription (not BYOK), they go through Cursor's backend
- Embedding requests — Code indexing and semantic search use Cursor's own embedding pipeline
- Some agent features — Certain Composer agent capabilities may use Cursor-hosted models regardless of your override
Only the chat/completion traffic that would normally go to OpenAI's API gets redirected.
Troubleshooting
Common Issues and Fixes
"422 Unprocessable Entity" errors
Your endpoint received a request it can't parse. Common causes:
- Sending OpenAI-format requests to a non-OpenAI-compatible endpoint
- Model name doesn't exist at the target endpoint
- Request body includes parameters the endpoint doesn't support
Fix: Double-check the URL and model name. See our detailed 422 debugging guide.
"401 Unauthorized" errors
Authentication failed. Check:
- Is the API key in the correct field (OpenAI API Key)?
- Is the key valid for the endpoint you're targeting?
- Does the endpoint require a different auth header format?
Responses are empty or truncated
- Your endpoint's max token limit may be lower than what Cursor requests
- Check if your endpoint supports streaming (
stream: true) - Some endpoints require specific model names to enable full-length responses
Override seems to have no effect
- Make sure the checkbox is actually checked (it can be toggled by other settings)
- Restart Cursor after changing the URL
- Verify you're using a BYOK model, not a Cursor subscription model — subscription models bypass the override
Claude models stopped working after setting the override
This is the most common issue. The override redirects Claude traffic through the OpenAI-format endpoint, where it fails because Anthropic uses a different API schema. See the full explanation and fix.
Verifying Traffic Flow
If you have access to your endpoint's logs, the most reliable way to debug is to check what's actually arriving:
- Make a chat request in Cursor
- Check your endpoint's request log for the incoming request
- Verify the
modelfield matches what you expect - Verify the
Authorizationheader contains your key - Check the response status code
For local setups (Ollama, LiteLLM), you can watch the terminal output in real time.
FAQ
Can I use the override with Cursor's free tier?
The override applies to BYOK (Bring Your Own Key) usage, which works on any Cursor tier including free. You provide your own API key and pay the provider directly — Cursor doesn't charge for BYOK requests.
Does the override work with Cursor's Agent/Composer mode?
Yes — Composer and the agent features use the same chat completions path. If you have the override set with a valid endpoint, agent mode will route through it. However, some internal agent capabilities may still use Cursor-hosted models for specific sub-tasks.
Can I use different models for different tasks?
Not through the override alone (it's one URL). But if you point the override at a router like CodeRouter with auto model selection, the router picks the best model per request — reasoning models for planning, faster models for implementation, cheaper models for routine edits.
Will the override work with future Cursor updates?
Cursor's override feature has been stable across updates, but the interaction with other settings (especially Anthropic BYOK) has had bugs. After any Cursor update, it's worth verifying your setup still works as expected. Check the Cursor changelog and the Cursor forum for known issues.
How is this different from the Anthropic/Google Base URL override?
Cursor also has override fields for Anthropic and Google base URLs. These work similarly but use the respective provider's native API format. The OpenAI base URL override is the most versatile because the OpenAI chat completions protocol has become the industry standard — virtually every alternative provider and proxy supports it.
Can I use this for compliance / request logging?
Yes — this is one of the strongest use cases. Point the override at a logging proxy that records every request/response, then forwards to the actual provider. You get a full audit trail of all LLM interactions from Cursor. Just make sure your proxy supports streaming responses.
What's the difference between this guide and the troubleshooting article?
This guide covers how to set up the override from scratch — the happy path. Our companion article covers what goes wrong — the specific failure modes when the override interacts with Anthropic BYOK keys, the 422 errors, and the auto-toggle bug.
Summary
Setting up Cursor's Override OpenAI Base URL is straightforward once you understand the model:
- Enter your API key in the OpenAI key field
- Enable the override and set your endpoint URL (with
/v1path, without/chat/completions) - Add model names that your endpoint recognizes
- Verify with the button, then test with an actual chat message
- Avoid mixing the override with Anthropic BYOK keys unless you're using a router that handles the protocol translation
For the simplest multi-provider setup, point the override at a router like CodeRouter that translates between protocols automatically — one endpoint, one key, all models, no 422s.
Related: Cursor "Override OpenAI Base URL" Breaks Claude — What Works and What Doesn't · Cut Your Cursor Bill 83% in 12 Hours