Azure openai 401 access denied invalid key or api endpoint

Sergio Solorzano 26 Reputation points
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><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.
1,442 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 49,501 Reputation points

    Hi Sergio,

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

    (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:

    If this is helpful please accept answer.

    0 comments No comments