diff --git a/examples/picture.py b/examples/picture.py new file mode 100644 index 0000000000..7bf22aa790 --- /dev/null +++ b/examples/picture.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +from openai import OpenAI + +# gets OPENAI_API_KEY from your environment variables +openai = OpenAI() + +prompt = "An astronaut lounging in a tropical resort in space, pixel art" +model = "dall-e-3" + +def main() -> None: + # Generate an image based on the prompt + response = openai.images.generate(prompt=prompt, model=model) + + # Prints response containing a URL link to image + print(response) + +if __name__ == "__main__": + main()