I tried two separate ways to configure Cursor to point to an alternative OpenAI compliant API endpoint by modifying the “OpenAI API Key > Override OpenAI Base URL” section of the Cursor settings.
My first attempt was with Deepseek, using learnings from wiring that up to llm
.
I got to the point where Cursor failed to validate the API endpoint (don’t forget to save the url override), but the curl
command it output for me to check manually worked if I switched the model to deepseek-chat
.
curl https://api.deepseek.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer <token>" -d '{
"messages": [
{
"role": "system",
"content": "You are a test assistant."
},
{
"role": "user",
"content": "Testing. Just say hi and nothing else."
}
],
"model": "deepseek-chat"
}'
{"id":"c86ef579-61b8-4941-b2be-185385fe690c","object":"chat.completion","created":1735786101,"model":"deepseek-chat","choices":[{"index":0,"message":{"role":"assistant","content":"Hi."},"logprobs":null,"finish_reason":"stop"}],"usage":{"prompt_tokens":18,"completion_tokens":2,"total_tokens":20,"prompt_cache_hit_tokens":0,"prompt_cache_miss_tokens":18},"system_fingerprint":"fp_f1afce2943"}%
Despite all this working, when I tried chatting with the deepseek-chat
model in Cursor, I got this error
{"error":{"message":"Authentication Fails (no such user)","type":"authentication_error","param":null,"code":"invalid_request_error"}}
Next, I tried OpenRouter with a similar approach using the base url https://openrouter.ai/api/v1
.
Cursor was able to validate the endpoint and I could chat with openai/gpt-4o-mini
in the chat without issue.
Since I didn’t have credits loaded up to use other OpenRouter models, I did get a “Connection Failed” error from the Cursor chat.
Switching to openai/gpt-4o-mini
, which OpenRouter provides some free tokens for, fixed this issue.
Deepseek V3 (deepseek-chat
) is available through OpenRouter, but it would be nice to understand what is going wrong with my Cursor config here.
OpenRouter also provides some deepseek/deepseek-chat
tokens for free, so in the end I was able to run DeepSeek V3 in Cursor, which has been the main driver behind much of these efforts.