Azure openai 401 access denied invalid key or api endpoint

Sergio Solorzano 26 Reputation points
2023-11-19T08:08:35.7066667+00:00
I can run requests from Azure studio for gpt-35-turbo in western Europe zone. However any other way - postman, curl, python code, powershell - fails. Python code that run 48 hours ago now fails. The Azure status pages says all ok.

I can't go much wrong to test this because it's a copy paste from Studio, replacing the api key only. However I still checked and looked fine.

curl "https://<MYBASE>.openai.azure.com/openai/deployments/<DEPLOYMENT>/chat/completions?api-version=2023-07-01-preview" \
  -H "Content-Type: application/json" \
  -H "api-key: YOUR_API_KEY" \
  -d "{
  \"messages\": [{\"role\":\"system\",\"content\":\"You are an AI assistant that helps people find information.\"}],
  \"max_tokens\": 800,
  \"temperature\": 0.7,
  \"frequency_penalty\": 0,
  \"presence_penalty\": 0,
  \"top_p\": 0.95,
  \"stop\": null
}"


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

1 answer

Sort by: Most helpful
  1. Dillon Silzer 57,471 Reputation points
    2023-11-19T19:33:08.8466667+00:00

    Hi Sergio,

    As an example of POSTMAN, try looking at this similar thread:

    https://stackoverflow.com/questions/75803756/how-to-send-chatgpt-request-by-postman-to-azure-openai

    (see Joe Gurria Celimendiz's response).

    Just a note, perhaps your headers are incorrect or the formatting. Considering I can't see your POSTMAN setup, this could be the case.

    If you are still having issues, I'd recommend opening a ticket with Azure Support:

    https://azure.microsoft.com/en-ca/support/create-ticket


    If this is helpful please accept answer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.