Send Request to Azure OpenAI via Postman directly

Tom Wong 20 Reputation points
2024-09-28T00:21:28.5933333+00:00

I'm trying to use ChatGPT through Azure OpenAI but keep encountering an 'access denied' error.

Here's what I've done so far: I added the POST URL, included the 'API_KEY' (taken from the Azure portal), and attached the JSON body, but it's not working. The key should be correct. Could anyone share a working example of an API URL that functions properly?

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

Accepted answer
  1. Daniel FANG 545 Reputation points
    2024-09-28T00:39:13.0666667+00:00

    Here is an example of calling Auzre OpenAI via postman directly (without any libraries).
    User's image

    Curl payload below:

    curl --location 'https://{your instance}.openai.azure.com/openai/deployments/{deployment}/chat/completions?api-version=2023-03-15-preview' \
    --header 'api-key: {apikey}' \
    --header 'Content-Type: application/json' \
    --data '{
       "messages": [
       {
          "role": "user",
          "content": "how are you today?"
        }
      ],
      "temperature": 0.7,
      "top_p": 0.95,
      "frequency_penalty": 0,
      "presence_penalty": 0,
      "max_tokens": 800,
      "stop": null
    }'
    
    
    

    To find all the endpoint and key details, you can go to the deployments tab in Azure OpenAI Studio
    User's image

    0 comments No comments

0 additional answers

Sort by: Most helpful

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.