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_API_KEY: Your Azure OpenAI API key for authenticationAZURE_ENDPOINT: Your Azure OpenAI endpoint URL
Configuration
Azure OpenAI API key for authentication.
Azure OpenAI endpoint URL.
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.Image generation model to use. Deprecated in v0.0.105. Use
settings=AzureImageGenServiceREST.Settings(model=...) instead.Azure API version string.
Runtime-configurable generation settings. See Settings below.
Settings
Runtime-configurable settings passed via thesettings constructor argument using AzureImageGenServiceREST.Settings(...). See Service Settings for details.
| Parameter | Type | Default | Description |
|---|---|---|---|
model | str | NOT_GIVEN | Image generation model identifier. (Inherited from base settings.) |
image_size | str | None | NOT_GIVEN | Target size for generated images (e.g., "1024x1024"). |
NOT_GIVEN values are omitted from the request, letting the service use its
own defaults. Only parameters that are explicitly set are included.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.