Skip to content

Instantly share code, notes, and snippets.

@marzme
marzme / Example Random Image Creator.ps1
Last active November 21, 2023 22:14
Random Image Creator using OpenAI API
# Define the relevant variables
$APIKey = "<YOUR API KEY HERE>"
$DownloadsPath = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
$ChatAPIUrl = "https://api.openAI.com/v1/chat/completions"
$ChatAPIModel = "gpt-3.5-turbo-16k"
$ImageAPIUrl = "https://api.openai.com/v1/images/generations"
$ImageAPIModel = "dall-e-3"