Skip to content

Conversation

@Sameerlite
Copy link
Collaborator

@Sameerlite Sameerlite commented Oct 31, 2025

Title

Fix Azure image generation extra_body parameter error for partial_images and stream

Relevant issues

Fixes #16059

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details

  • I have added a screenshot of my new test passing locally

  • My PR passes all unit tests on make test-unit

  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

Problem:
Azure's image generation API doesn't support the extra_body parameter. When users tried to use partial_images or stream parameters, the request failed with:

BadRequestError: Unknown parameter: 'extra_body'

Root Cause:

  • get_optional_params_image_gen() correctly places non-standard OpenAI params into extra_body for Azure
  • However, Azure's API expects all parameters at the top level of the request body, not nested in extra_body

Solution:
Modified Azure's image_generation() and aimage_generation() methods in litellm/llms/azure/azure.py to flatten extra_body parameters to the top level before sending the request.

Before
image

After
Screenshot 2025-10-31 at 9 17 08 AM

@vercel
Copy link

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
litellm Ready Ready Preview Comment Oct 31, 2025 3:53am

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ishaan-jaff ishaan-jaff merged commit 2337d15 into main Nov 1, 2025
23 of 53 checks passed
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.

[Bug]: Image generation with streaming/partial image loading is broken

3 participants