Error "No scheme supplied" using generated code from DALL-E playground

emonzies 0 Reputation points
2023-07-11T09:53:03.3466667+00:00

I copied the Python code from DALL-E just to test the API to generate one image. And I got that error: "raise error.APIConnectionError(

openai.error.APIConnectionError: Error communicating with OpenAI: Invalid URL '<your_openai_endpoint>/images/generations': No scheme supplied. Perhaps you meant https://<your_openai_endpoint>/images/generations?"

Following is the code all set with out parameters, we have re-entered the form to get access to DALL-E and got confirmation.

#Note: The openai-python library support for Azure OpenAI is in preview.
import os
import openai
openai.api_type = "azure"
openai.api_base = "https://xxxx.openai.azure.com/" #xxxx replaced by the real endpoint
openai.api_version = "2023-06-01-preview"
openai.api_key = os.getenv("OPENAI_API_KEY")

response = openai.Image.create(
    prompt='USER_PROMPT_GOES_HERE',
    size='1024x1024',
    n=1
)

image_url = response["data"][0]["url"]
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,644 questions
{count} votes