Why I'm getting 404 Resource Not Found to my newly Azure OpenAI deployment?
Asked Answered
W

3

14

I've gone through this quickstart and I created my Azure OpenAI resource + created a model deployment which is in state succeedded. I also playaround it in https://oai.azure.com/ and it works there.

But, If I try to reach it from REST API is returns 404 Resource Not Found. I defined the api-key header, and took the url and json from Code View -> json from inside the playground.

I'm executing

POST https://raz-openai.openai.azure.com/openai/deployments/raz-model-2/completions?api-version=2022-12-01 { "prompt": "", "max_tokens": 100 } with api-key header

Am I missing another step?

Wyck answered 19/1, 2023 at 12:19 Comment(4)
At this time openai is only for questions about OpenAI API. Ref. Disambiguate [chatgpt] and [openai]. As Azure OpenAI is part of Azure Cognitive Services, it looks to be fair to use azure-cognitive-services instead.Reynalda
This eventually worked, I think I issue GET and not POST actually.Wyck
@RazRonen if the above solution worked for you, post it as an answer so that it will help other community members.Homans
Can you post you request code? Maybe remove "max_tokens" and use the default value.Inexpert
O
0

Adding as an answer use a GET request instead of POST.

Openminded answered 2/2, 2023 at 7:59 Comment(0)
L
12

I was also getting a 404 calling the Chat Completions API (https://{resource}.openai.azure.com/openai/deployments/{deployment}/chat/completions) and it turned out that I was using the wrong version. Each model has one or more versions that can be found at Azure OpenAI Service REST API reference.

For me, hitting the chat completions (ChatGPT), the correct URL with version was:

https://{resource}.openai.azure.com/openai/deployments/{deployment}/chat/completions?api-version=2023-03-15-preview

Any other version will give a 404 Resource Not Found.

Also, here are the definitions of those variables:

  • Resource: Take from the Azure endpoint URL, which can be found on the Overview page in your OpenAI Services resource. The format should be something like https://{resource}.openai.azure.com/
  • Deployment (aka deployment-id): You can find this in the Azure portal under the Model Deployments section. Each model has a "Model Deployment Name" and this is your Deployment ID. This isn't going to be the OpenAI name (like gpt-35-turbo) but rather the name you gave it when creating the model deployment.
Lightheaded answered 19/4, 2023 at 20:6 Comment(0)
O
0

Adding as an answer use a GET request instead of POST.

Openminded answered 2/2, 2023 at 7:59 Comment(0)
L
0

Use the Chrome web traffic (under Network) from the Azure OpenAI studio. It works better than the official docs and the Azure OpenAI Studio UI-generated code.

Lianeliang answered 22/2 at 19:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.