Prerequisites
Before you begin, ensure you have:- Node.js 18 or higher installed
- An OpenAI API account with access to DALL-E 3
- An Azure account (free tier works for testing)
- Git installed on your machine
Step 1: Get your API keys
VisionaryAI requires API keys from OpenAI and Azure credentials.Get OpenAI credentials
Navigate to platform.openai.com and sign in to your account.
- Go to API Keys in your account settings
- Click Create new secret key and save it securely
- Note your organization ID from the Settings page
Set up Azure Storage
Log in to the Azure Portal and create a storage account:
- Navigate to Storage Accounts and click Create
- Choose a resource group (create one if needed)
- Enter a unique storage account name
- Select your region and performance tier
- After creation, go to Access Keys and copy your account name and key
Azure’s free tier includes 5GB of blob storage, which is sufficient for testing VisionaryAI with dozens of images.
Step 2: Clone and configure the project
Clone the VisionaryAI repository and set up your environment:You can use npm, yarn, or pnpm as your package manager. The project supports all three.
Step 3: Configure environment variables
Create environment files for both the Next.js app and Azure Functions.Step 4: Create Azure Blob container
VisionaryAI stores generated images in Azure Blob Storage:Create a container
In the Azure Portal, navigate to your storage account and select Containers from the left menu.
Add the images container
Click + Container and name it
images. Set the public access level to Private.Step 5: Start the development servers
Run both the Azure Functions and Next.js development servers simultaneously.Start Azure Functions
Open a terminal and navigate to the The Azure Functions will start on
azure directory:http://localhost:7071. You should see output confirming that all four functions are loaded:generateImagegetImagesgetChatGPTSuggestiongenerateSASToken
Step 6: Generate your first image
Now you’re ready to create AI-generated artwork!Open the application
Navigate to
http://localhost:3000 in your browser. You’ll see the VisionaryAI interface with a prompt input area.Get a suggestion
Click New suggestion to have ChatGPT generate a creative prompt for you:ChatGPT will provide a detailed prompt including artistic style, genre, and details.
Use the suggestion or create your own
You can either click Use suggestion to generate an image from ChatGPT’s prompt, or type your own custom prompt in the text area.Example prompts:
- “A serene watercolor painting of a Japanese garden at sunset”
- “Photo-realistic portrait of a cyberpunk warrior in neon city, 4K”
- “Abstract oil painting with bold geometric shapes in vibrant colors”
Generate the image
Click Generate to start the image creation process:A toast notification will appear showing the generation progress. DALL-E 3 typically takes 10-30 seconds to generate an image.
Understanding the image flow
Here’s what happens when you generate an image:Frontend submission
The
PromptInput component sends your prompt to the Next.js API route at /api/generateImage.Azure Functions processing
The API route forwards the request to the Azure Function
generateImage, which:- Calls the OpenAI API with DALL-E 3
- Downloads the generated image from OpenAI’s temporary URL
- Uploads it to Azure Blob Storage with a timestamped filename
Next steps
Now that you’ve generated your first image, explore more features:Installation guide
Deploy VisionaryAI to production with detailed setup instructions
Customize prompts
Modify the ChatGPT suggestion prompt in
azure/src/functions/getChatGPTSuggestion.js to generate different stylesAdjust image settings
Change image size or count by modifying the DALL-E 3 parameters in
azure/src/functions/generateImage.jsAdd features
Extend VisionaryAI with image variations, inpainting, or custom image metadata
Troubleshooting
Error: OpenAI API rate limit exceeded
Error: OpenAI API rate limit exceeded
DALL-E 3 has rate limits based on your OpenAI account tier. If you hit the limit:
- Wait a few minutes before generating more images
- Check your rate limits at platform.openai.com/account/rate-limits
- Consider upgrading your OpenAI account tier for higher limits
Error: Azure Functions not connecting
Error: Azure Functions not connecting
If the Next.js app can’t reach Azure Functions:
- Verify Azure Functions are running on
http://localhost:7071 - Check that
local.settings.jsonhas correct environment variables - Ensure your firewall isn’t blocking port 7071
- Look for error messages in the Azure Functions terminal output
Images not appearing in gallery
Images not appearing in gallery
If images generate but don’t show:
- Verify the
imagescontainer exists in your Azure Storage account - Check that
accountNameandaccountKeyare correct inlocal.settings.json - Click the Refresh Images button to manually trigger a gallery update
- Check browser console for SWR or fetch errors
ChatGPT suggestions not loading
ChatGPT suggestions not loading
If the suggestion feature doesn’t work:
- Verify your OpenAI API key has access to
gpt-3.5-turbo-instruct - Check the Azure Functions logs for API errors
- Try clicking New suggestion again after a few seconds
- Ensure you’re not hitting OpenAI rate limits