Create and edit high-quality image content with GPT-Image-2 and FLUX Kontext Pro on Azure AI Foundry.
- Generate polished image assets from text prompts, input images, or both
- GPT-Image-2: Default OpenAI image model for generation and high-fidelity editing
- FLUX Kontext Pro: Black Forest Labs model for fast, high-fidelity image generation
- Refine prompts using AI best practices to ensure high-impact visuals
- Analyze outputs with AI for quality control, metadata tagging, and asset optimization
- Guardrails for content showing brand products (brand protection)
- Durable, cancellable image batches with per-image progress and partial-result retry
- Generate several batches concurrently while continuing to compose new prompts
- Build a persistent 2–10 frame campaign from text, one image, or several durable references
- Generate one shared creative direction with ordered frame purposes, prompts, and editable copy
- Start immediately or review, edit, add, remove, and reorder the plan before generation
- Compare the same frozen plan across every configured image model in ordered lanes
- Reuse stable visual anchors for continuity instead of chaining drift from frame to frame
- Track progressive completion, cancel an active storyline, retry an exact failed frame, or regenerate a frame with revised prompt and copy
- Use channel-aware copy depth and size suggestions without locking the image dimensions
- Manage your content in an organized asset library with folder support
- Automatic image analysis and metadata tagging
You can also get started with our notebooks to explore the models and APIs:
- Image generation and editing: gpt-image-2.ipynb
Visionary Lab uses Azure AI Foundry as a single unified AI resource with all model deployments, and managed identity for all service connections (no API keys).
| Component | Service | Auth |
|---|---|---|
| AI Models | Azure AI Foundry (AIServices) | Managed Identity |
| Image Storage | Azure Blob Storage | Managed Identity |
| Image Job Dispatch | Azure Storage Queue | Managed Identity |
| Image Workers | Azure Container Apps (scale to zero) | Managed Identity |
| Metadata | Azure Cosmos DB | Managed Identity |
| Hosting | Azure Container Apps | SystemAssigned MI |
GPT-Image-2 is now the supported OpenAI image model for both generation and editing. The previous GPT-Image-1, GPT-Image-1.5, and GPT-Image-1-Mini deployments are no longer supported by this application.
| Deployment | Model | Purpose |
|---|---|---|
gpt-4o |
GPT-4o | LLM for prompt enhancement, analysis, and storyline planning |
gpt-image-2 |
GPT-Image-2 | Default image generation and editing |
flux-kontext-pro |
FLUX.1-Kontext-pro | Alternative image generation |
Azure deployment resources:
- Azure AI Foundry resource with deployed models (see table above)
- Azure Storage Account with a Blob container for images and an image-generation job queue
- Azure Cosmos DB account
Compute environment:
- Python 3.13+
- Node.js 22+ and npm
- Git
- uv package manager
- Azure CLI (
az loginrequired for local development) - Docker (used by
scripts/dev.shfor the local Azurite Blob emulator)
Wait for the Codespace to initialize, then continue with Step 2: Configure Resources.
git clone https://github.com/Azure-Samples/visionary-labMac/Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"cp .env.example .envcd frontend
npm ci --registry=https://packagefeedproxy.microsoft.io/npm/-
Login to Azure (required for managed identity authentication):
az login
-
Configure environment variables in
.env:code .env
Setting Description AI_FOUNDRY_ENDPOINTYour AI Foundry endpoint (e.g., https://your-foundry.cognitiveservices.azure.com/)LLM_DEPLOYMENTLLM deployment name (e.g., gpt-4o)IMAGEGEN_2_DEPLOYMENTGPT-Image-2 deployment name (normally gpt-image-2)FLUX_KONTEXT_DEPLOYMENTFLUX model deployment (e.g., flux-kontext-pro)AZURE_STORAGE_CONNECTION_STRINGUseDevelopmentStorage=truefor the local Azurite Blob emulator; leave empty in AzureAZURE_BLOB_SERVICE_URLBlob Storage URL AZURE_STORAGE_ACCOUNT_NAMEStorage account name AZURE_STORAGE_QUEUE_URLStorage Queue service URL AZURE_STORAGE_QUEUE_NAMEDurable image job queue AZURE_STORAGE_POISON_QUEUE_NAMETerminal-failure diagnostics queue AZURE_COSMOS_DB_ENDPOINTCosmos DB endpoint URL No Azure service API keys are needed.
DefaultAzureCredentialuses youraz loginsession for AI Foundry during host development and managed identity in Azure. The Azurite shortcut uses only the emulator's well-known local credentials.Local development defaults to
IMAGE_JOB_MODE=memory. Set it toazureonly when the configured Queue and Cosmos endpoints are reachable from your machine. WithAZURE_STORAGE_CONNECTION_STRING=UseDevelopmentStorage=true,scripts/dev.shstarts a named Azurite Blob container and the backend creates theimagescontainer on first use.
-
Start the local stack:
./scripts/dev.sh
The backend runs on http://localhost:8000 and the frontend on http://localhost:3000. Local mode runs the API and queue consumers in one process; Azure deploys them independently. If the development storage shortcut is configured, the script reuses an already-running
visionary-lab-azuritecontainer or starts and stops one with the stack. -
To run either side independently:
UV_CACHE_DIR=.uv-cache uv run fastapi dev backend/main.py --port 8000 cd frontend && npm run dev
The frontend will be available at http://localhost:3000.
For GPT-Image-2 generation/editing tests that do not persist assets, use
./scripts/dev.sh --backend; Blob, Queue, and Cosmos configuration is not required for that backend-only path.
For production deployment, use Azure Developer CLI:
Prerequisites: Azure Developer CLI (azd)
git clone https://github.com/Azure-Samples/visionary-lab
cd visionary-lab
azd auth login
azd upDuring azd up, you'll be prompted for a globally unique AI Foundry name. The
template deploys the fixed application model set: gpt-4o, gpt-image-2, and
flux-kontext-pro.
✨ That's it! Your Visionary Lab will be running on Azure Container Apps with:
- Azure AI Foundry with all model deployments
- Managed identity for all service connections (no API keys)
- Azure Storage and Cosmos DB for content management
- A private FastAPI API app plus a no-ingress, queue-scaled image worker app
- RBAC role assignments auto-configured
- Optional Entra ID authentication (configurable per deployment)
📖 For detailed deployment instructions, see DEPLOYMENT.md