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

# Remix image

> Generate variations of an image without a prompt, in the aspect ratio you choose, for $0.04 per request.

Remix generates new versions of an image and keeps its overall concept. Each variation differs slightly in details such as character appearance, object position, or scene composition. It uses no prompt, and it can change the aspect ratio.

<CardGroup cols={3}>
  <Card title="$0.04" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/credits-fill.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=411698b1ce815a1634dd83c0b7332cff" width="16" height="16" data-path="icons/credits-fill.svg">per request</Card>
  <Card title="Image → 1–6 images" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/image-set.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=41ef98347d57b14c32a81f6395b070bd" width="16" height="16" data-path="icons/image-set.svg">up to 10 MB, 16 MP</Card>
  <Card title="POST /v1/images/variateImage" icon="https://mintcdn.com/recraft/dlnQgLElJIYDw2GO/icons/api.svg?fit=max&auto=format&n=dlnQgLElJIYDw2GO&q=85&s=eace772046907259477c5fa36adeb139" width="16" height="16" data-path="icons/api.svg">endpoint</Card>
</CardGroup>

## Try it

Get an API token on your [profile page](https://app.recraft.ai/profile/api) (it needs a positive API units balance) and set it once per terminal session:

```bash theme={null}
export RECRAFT_API_TOKEN=your_token
```

Then run. The request remixes a public sample illustration into a square image:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://external.api.recraft.ai/v1/images/variateImage \
    -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png",
      "size": "1:1"
    }'
  ```

  ```python Python theme={null}
  # pip install requests
  import os

  import requests

  response = requests.post(
      'https://external.api.recraft.ai/v1/images/variateImage',
      headers={'Authorization': f"Bearer {os.environ['RECRAFT_API_TOKEN']}"},
      json={
          'image_url': 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
          'size': '1:1',
      },
  )
  if not response.ok:
      raise SystemExit(f'{response.status_code}: {response.text}')
  print(response.json()['data'][0]['url'])
  ```

  ```javascript JavaScript theme={null}
  // Node.js 18+, run as an ES module (file.mjs)
  const response = await fetch('https://external.api.recraft.ai/v1/images/variateImage', {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.RECRAFT_API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      image_url: 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
      size: '1:1',
    }),
  });
  if (!response.ok) throw new Error(await response.text());
  const result = await response.json();
  console.log(result.data[0].url);
  ```

  ```python Python (OpenAI SDK) theme={null}
  # pip install openai
  import os

  from openai import OpenAI

  client = OpenAI(
      base_url='https://external.api.recraft.ai/v1',
      api_key=os.environ['RECRAFT_API_TOKEN'],
  )

  response = client.post(
      path='/images/variateImage',
      cast_to=object,
      body={
          'image_url': 'https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png',
          'size': '1:1',
      },
  )
  print(response['data'][0]['url'])
  ```
</CodeGroup>

## Response

```json theme={null}
{
  "created": 1759140000,
  "credits": 40,
  "data": [
    {
      "image_id": "0e6a1b8c-5b1f-4a8e-9f3a-2c7d4e8b9a10",
      "url": "https://..."
    }
  ]
}
```

* `data` has one entry per image (`n`). Download each image from its `url`.
* The `model` decides whether the output is raster or vector. A vector model returns SVG files.
* Image URLs are temporary: files are kept for about 24 hours, so download them. See [Limits and sizes](/docs/api-reference/appendix#image-storage).
* `credits` is the number of API units charged for the request.
* Pass `"response_format": "b64_json"` to get the image bytes inline, or `"multipart"` for the lowest latency. See [Image inputs and results](/docs/api-reference/image-inputs-and-results#image-results).

## Parameters

| Parameter | Type, default | Description |
| - | - | - |
| `image_url` | string, **required** in JSON | URL or data URL of the input image. |
| `image` | file, **required** in multipart | The input image, uploaded instead of `image_url`. |
| `size` | string, **required** | Size of the generated images: an aspect ratio `w:h` (for example `16:9`) or an exact size `WxH`. See [supported sizes](/docs/api-reference/appendix#image-sizes). |
| `model` | string | The model to use. It decides whether the output is raster or vector. See [All models](/docs/api-reference/models/overview) for every `model` value. |
| `n` | integer, `1` | Number of variations, 1 to 6. |
| `random_seed` | integer | Seed for reproducible results. |
| `response_format` | string, `url` | `url`, `b64_json`, or `multipart`. See [Image inputs and results](/docs/api-reference/image-inputs-and-results#image-results). |
| `image_format` | string, `webp` | `webp` (lossless) or `png`. Applies to raster output only. See [Image format](/docs/api-reference/image-inputs-and-results#image-format). |

The input image must be PNG, JPG, WEBP, or SVG, under 10 MB, up to 16 MP, with sides between 256 and 4096 px. See [Input images](/docs/api-reference/appendix#input-images).

## Examples

<AccordionGroup>
  <Accordion title="Upload a local file">
    <CodeGroup>
      ```bash cURL theme={null}
      curl https://external.api.recraft.ai/v1/images/variateImage \
        -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
        -F "image=@image.png" \
        -F "size=1:1"
      ```

      ```python Python theme={null}
      import os

      import requests

      with open('image.png', 'rb') as image:
          response = requests.post(
              'https://external.api.recraft.ai/v1/images/variateImage',
              headers={'Authorization': f"Bearer {os.environ['RECRAFT_API_TOKEN']}"},
              data={'size': '1:1'},
              files={'image': image},
          )
      if not response.ok:
          raise SystemExit(f'{response.status_code}: {response.text}')
      print(response.json()['data'][0]['url'])
      ```
    </CodeGroup>
  </Accordion>

  <Accordion title="Several wide variations">
    Set `size` to another aspect ratio and `n` to get a few variations in one request. The response has one `data` entry per image.

    ```bash theme={null}
    curl https://external.api.recraft.ai/v1/images/variateImage \
      -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png",
        "size": "16:9",
        "n": 3
      }'
    ```
  </Accordion>

  <Accordion title="Reproducible variations as PNG">
    Pass `random_seed` to make a request reproducible. `image_format` returns PNG instead of WebP.

    ```bash theme={null}
    curl https://external.api.recraft.ai/v1/images/variateImage \
      -H "Authorization: Bearer $RECRAFT_API_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "image_url": "https://cdn.prod.website-files.com/655727fe69827d9a402de12c/679b82f54ef9617939df9d8e_motorcycle--going-fast.png",
        "size": "1:1",
        "random_seed": 13191922,
        "image_format": "png"
      }'
    ```
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Image to image" href="/docs/api-reference/tools/image-to-image">
    Change an image with a prompt and a strength value.
  </Card>

  <Card title="Pricing" href="/docs/api-reference/pricing">
    Prices of every model and tool.
  </Card>
</CardGroup>


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