Skip to content

feat: add Azure OpenAI image generation and Responses API support#156

Open
jack-jackhui wants to merge 5 commits into
ATH-MaaS:mainfrom
jack-jackhui:pr/azure-gpt-image-adapter
Open

feat: add Azure OpenAI image generation and Responses API support#156
jack-jackhui wants to merge 5 commits into
ATH-MaaS:mainfrom
jack-jackhui:pr/azure-gpt-image-adapter

Conversation

@jack-jackhui

@jack-jackhui jack-jackhui commented May 17, 2026

Copy link
Copy Markdown

Summary

Adds Azure OpenAI support to Pixelle-Video for image generation and newer Azure LLM deployments that require the Responses API. Existing ComfyUI and chat-completions configurations remain backward compatible.

Changes

Azure OpenAI image generation

  • Adds AzureImageService for Azure OpenAI image generation.
  • Supports Azure GPT-image deployments and DALL-E style deployments.
  • Handles both URL and base64 image responses.
  • Saves generated images locally and exposes local_path through MediaResult.
  • Adds provider selection via:
image_provider:
  provider: azure_openai  # or comfyui

azure_openai:
  image:
    endpoint: "https://your-resource.openai.azure.com"
    api_key: "..."
    deployment: "gpt-image-1"
    api_version: "2025-04-01-preview"

Azure Responses API support for LLMs

  • Adds llm.api_style with:
    • chat_completions for existing OpenAI-compatible APIs.
    • azure_responses for newer Azure reasoning/Responses API models.
  • Supports Azure GPT-5.5/o3-style deployments through responses.create().
  • Avoids unsupported parameters such as temperature for Responses API calls.
llm:
  api_style: "azure_responses"
  azure_endpoint: "https://your-resource.openai.azure.com"
  azure_api_key: "..."
  azure_deployment: "gpt-55"
  azure_api_version: "2025-03-01-preview"

Other improvements

  • Frame processor can consume local image paths returned by the Azure adapter.
  • Adds Australian English Edge TTS voices:
    • en-AU-NatashaNeural
    • en-AU-WilliamNeural
  • Adds tests for Azure image service, config schema, and LLM service behavior.

Testing

Validated locally on the PR branch:

python3 -m pytest -q
27 passed

Also smoke-tested end-to-end generation with:

  • Azure GPT-image deployment for image generation.
  • Azure GPT-5.5 via Responses API for narration/title/image prompt generation.
  • Edge TTS for audio.
  • FFmpeg final video assembly.

Breaking changes

None. Default provider remains ComfyUI and default LLM style remains chat completions.

@CLAassistant

CLAassistant commented May 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

- Add AzureImageService for Azure OpenAI image generation (GPT-image-2/DALL-E 3)
- Update MediaService to route between ComfyUI and Azure based on config
- Add image_provider config section for provider selection
- Add azure_openai config section for Azure credentials/settings
- Update MediaResult model with local_path field
- Update config.example.yaml with Azure configuration options

Provider selection via config:
  image_provider:
    provider: comfyui | azure_openai

Azure config supports:
  - endpoint, api_key, deployment
  - default_size, default_quality, output_format
  - Automatic local save with configurable output_dir

Existing ComfyUI workflow behavior unchanged (backward compatible).
When Azure OpenAI image generation returns a local path (base64 decode
saves locally), the frame processor should use it directly instead of
trying to download from URL.

Fixes: UnsupportedProtocol error when Azure returns local path
- Add api_style config option (chat_completions vs azure_responses)
- Implement Azure OpenAI Responses API support for GPT-5.5/o3 models
- Update config.example.yaml with comprehensive Azure examples
- Add Australian English TTS voices (en-AU-NatashaNeural, en-AU-WilliamNeural)
- Add unit tests for Azure image adapter, LLM service, and config schema
- Update is_llm_configured() to validate both API styles

BREAKING: None - existing chat_completions behavior unchanged
GPT-5.5/o3 via Azure Responses API does not support the temperature
parameter. Passing it results in a 400 Bad Request error. This fix
removes temperature from kwargs before making the API call.
@jack-jackhui
jack-jackhui force-pushed the pr/azure-gpt-image-adapter branch from 84397fa to 51b63c3 Compare May 18, 2026 00:15
Add exponential backoff + jitter retry handling for transient Azure
OpenAI image generation errors (429, EngineOverloaded, rate limits).

Changes:
- Add _generate_with_retry wrapper in AzureImageService
- Add _is_retryable_provider_error and _retry_after_seconds helpers
- Configurable retry policy: max attempts, initial delay, max delay
- Honour Retry-After header when present
- Default: 7 attempts, 30s initial, 300s cap
- Add unit tests for retry behavior detection and config

This addresses production failures where Azure image generation returns
429 EngineOverloaded for several minutes, which exceeds the OpenAI SDK
built-in retry window.
@jack-jackhui

Copy link
Copy Markdown
Author

Hi maintainers — just checking in on this PR. The CLA is now signed and the branch is clean/mergeable. This adds Azure OpenAI image generation and Responses API support while keeping the integration isolated. Happy to adjust anything if you’d prefer a different structure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants