# Url \`'https://api.openai.com/v1/completions' does not exist

**URL:** <https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073>\
**Category:** API\
**Created:** [July 5, 2023, 10:59am UTC](https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073 "2023-07-05T10:59:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![studioinfamy](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/studioinfamy/32/165289_2.png) [@studioinfamy](https://community.openai.com/u/studioinfamy)\
**Post date:** [July 5, 2023, 10:59am UTC](https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073/1 "2023-07-05T10:59:38Z")

</div>

Getting this error when utilizing a library for completions, this URL is correct according to the docs so what is going on?

![image](https://us1.discourse-cdn.com/openai1/original/3X/7/3/73f61a632ec85e41f6480928ce74374a93685002.png)

---

<div class="post-metadata">

**Author:** ![Foxalabs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foxalabs/32/738355_2.png) [@Foxalabs](https://community.openai.com/u/Foxalabs)\
**Post date:** [July 5, 2023, 11:54am UTC](https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073/2 "2023-07-05T11:54:32Z")

</div>

Welcome to the forum!

I think you might be trying to use ChatCompletions API calls with Completions enpoints, can you post your API calling code please.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [July 5, 2023, 1:54pm UTC](https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073/3 "2023-07-05T13:54:32Z")

</div>

The URL does exist and responds.

It seems the error message includes two single-quotes - have you manually specified the URL in a way that is different than the module needs or uses by default?

Were one using the wrong endpoint for the model, you’d instead get a return message like: _“OpenAI API request was invalid: This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?”_ when you have proper error handling, such as a case “ **except openai.error.InvalidRequestError as e:** ” for the openai python library.

---

<div class="post-metadata">

**Author:** ![ah0818lijhong](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ah0818lijhong/32/344817_2.png) [@ah0818lijhong](https://community.openai.com/u/ah0818lijhong)\
**Post date:** [April 5, 2024, 9:07am UTC](https://community.openai.com/t/url-https-api-openai-com-v1-completions-does-not-exist/288073/4 "2024-04-05T09:07:33Z")

</div>

dear, my code is  
def text\_generaton\_with\_black\_box\_LLMs(prompt,tem):  
res=openai.ChatCompletion.create(model=‘gpt-3.5-turbo’,  
messages=[  
{‘role’: ‘user’, ‘content’: prompt}],  
max\_tokens=150,  
temperature=tem,  
)  
return res  
and I got the error: Traceback (most recent call last):  
File “main.py”, line 52, in   
response = text\_generaton\_with\_black\_box\_LLMs(prompt,0.5)  
File “main.py”, line 8, in text\_generaton\_with\_black\_box\_LLMs  
res=openai.ChatCompletion.create(model=‘gpt-3.5-turbo’,  
File “/root/miniconda3/lib/python3.8/site-packages/openai/api\_resources/chat\_completion.py”, line 25, in create  
return super().create(\*args, \*\*kwargs)  
File “/root/miniconda3/lib/python3.8/site-packages/openai/api\_resources/abstract/engine\_api\_resource.py”, line 153, in create  
response, \_, api\_key = requestor.request(  
File “/root/miniconda3/lib/python3.8/site-packages/openai/api\_requestor.py”, line 220, in request  
result = self.request\_raw(  
File “/root/miniconda3/lib/python3.8/site-packages/openai/api\_requestor.py”, line 533, in request\_raw  
raise error.APIConnectionError(  
openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool (host=‘api \dot openai \dot com’, port=443): Max retries exceeded with url: /v1/chat/completions (Caused by ProxyError(‘Cannot connect to proxy.’, NewConnectionError(‘\<urllib3.connection.HTTPSConnection object at 0x7f5edde688b0\>: Failed to establish a new connection: [Errno 111] Connection refused’)))  
can you give me some ideas to solve it? 😂
