> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pipellm.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create an image variation

> Generate variations of a source image.

<Warning>
  Upstream, this endpoint only supports `dall-e-2`. GPT image models do not implement it. To vary an image with a GPT image model, send the source to [`POST /v1/images/edits`](/api-reference/image/edits) with a prompt describing the variation you want.
</Warning>

Returns new images derived from a source image, with no prompt. Always `multipart/form-data`.

<ParamField body="image" type="file" required>
  Source image. Must be a square PNG under 4 MB.
</ParamField>

<ParamField body="model" type="string" default="dall-e-2">
  Only `dall-e-2` implements variations.
</ParamField>

<ParamField body="n" type="integer" default="1">
  Number of variations, 1–10.
</ParamField>

<ParamField body="size" type="string" default="1024x1024">
  `256x256`, `512x512`, or `1024x1024`.
</ParamField>

<ParamField body="response_format" type="string" default="url">
  `url` or `b64_json`. URLs expire about 60 minutes after generation, so download promptly.
</ParamField>

<ParamField body="user" type="string">
  Stable end-user identifier.
</ParamField>

<RequestExample>
  ```bash cURL theme={"dark"}
  curl https://api.pipellm.ai/v1/images/variations \
    -H "Authorization: Bearer $PIPELLM_API_KEY" \
    -F model="dall-e-2" \
    -F image="@logo.png" \
    -F n=2 \
    -F size="1024x1024"
  ```

  ```python Python theme={"dark"}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["PIPELLM_API_KEY"],
      base_url="https://api.pipellm.ai/v1",
  )

  result = client.images.create_variation(
      model="dall-e-2",
      image=open("logo.png", "rb"),
      n=2,
      size="1024x1024",
  )
  print([item.url for item in result.data])
  ```
</RequestExample>

<ResponseExample>
  ```json theme={"dark"}
  {
    "created": 1726400000,
    "data": [
      { "url": "https://..." },
      { "url": "https://..." }
    ]
  }
  ```
</ResponseExample>

<ResponseField name="created" type="integer">
  Unix timestamp of the generation.
</ResponseField>

<ResponseField name="data" type="array">
  One entry per variation, carrying `url` or `b64_json` depending on `response_format`.
</ResponseField>

## Errors

Same envelope as [Errors](/api-reference/errors). A non-square or oversized source returns `400`; a model that does not implement variations returns the upstream's error unchanged.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.