# Failed verification of OpenAI API key on custom API endpoint

**URL:** <https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371>\
**Category:** Bug Reports\
**Created:** [December 9, 2024, 4:12am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371 "2024-12-09T04:12:48Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![changh95](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/changh95/32/15108_2.png) [@changh95](https://forum.cursor.com/u/changh95)\
**Post date:** [December 9, 2024, 4:12am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/1 "2024-12-09T04:12:48Z")

</div>

I’m working on a project where privacy is top priority, so I’m trying to use a private LLM service instead of OpenAI and Claude.

I tried to override the OpenAI base url, and added my OpenAI API key here.

But I keep get ‘(status code 0) TypeError: Failed to fetch’ error, when I verify the API key.

Strangely, when I run the curl script to call the API, I get the results back very nicely. It’s just cursor that cannot get the API return for some reason.

Can this be fixed?

 ![image](https://us1.discourse-cdn.com/cursor1/original/2X/f/f4e174dfcf0d1df7c8610f2cd62e3f194b2b0daa.png)

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [December 9, 2024, 9:46am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/2 "2024-12-09T09:46:48Z")

</div>

Which service are you trying to connect?

---

<div class="post-metadata">

**Author:** ![changh95](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/changh95/32/15108_2.png) [@changh95](https://forum.cursor.com/u/changh95)\
**Post date:** [December 10, 2024, 5:04am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/3 "2024-12-10T05:04:29Z")

</div>

It’s public endpoint made by ngrok, pointing to ollama.

---

<div class="post-metadata">

**Author:** ![choki-lin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/choki-lin/32/22896_2.png) [@choki-lin](https://forum.cursor.com/u/choki-lin)\
**Post date:** [January 28, 2025, 9:37pm UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/4 "2025-01-28T21:37:32Z")

</div>

Hi,

Did you find a solution to this problem?

Thanks!

---

<div class="post-metadata">

**Author:** ![danperks](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/danperks/32/19087_2.png) [@danperks](https://forum.cursor.com/u/danperks)\
**Post date:** [January 30, 2025, 1:50pm UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/5 "2025-01-30T13:50:45Z")

</div>

Hey, what error are you getting?

---

<div class="post-metadata">

**Author:** ![choki-lin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/choki-lin/32/22896_2.png) [@choki-lin](https://forum.cursor.com/u/choki-lin)\
**Post date:** [January 30, 2025, 7:53pm UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/6 "2025-01-30T19:53:27Z")

</div>

**Hi Dan, thanks for replying.**

These are the parameters I replaced in the OpenAI API Key configuration:

• **Model:** ollama

• **URL:** https://-----.ngrok-free.app/v1

However, I get the following error:

(status code 0)  
TypeError: Failed to fetch

url https://--------.ngrok-free.app/v1/chat/completions -H “Content-Type: application/json” -H “Authorization: Bearer ollama” -d ‘{  
“messages”: [  
{  
“role”: “system”,  
“content”: “You are a test assistant.”  
},  
{  
“role”: “user”,  
“content”: “Testing. Just say hi and nothing else.”  
}  
],  
“model”: “deepseek-r1:1.5b”  
}’

When I check the **ngrok logs** , I see this response:

## HTTP Requests

16:45:20.677 -04 OPTIONS /v1/chat/completions 403 Forbidden

However, when I run the request **via cURL in the CLI** , it works perfectly:

{“id”:“chatcmpl-91”,“object”:“chat.completion”,“created”:1738266602,“model”:“deepseek-r1:1.5b”,“system\_fingerprint”:“fp\_ollama”,“choices”:[{“index”:0,“message”:{“role”:“assistant”,“content”:“\u003cthink\u003e\nAlright, the user wants me to test how they’re interacting with my chat interface.\n\nI should wait for their input before I respond.\n\nMaybe after a few sentences, they can just confirm whether I’m ready or not.\n\nThis way, it keeps the conversation flowing smoothly without any abrupt stops.\n\u003c/think\u003e\n\nGreat! Just tell me anything. I’ll be happy to assist you or talk about something else with you.”},“finish\_reason”:“stop”}],“usage”:{“prompt\_tokens”:18,“completion\_tokens”:85,“total\_tokens”:103}}

It seems like the issue might be related to how the request is being handled by ngrok.

Any ideas on what could be causing this?

---

<div class="post-metadata">

**Author:** ![choki-lin](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/choki-lin/32/22896_2.png) [@choki-lin](https://forum.cursor.com/u/choki-lin)\
**Post date:** [January 30, 2025, 7:58pm UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/7 "2025-01-30T19:58:19Z")

</div>

**Good news!** After today’s update, I still see the error when trying to verify it, **but** I can now use the model locally!

Thanks anyway for your help!

---

<div class="post-metadata">

**Author:** ![AnxietyYoungPoet](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/anxietyyoungpoet/32/24135_2.png) [@AnxietyYoungPoet](https://forum.cursor.com/u/AnxietyYoungPoet)\
**Post date:** [February 4, 2025, 4:26am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/8 "2025-02-04T04:26:51Z")

</div>

exactly the same issue. What’s the version of your cursor now?

---

<div class="post-metadata">

**Author:** ![AnxietyYoungPoet](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/anxietyyoungpoet/32/24135_2.png) [@AnxietyYoungPoet](https://forum.cursor.com/u/AnxietyYoungPoet)\
**Post date:** [February 4, 2025, 4:32am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/9 "2025-02-04T04:32:04Z")

</div>

Hey, the same issue here. I got error message from lm studio server log, which uses the llama.cpp to deploy my local model. The error showed " 2025-02-04 12:29:41 [DEBUG]

Received request: OPTIONS to /v1/chat/completions

2025-02-04 12:29:41 [ERROR]

‘messages’ field is required" when I tried to verify the model

---

<div class="post-metadata">

**Author:** ![AnxietyYoungPoet](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/anxietyyoungpoet/32/24135_2.png) [@AnxietyYoungPoet](https://forum.cursor.com/u/AnxietyYoungPoet)\
**Post date:** [February 4, 2025, 4:33am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/10 "2025-02-04T04:33:08Z")

</div>

And the same, it works perfectly when I run curl via CLI

---

<div class="post-metadata">

**Author:** ![Jafo232](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jafo232/32/24866_2.png) [@Jafo232](https://forum.cursor.com/u/Jafo232)\
**Post date:** [February 7, 2025, 3:03am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/11 "2025-02-07T03:03:29Z")

</div>

I have the same issue here.

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/e/0/e0208b52ccb6d3a90d968911be78deb3ccb31b2e.png)

---

<div class="post-metadata">

**Author:** ![DolphinQiao](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/dolphinqiao/32/25966_2.png) [@DolphinQiao](https://forum.cursor.com/u/DolphinQiao)\
**Post date:** [February 11, 2025, 2:14pm UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/12 "2025-02-11T14:14:43Z")

</div>

Same issue

---

<div class="post-metadata">

**Author:** ![Ezio](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ezio/32/27368_2.png) [@Ezio](https://forum.cursor.com/u/Ezio)\
**Post date:** [February 18, 2025, 9:20am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/13 "2025-02-18T09:20:43Z")

</div>

Same issue here

 ![image](https://us1.discourse-cdn.com/cursor1/original/3X/0/d/0d44827f95b6a19bec283dcaf78323a0bfd414a2.png)

---

<div class="post-metadata">

**Author:** ![danperks](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/danperks/32/19087_2.png) [@danperks](https://forum.cursor.com/u/danperks)\
**Post date:** [February 26, 2025, 1:47am UTC](https://forum.cursor.com/t/failed-verification-of-openai-api-key-on-custom-api-endpoint/33371/14 "2025-02-26T01:47:08Z")

</div>

Unlisted on February 26, 2025, 1:47am UTC


