How to fix the 404 not found error when using API

Shuaishuai Li 0 Reputation points
2024-07-17T15:18:14.34+00:00

Hi, I want to use Azure OpenAI API in the plug-in "ZoteroGPT" in Zotero. When I added Open AI API directly, it ran successfully. When I wanted to add Azure OpenAI API, it can not run with the same error (I will mention later). So I want to transfer Azure API to OpenAI API by a note provided by the author in https://github.com/diemus/azure-openai-proxy/blob/main/README.md

But when I ran the code in the cmd, it faced the error. And then I changed the URL by the Q&A in Azure but it showed the same error.

C:\Users\angku>curl https://angkulcus.openai.azure.com/v1/chat/completions  -H "Content-Type: application/json"  -H "Authorization: Bearer c7d28e16f********b5619b15d60c"  -d '{ "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}] }'
{"error":{"code":"404","message": "Resource not found"}}curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) URL rejected: Bad hostname
curl: (3) URL rejected: Port number was not a decimal number between 0 and 65535
curl: (3) bad range specification in URL position 2:
[{role:
 ^

C:\Users\angku>curl https://angkulcus.openai.azure.com/openai/deployments/angkuLC4o/completions?api-version=2024-05-13 ^
More?   -H "Content-Type: application/json" ^
More?   -H "Authorization: Bearer c7d28e16f************b5619b15d60c" ^
More?   -d "{ \"model\": \"gpt-4o\", \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}] }"
{"error":{"code":"404","message": "Resource not found"}}

I used Windows 11 on my computer. The API has been modified to be public.

Thanks!

Shuaishuai

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,609 questions
{count} votes

Accepted answer
  1. navba-MSFT 20,530 Reputation points Microsoft Employee
    2024-07-19T14:17:15.83+00:00

    @Shuaishuai Li Yes, if the curl command works, there is no issue with Azure Open AI.

    The URL should look like below:
    https://angkulcus.openai.azure.com/openai/deployments/angkuLC4o/chat/completions?api-version=2024-06-01

    .

    .

    If the plugin is adding (appending) v1/chat/completions then the URL looks like below and it will throw a 404 error:

    https://angkulcus.openai.azure.com/openai/deployments/angkuLC4o/chat/completions?api-version=2024-06-01/v1/chat/completions

    .

    This needs to be looked by the plugin. It shouldn't append the v1/chat/completions to the URL. Please report this issue with plugin team.

    You found this answer helpful.

0 additional answers

Sort by: Most helpful