Skip to content

Image generation uses unsupported "response_format" parameter with OpenAI GPT models #129

Description

@0xThiebaut

When generating an image with gpt-image-1.5, at least through LiteLLM, an error is generated due to the use of the unsupported response_format argument:

let request = ImageGenerationRequest(
model: model,
prompt: prompt,
numberOfImages: 1,
responseFormat: "b64_json"
)

The usage of response_format is apparently only valid for DALL-E models, not GPT models.

response_format: optional "url" or "b64_json" or null

The format in which generated images with dall-e-2 and dall-e-3 are returned. Must be one of url or b64_json. URLs are only valid for 60 minutes after the image has been generated. This parameter isn’t supported for the GPT image models, which always return base64-encoded images.

Source: developers.openai.com

On OpenClient version 1.7.10 (115), the following request is generated when prompting for an image.

POST /images/generations HTTP/1.1
Connection: close
Host: REDACTED
X-Real-IP: REDACTED
X-Forwarded-For: REDACTED
X-Forwarded-Proto: https
Content-Length: 76
Content-Type: application/json
User-Agent: openclient-llm/115 CFNetwork/3896.100.1.2.1 Darwin/27.0.0
Accept: */*
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate, br
Authorization: Bearer REDACTED

{"response_format":"b64_json","prompt":"REDACTED","model":"gpt-image-1.5","n":1}

When used against LiteLLM v1.100.1, the following response is generated.

HTTP/1.1 400 Bad Request
date: REDACTED
server: uvicorn
content-length: 298
content-type: application/json
x-frame-options: DENY
content-security-policy: frame-ancestors 'none'
x-content-type-options: nosniff
Connection: close

{"error":{"message":"litellm.UnsupportedParamsError: Setting `response_format` is not supported by openai, gpt-image-1.5. To drop it from the call, set `litellm.drop_params = True`.. Received Model Group=gpt-image-1.5\nAvailable Model Group Fallbacks=None","type":"None","param":null,"code":"400"}}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions