Skip to content

Conversation

Dashing-Nelson
Copy link

Title

This pull request improves parameter handling for Azure GPT image generation models to prevent unsupported parameters from being included in API requests, which previously could cause errors. It also adds a new test to ensure this behavior is maintained.

Parameter filtering improvements:

  • Updated _check_valid_arg in litellm/utils.py to filter out unsupported parameters from passed_params when drop_params is enabled, ensuring only supported parameters are included in API requests. This prevents issues like sending response_format to Azure's gpt-image-1 model, which can result in 400 Bad Request errors.

Testing enhancements:

  • Added test_azure_gpt_image_1_no_extra_body_injection in tests/test_litellm/test_utils.py to verify that unsupported parameters (such as response_format) are dropped and not injected into extra_body when using provider config with Azure GPT image generation, and that supported parameters are preserved.

Relevant issues

Fixes #15028

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

Azure OpenAI Reject Image Generation Payload Due to extra_body Injection in LiteLLM v1.77.3 for gpt-image-1

…nt unsupported parameters from being added to extra_body for Azure GPT image generation
Copy link

vercel bot commented Sep 30, 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 1, 2025 11:49am

@krrishdholakia
Copy link
Contributor

krrishdholakia commented Sep 30, 2025

hi @Dashing-Nelson, thank you for this PR! i think we already have a reusable function for this logic - why not use that?

Also - your currently failing linting - if you can look into that, that'd be great!

…arameters for improved handling of unsupported arguments
…for image generation by introducing helper functions for provider-specific logic
…rams variable and streamline argument validation logic
…arameters for improved handling of unsupported arguments
…image_gen function, streamlining parameter processing for image generation
…or_image_gen function, enhancing filtering of provider-specific parameters for image generation
@Dashing-Nelson
Copy link
Author

hi @Dashing-Nelson, thank you for this PR! I think we already have a reusable function for this logic - why not use that?

Also - your currently failing linting - if you can look into that, that'd be great!

@krrishdholakia I have made use of the function and modified _check_valid_arg. I had missed it. It is now implemented.

I also noticed that linting and the test cases are failing for functions that are not related to mine.

…ams with dropped_params for improved handling of unsupported parameters
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]: Azure OpenAI Reject Image Generation Payload Due to extra_body Injection in LiteLLM v1.77.3 for gpt-image-1
2 participants