Overview
AzureImageGenServiceREST provides image generation capabilities using Azure’s OpenAI service via REST API. It supports asynchronous image generation with automatic polling for completion and image downloading.
Azure Image Gen API Reference
Pipecat’s API methods for Azure OpenAI image generation integration
Azure OpenAI Documentation
Official Azure OpenAI DALL-E documentation and guides
Installation
To use Azure OpenAI image generation services, install the required dependencies:Prerequisites
Azure Account Setup
Before using Azure OpenAI image generation services, you need:- Azure Account: Sign up at Azure Portal
- Azure OpenAI Resource: Create an Azure OpenAI resource
- API Key: Get your API key from the Azure OpenAI resource
- Endpoint: Note your resource endpoint URL
- HTTP Session: Configure aiohttp session for image downloading
Required Environment Variables
AZURE_DALLE_API_KEY: Your Azure OpenAI API key for authenticationAZURE_DALLE_ENDPOINT: Your Azure OpenAI endpoint URL
Configuration
Azure OpenAI endpoint URL, including the trailing slash (for example,
https://my-resource.openai.azure.com/).HTTP session for API requests and downloading generated images. You must
create and manage this yourself.
Target size for generated images (e.g.,
"1024x1024"). Deprecated in
v0.0.105. Use settings=AzureImageGenServiceREST.Settings(image_size=...)
instead.Deprecated since 0.0.105, removed in 2.0.0. Use
settings=AzureImageGenServiceREST.Settings(model=...) instead.Runtime-configurable generation settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using AzureImageGenServiceREST.Settings(...). See Service Settings for details.
Usage
Basic Setup
Notes
- HTTP session required: You must provide an
aiohttp.ClientSessionfor both API requests and downloading the generated images. - Asynchronous generation: Azure uses an asynchronous pattern where image generation is submitted and then polled for completion, with a timeout of 120 seconds.
- REST API: This service uses Azure’s REST API directly (not the OpenAI SDK), requiring an explicit endpoint URL.