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

# Vidu Image Generation

> Generate images with the Vidu reference-image family and receive a unified generation.task response.

* Unified async image generation API
* Supports the Vidu reference-image family
* Works for text-to-image and reference-image-to-image flows
* Query task status with the returned task ID

## Body

<ParamField body="model" type="string" required>
  Supported models:

  * `vidu-image`
  * `viduq3-fast`
  * `viduq2-pro`
  * `viduq2-fast`
</ParamField>

<ParamField body="prompt" type="string" required>
  Text prompt for image generation
</ParamField>

<ParamField body="image_urls" type="string[]">
  Reference image URLs, up to 7 images
</ParamField>

<ParamField body="size" type="string" default="1:1">
  Aspect ratio. Supported values:

  * `1:1`
  * `4:3`
  * `3:4`
  * `16:9`
  * `9:16`
  * `3:2`
  * `2:3`
</ParamField>

<ParamField body="metadata.resolution" type="string" default="1K">
  Resolution when `size` is given as a ratio.

  Supported values:

  * `1K`
  * `2K`
  * `4K`

  `viduq2-fast` only supports `1K`.
</ParamField>

<ParamField body="n" type="integer" default={1}>
  Only `1` is supported
</ParamField>

<ParamField body="seed" type="integer">
  Random seed
</ParamField>

<ParamField body="metadata.watermark" type="boolean" default={false}>
  Whether to add watermark
</ParamField>

## Model Matrix

| Model         | Resolution         | Ratios                                                  |
| ------------- | ------------------ | ------------------------------------------------------- |
| `vidu-image`  | `1K` / `2K` / `4K` | `1:1` / `4:3` / `3:4` / `16:9` / `9:16` / `3:2` / `2:3` |
| `viduq3-fast` | `1K` / `2K` / `4K` | Same as above                                           |
| `viduq2-pro`  | `1K` / `2K` / `4K` | Same as above                                           |
| `viduq2-fast` | `1K` only          | Same as above                                           |

## Request Example

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://toapis.com/v1/images/generations \
    --header 'Authorization: Bearer <YOUR_API_KEY>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "viduq3-fast",
      "prompt": "Create a cinematic product poster while preserving the main object from the reference image.",
      "image_urls": [
        "https://example.com/reference-1.png"
      ],
      "size": "3:2",
      "metadata": {
        "resolution": "2K",
        "watermark": false
      },
      "seed": 42,
      "n": 1
    }'
  ```

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

  response = requests.post(
      "https://toapis.com/v1/images/generations",
      headers={
          "Authorization": "Bearer <YOUR_API_KEY>",
          "Content-Type": "application/json",
      },
      json={
          "model": "viduq3-fast",
          "prompt": "Create a cinematic product poster while preserving the main object from the reference image.",
          "image_urls": [
              "https://example.com/reference-1.png",
          ],
          "size": "3:2",
          "metadata": {
              "resolution": "2K",
              "watermark": False,
          },
          "seed": 42,
          "n": 1,
      },
  )

  task = response.json()
  print(task["id"])
  print(task["status"])
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://toapis.com/v1/images/generations', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer <YOUR_API_KEY>',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      model: 'viduq3-fast',
      prompt: 'Create a cinematic product poster while preserving the main object from the reference image.',
      image_urls: [
        'https://example.com/reference-1.png'
      ],
      size: '3:2',
      metadata: {
        resolution: '2K',
        watermark: false
      },
      seed: 42,
      n: 1
    })
  });

  const task = await response.json();
  console.log(task.id);
  console.log(task.status);
  ```
</RequestExample>

## Response

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "task_01KABCDEF1234567890",
    "object": "generation.task",
    "model": "viduq3-fast",
    "status": "queued",
    "progress": 0,
    "created_at": 1784169600
  }
  ```
</ResponseExample>

## Notes

* All four models use the same async endpoint: `POST /v1/images/generations`
* Successful results are returned in `result.data[].url`
* `viduq2-fast` is the lightweight tier and stays on `1K` only
