-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Closed
Labels
Description
What happened?
When using litellm.image_generation with unknown (newly added) Azure models (e.g., azure/FLUX-1.1-pro), the API call fails with:
15:29:31 - LiteLLM Proxy:ERROR: endpoints.py:158 - litellm.proxy.proxy_server.image_generation(): Exception occured - litellm.BadRequestError: AzureException - {"error":{"code":"invalid_header","message":"Header 'Content-Type' has invalid value `application/json;`","details":"Header 'Content-Type' has invalid value `application/json;`"}}. Received Model Group=FLUX-1.1-pro
Available Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2
INFO: 127.0.0.1:57389 - "POST /images/generations HTTP/1.1" 400 Bad Request
This is caused by the Content-Type request header being set to application/json; (with a trailing semicolon), which Azure rejects as an invalid value.
Steps to Reproduce
import litellm
def main():
litellm.api_base = "<my-azure-endpoint>"
litellm.api_key = "<my-azure-api-key>"
litellm.api_version = "2025-04-01-preview"
litellm._turn_on_debug()
result = litellm.image_generation(
model="azure/FLUX-1.1-pro",
prompt="A photograph of a red fox in an autumn forest",
size="1024x1024"
)
print(result["data"][0]["url"])
if __name__ == "__main__":
main()Actual Behavior
- The request fails with a
400 Bad Requestandinvalid_headererror from Azure.
Expected Behavior
- The
Content-Typeheader should be exactly:
Content-Type: application/json
(no trailing semicolon), allowing the Azure API to accept the request and return the generated image URL.
Relevant log output
15:29:31 - LiteLLM Proxy:ERROR: endpoints.py:158 - litellm.proxy.proxy_server.image_generation(): Exception occured - litellm.BadRequestError: AzureException - {"error":{"code":"invalid_header","message":"Header 'Content-Type' has invalid value `application/json;`","details":"Header 'Content-Type' has invalid value `application/json;`"}}. Received Model Group=FLUX-1.1-pro
Available Model Group Fallbacks=None LiteLLM Retried: 1 times, LiteLLM Max Retries: 2
INFO: 127.0.0.1:57389 - "POST /images/generations HTTP/1.1" 400 Bad RequestAre you a ML Ops Team?
No
What LiteLLM version are you on ?
v1.75.5
Twitter / LinkedIn details
No response