POST
POST /images/variations — OpenAI API
Deprecated
OpenAI API key (required); https://api.openai.com/v1
OpenAI APICreate image variation
- Base URL
- https://api.openai.com/v1
- Auth
- Authorization: Bearer <OPENAI_API_KEY>
- Last verified
- 2026-10-20 · upstream hash matched
Actions Try in browser→
Agents: curl -H "Accept: text/markdown" this URL
→ 333 tokens · Vary: Accept
→ 333 tokens · Vary: Accept
Critical gotchas
The Responses API is the primary interface for new text and tool workflows; Chat Completions remains a separate compatibility API.
Audio transcription uploads use multipart form data rather than a JSON request body.
cURL
curl -X POST 'https://api.openai.com/v1/images/variations' \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -F '[email protected]'
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| image | body | string | Yes | The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. |
| model | body | string | No | The legacy model used by the retired image variations endpoint. This endpoint no longer accepts requests. |
| n | body | integer | No | The number of images to generate. Must be between 1 and 10. |
| response_format | body | string | No | The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated. |
| size | body | string | No | The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. |
| user | body | string | No | A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](https://developers.openai.com/api/docs/guides/safety-best-practices#implement-safety-identifiers). |
Response 200 OK
{
"safety_identifier": "string",
"created": 0,
"data": [
{
"b64_json": "string",
"url": "https://example.com",
"revised_prompt": "string"
}
],
"background": "transparent",
"output_format": "png",
"size": "string",
"quality": "low",
"usage": {
"input_tokens": 0,
"total_tokens": 0,
"output_tokens": 0,
"output_tokens_details": {
"image_tokens": 0,
"text_tokens": 0
},
"input_tokens_details": {
"text_tokens": 0,
"image_tokens": 0
}
}
} Get a free OpenAI API key → sponsored Affiliate link - we may earn a commission, at no extra cost to you.