Hey OpenAI dev community!
I’ve discovered what appears to be a discrepancy between the documentation and actual behavior of the Image Variations API when using gpt-image-1. I’m hoping someone can confirm if this is expected behavior or a bug.
The Problem
According to the documentation, gpt-image-1 supports non-square sizes:
- 1024x1024 (square)
- 1536x1024 (landscape)
- 1024x1536 (portrait)
- auto (default)
However, when I explicitly set model: "gpt-image-1"
in a request to the variations endpoint (/v1/images/variations
), the API rejects non-square sizes with an error message that lists only DALL·E sizes.
Reproduction Code
Here’s a simplified version of what I’m sending:
// Create FormData
const formData = new FormData();
formData.append("model", "gpt-image-1"); // Explicitly set model
formData.append("size", "1024x1536"); // Portrait size supported by gpt-image-1
formData.append("response_format", "b64_json");
formData.append("n", "1");
formData.append("image", imageBlob, "image.png");
// Send request
const response = await fetch("https://api.openai.com/v1/images/variations", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
},
body: formData,
});
Error Response
{
"error": {
"code": null,
"message": "'1024x1536' is not one of ['256x256', '512x512', '1024x1024'] - 'size'",
"param": null,
"type": "invalid_request_error"
}
}
Note that the error message lists sizes for DALL·E models, not gpt-image-1.
What I’ve Verified
- My organization is verified and has access to gpt-image-1
- The same API key works correctly with gpt-image-1 when using the generations endpoint
- I’ve added logging to confirm the model parameter is being correctly included in the FormData:
FormData entries:
"0": "model: gpt-image-1",
"1": "size: 1024x1536",
"2": "response_format: b64_json",
"3": "n: 1",
"4": "image: [blob]"
Questions for the Community
- Has anyone successfully used gpt-image-1 with the variations endpoint?
- Is there a different way to specify the model for variations that I’m missing?
- Is this a known limitation that should be added to the docs?
Thanks! Joe