Previously, I successfully used the DALL·E 3 model with response_format: 'b64_json'
, but now it returns the following error:
{
“message”: null,
“type”: “image_generation_user_error”,
“param”: null,
“code”: null
}
However, if I remove response_format: 'b64_json'
, I still receive the image URL as expected.
I’ve got a little utility that does not download URLs, it receives via response format.
dall-e-2:
dall-e-3:
gpt-image-1:
Log of API call parameters passed (showing as Python streamable):
{'model': 'dall-e-2', 'size': '1024x1024', 'prompt': 'Two cartoon carrots are having a conversation in a garden.', 'response_format': 'b64_json', 'timeout': 40}
{'model': 'dall-e-3', 'size': '1024x1024', 'prompt': 'Two cartoon carrots are having a conversation in a garden.', 'response_format': 'b64_json', 'timeout': 40}
{'model': 'gpt-image-1', 'size': '1024x1024', 'prompt': 'Two cartoon carrots are having a conversation in a garden.', 'timeout': 60, 'background': None, 'moderation': None, 'output_compression': None, 'output_format': 'png', 'quality': 'medium', 'user': 'dalle-edit-user'}
before this snippet with the Python SDK:
if PRINT_API_CALLS:
print(image_params)
response = await self.client.images.edit(**image_params)
b64_data = response.data[0].b64_json
image_data = base64.b64decode(b64_data)
image_file = BytesIO(image_data)
Note how the response_format is NOT sent for the image-1
model, per API Reference.
There’s someone here that also could not resolve an issue with dall-e-2
on their organization - while their script ran fine for me.
So check that you are making the same call as were successful before, and then discover if it is your org that has gone wrong, if a new project, new API key, using that API key without sending organization or project headers can resolve the issue, on an innocent-sounding prompt.
Can you provide your code snippet so everyone can understand your problem?
The current code I am using is:
const completions = await app.service.openai.images.generate({
model: 'dall-e-3',
prompt: body.content,
size: '1024x1024',
response_format: 'b64_json'
})
completions
used to return an array containing data in b64_json
format, which I had used before. However, since yesterday, I can no longer use this format — I have to remove the response_format: 'b64_json'
configuration and can only receive a URL instead.