Azure OpenAI DALL-E - Generate Images using Postman

Posted by Bernard Lim on March 23, 2024

Here is a simple guide on how to generate images using Azure OpenAI DALL-E via Postman.

Before starting off, I am assuming you will already have a Azure OpenAI subscription that is ready to be used.


Azure OpenAI Studio

  1. Go to Azure OpenAI Studio : https://oai.azure.com/
  2. Click on DALL-E under the Playground section

    DALL-E

  3. Click on ‘View Code’ DALL-E-2

  4. Select ‘json’ from the dropdown, and copy the OAI API Key (hidden text). DALL-E-3

Postman

  1. Create a new POST Request with the following values:

    • Query Params api-version : 2023-06-01-preview
    • Request Headers

      api-key : {Paste the OAI API Key copied previously)

    • Body

      Paste this JSON as the Request Body and edit as needed:

      1
      2
      3
      4
      5
      
      {
        "prompt": {Add Your Image Prompt here},
        "n": 1,
        "size": "1024x1024"
      }
      
  2. On response, you might get a "status": "notRunning" as response. This is normal. DALL-E-6

  3. Open the Response Headers tab and copy the URL from operation-location header

    DALL-E-4

  4. Make another request, this time a GET (instead of a POST) request with the URL copied from Step 3.
  5. Response returned should return the generated image URL DALL-E-5

More references on generating images using Azure OpenAI DALL-E:

  • https://learn.microsoft.com/en-us/training/modules/generate-images-azure-openai/4-dall-e-rest-api