---
title: Referência para vídeo Vidu | RunAPI
description: Gere vídeos Vidu Q4 com até 15 imagens e três clipes de áudio de referência.
url: https://runapi.ai/pt-BR/docs/api/vidu/reference-to-video.md
canonical: https://runapi.ai/pt-BR/docs/api/vidu/reference-to-video
locale: pt-BR
---

> Versão HTML: https://runapi.ai/pt-BR/docs/api/vidu/reference-to-video
> Índice do site para agentes: https://runapi.ai/llms.txt

# Referência para vídeo Vidu

## Visão geral

Use a referência ao endpoint de vídeo com um modelo compatível. Use o ID da tarefa retornado para recuperar seu estado ou forneça callback_url para as entregas documentadas abaixo.

### Início rápido

1. Crie uma Chave de API e defina-a como RUNAPI_API_KEY.
2. Escolha um modelo compatível e envie uma requisição POST cujo corpo corresponda ao schema desse modelo.
3. Armazene o ID da tarefa retornado e, em seguida, faça polling até atingir um estado terminal ou trate os callbacks documentados abaixo.

## Endpoint

POST /api/v1/vidu/reference_to_video

URL base: https://runapi.ai

Versão da API: v1

Autenticação: Authorization: Bearer YOUR_API_TOKEN

## Modelos suportados

Abra uma página de modelo para ver preços atuais, limites de taxa e detalhes de uso comercial.

- [vidu-q4-reference-to-video](https://runapi.ai/pt-BR/models/vidu/q4-reference-to-video)

## Esquema de solicitação

Os campos e valores permitidos dependem do modelo selecionado. Quando fornecido, callback_url recebe as entregas da Task documentadas abaixo.

### vidu-q4-reference-to-video

```json
{
  "aspect_ratio": {
    "default": "16:9",
    "description": "Proporção de aspecto de vídeo de saída.",
    "enum": [
      "16:9",
      "9:16",
      "1:1",
      "4:3",
      "3:4"
    ],
    "type": "string"
  },
  "audio": {
    "default": true,
    "description": "Gere áudio sincronizado. False produz um vídeo silencioso.",
    "type": "boolean"
  },
  "callback_url": {
    "description": "URL de retorno de chamada do cliente RunAPI para o resultado da tarefa do terminal.",
    "type": "string"
  },
  "duration_seconds": {
    "default": 5,
    "description": "Duração do vídeo em segundos.",
    "max": 16,
    "min": 3,
    "type": "integer"
  },
  "model": {
    "description": "Modelo de referência para vídeo Vidu Q4.",
    "required": true,
    "type": "string"
  },
  "output_resolution": {
    "default": "720p",
    "description": "Resolução de vídeo de saída.",
    "enum": [
      "540p",
      "720p",
      "1080p",
      "2k",
      "4k"
    ],
    "type": "string"
  },
  "prompt": {
    "description": "Descrição do vídeo, até 20.000 caracteres.",
    "length": true,
    "max": 20000,
    "min": 1,
    "required": true,
    "type": "string"
  },
  "reference_audio_urls": {
    "description": "Até 3 URLs HTTP(S) de referências MP3, cada uma com 3 a 12 segundos e até 50 MB. O provedor valida os arquivos remotos.",
    "items": {
      "type": "string"
    },
    "max_items": 3,
    "type": "array"
  },
  "reference_image_urls": {
    "description": "URLs HTTP(S) solicitados de 1 a 15 imagens de referência JPG, JPEG, PNG ou WEBP. O provedor valida os arquivos remotos.",
    "items": {
      "type": "string"
    },
    "max_items": 15,
    "min_items": 1,
    "required": true,
    "type": "array"
  }
}
```

## Criar aceitação

HTTP 202 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    },
    "task_replayed": {
      "type": "boolean"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Consulta em processamento

HTTP 200 - GET /api/v1/vidu/reference_to_video/:id

### Esquema de resposta

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "processing"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "id": "tsk_reference_demo",
  "status": "processing"
}
```

## Consulta concluída

HTTP 200 - GET /api/v1/vidu/reference_to_video/:id

### Esquema de resposta

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## Consulta falhou

HTTP 200 - GET /api/v1/vidu/reference_to_video/:id

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Task processing failed.",
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Callback do cliente: concluído

HTTP 200 - POST callback_url

### Esquema de resposta

```json
{
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "completed"
      ],
      "type": "string"
    },
    "usage": {
      "properties": {
        "cost": {
          "type": "number"
        }
      },
      "required": [
        "cost"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    "videos": {
      "items": {
        "properties": {
          "url": {
            "type": "string",
            "x-runapi-generated-media": true
          }
        },
        "required": [
          "url"
        ],
        "type": "object",
        "unevaluatedProperties": false
      },
      "type": "array"
    }
  },
  "required": [
    "id",
    "status",
    "videos",
    "usage"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "id": "tsk_reference_demo",
  "status": "completed",
  "usage": {
    "cost": 0.05
  },
  "videos": [
    {
      "url": "https://file.runapi.ai/reference-video.mp4"
    }
  ]
}
```

## Callback do cliente: falhou

HTTP 200 - POST callback_url

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "properties": {
            "code": {
              "type": "string"
            },
            "limit_cents": {
              "type": "integer"
            },
            "message": {
              "type": "string"
            },
            "reset_at": {
              "format": "date-time",
              "type": [
                "string",
                "null"
              ]
            },
            "used_cents": {
              "type": "integer"
            },
            "window": {
              "enum": [
                "1h",
                "1d",
                "7d",
                "daily",
                "weekly",
                "monthly",
                "lifetime"
              ],
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object",
          "unevaluatedProperties": false
        }
      ]
    },
    "id": {
      "type": "string"
    },
    "status": {
      "enum": [
        "failed"
      ],
      "type": "string"
    }
  },
  "required": [
    "id",
    "status",
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": {
    "code": "generation_failed",
    "message": "Task processing failed."
  },
  "id": "tsk_reference_demo",
  "status": "failed"
}
```

## Erros

HTTP 401 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Authentication required"
}
```

## Erros

HTTP 401 - GET /api/v1/vidu/reference_to_video/:id

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Authentication required"
}
```

## Erros

HTTP 400 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "oneOf": [
    {
      "properties": {
        "error": {
          "description": "Mensagem de erro legível por humanos.",
          "type": "string"
        }
      },
      "required": [
        "error"
      ],
      "type": "object",
      "unevaluatedProperties": false
    },
    {
      "properties": {
        "error": {
          "description": "Resumo de validação legível por humanos.",
          "type": "string"
        },
        "errors": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": "Mensagens de validação com chaves por campo de requisição público, com um array de strings legíveis por humanos para cada campo.",
          "type": "object"
        }
      },
      "required": [
        "error",
        "errors"
      ],
      "type": "object",
      "unevaluatedProperties": false
    }
  ]
}
```

### Exemplo de resposta

```json
{
  "error": "model must be one of: vidu-q4-reference-to-video"
}
```

## Erros

HTTP 402 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Insufficient balance"
}
```

## Erros

HTTP 429 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "API key credit limit exceeded"
}
```

## Erros

HTTP 409 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "The request uses features that are not supported for the selected model"
}
```

## Erros

HTTP 429 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Rate limit reached. Please retry later."
}
```

## Erros

HTTP 503 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Service under maintenance, please try again later"
}
```

## Erros

HTTP 504 - POST /api/v1/vidu/reference_to_video

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "The request timed out"
}
```

## Erros

HTTP 404 - GET /api/v1/vidu/reference_to_video/:id

### Esquema de resposta

```json
{
  "properties": {
    "error": {
      "description": "Mensagem de erro legível por humanos.",
      "type": "string"
    }
  },
  "required": [
    "error"
  ],
  "type": "object",
  "unevaluatedProperties": false
}
```

### Exemplo de resposta

```json
{
  "error": "Task with id 'tsk_reference_demo' not found"
}
```

## Exemplos de Código Gerados

Use cURL diretamente ou instale um SDK para a sua linguagem. Cada exemplo submete a requisição validada mostrada nesta referência.

### curl

```curl
curl -X POST https://runapi.ai/api/v1/vidu/reference_to_video \
  -H 'Authorization: Bearer YOUR_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"model":"vidu-q4-reference-to-video","prompt":"The reference character walks through a quiet city.","reference_image_urls":["https://file.runapi.ai/reference.png"],"duration_seconds":5,"output_resolution":"720p","audio":true,"aspect_ratio":"16:9"}'
```

### javascript

#### Instalar

```bash
npm install @runapi.ai/vidu
```

```javascript
import { ViduClient } from "@runapi.ai/vidu";

const client = new ViduClient({ apiKey: process.env.RUNAPI_API_KEY });
const task = await client.referenceToVideo.create({
  "model": "vidu-q4-reference-to-video",
  "prompt": "The reference character walks through a quiet city.",
  "reference_image_urls": [
    "https://file.runapi.ai/reference.png"
  ],
  "duration_seconds": 5,
  "output_resolution": "720p",
  "audio": true,
  "aspect_ratio": "16:9"
});
```

### python

#### Instalar

```bash
pip install runapi-vidu
```

```python
import os
from runapi.vidu import ViduClient

client = ViduClient(api_key=os.environ["RUNAPI_API_KEY"])
task = client.reference_to_video.create(
  model="vidu-q4-reference-to-video",
  prompt="The reference character walks through a quiet city.",
  reference_image_urls=["https://file.runapi.ai/reference.png"],
  duration_seconds=5,
  output_resolution="720p",
  audio=True,
  aspect_ratio="16:9"
)
```

### go

#### Instalar

```bash
go get github.com/runapi-ai/vidu-sdk/go@latest
```

```go
package main

import (
  "context"
  "log"
  "os"

  "github.com/runapi-ai/core-sdk/go/option"
  vidu "github.com/runapi-ai/vidu-sdk/go/vidu"
)

func main() {
  client, err := vidu.NewClient(option.WithAPIKey(os.Getenv("RUNAPI_API_KEY")))
  if err != nil {
    log.Fatal(err)
  }

  task, err := client.ReferenceToVideo.Create(context.Background(), vidu.ReferenceToVideoParams{
    Model: vidu.ReferenceToVideoModel("vidu-q4-reference-to-video"),
    Prompt: "The reference character walks through a quiet city.",
    ReferenceImageURLs: []string{"https://file.runapi.ai/reference.png"},
    DurationSeconds: func(value int) *int { return &value }(5),
    OutputResolution: vidu.OutputResolution("720p"),
    Audio: func(value bool) *bool { return &value }(true),
    AspectRatio: vidu.AspectRatio("16:9"),
  })
  if err != nil {
    log.Fatal(err)
  }
  _ = task
}
```

### ruby

#### Instalar

```bash
gem install runapi-vidu
```

```ruby
require "runapi/vidu"

client = RunApi::Vidu::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
task = client.reference_to_video.create(
  model: "vidu-q4-reference-to-video",
  prompt: "The reference character walks through a quiet city.",
  reference_image_urls: ["https://file.runapi.ai/reference.png"],
  duration_seconds: 5,
  output_resolution: "720p",
  audio: true,
  aspect_ratio: "16:9"
)
```

### java

#### Instalar

```kotlin
implementation("ai.runapi:runapi-vidu")
```

```java
import ai.runapi.vidu.ViduClient;
import ai.runapi.vidu.types.ReferenceToVideoParams;
import ai.runapi.core.polling.TaskCreateResponse;

public final class Example {
  public static void main(String[] args) {
    ViduClient client = ViduClient.builder()
        .apiKey(System.getenv("RUNAPI_API_KEY"))
        .build();
    TaskCreateResponse task = client.referenceToVideo().create(
        ReferenceToVideoParams.builder()
        .model("vidu-q4-reference-to-video")
        .prompt("The reference character walks through a quiet city.")
        .referenceImageUrls(java.util.Arrays.asList("https://file.runapi.ai/reference.png"))
        .durationSeconds(5)
        .outputResolution("720p")
        .audio(true)
        .aspectRatio("16:9")
            .build()
    );
  }
}
```

### php

#### Instalar

```bash
composer require runapi-ai/vidu
```

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use RunApi\Core\ClientOptions;
use RunApi\Vidu\ViduClient;

$client = new ViduClient(new ClientOptions(apiKey: getenv('RUNAPI_API_KEY')));
$task = $client->referenceToVideo->create([
  "model" => "vidu-q4-reference-to-video",
  "prompt" => "The reference character walks through a quiet city.",
  "reference_image_urls" => ["https://file.runapi.ai/reference.png"],
  "duration_seconds" => 5,
  "output_resolution" => "720p",
  "audio" => true,
  "aspect_ratio" => "16:9"
]);
```

## Guias Relacionados

- [Autenticação](https://runapi.ai/pt-BR/docs/guides/authentication.md)
- [Início rápido](https://runapi.ai/pt-BR/docs/guides/task-api/quickstart.md)

---

## Mais de RunAPI

- [Início](https://runapi.ai/pt-BR/.md)
- [Catálogo de modelos](https://runapi.ai/pt-BR/models.md)
- [Preços](https://runapi.ai/pt-BR/pricing.md)
- [Provedores](https://runapi.ai/pt-BR/models)
- [Documentação](https://runapi.ai/pt-BR/docs/guides)
- [SDKs](https://runapi.ai/pt-BR/sdk.md)
- [CLI](https://runapi.ai/pt-BR/cli.md)
- [Servidor MCP](https://runapi.ai/pt-BR/mcp.md)
- [x402](https://runapi.ai/pt-BR/x402.md)
- [Claude Code vs Cursor](https://runapi.ai/pt-BR/claude-code-vs-cursor.md)
- [Configuração da API do Cursor](https://runapi.ai/pt-BR/cursor-api-setup.md)
- [RunAPI vs OpenRouter](https://runapi.ai/pt-BR/openrouter-alternative.md)
- [Enterprise](https://runapi.ai/pt-BR/contact.md)
- [Contato](https://runapi.ai/pt-BR/contact.md)
- [Termos](https://runapi.ai/pt-BR/terms.md)
- [Privacidade](https://runapi.ai/pt-BR/privacy.md)
- [Índice do site para agentes](https://runapi.ai/llms.txt)

Contato: contact@runapi.ai

## Dados estruturados

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "pt-BR",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/pt-BR",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/pt-BR/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pt-BR",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/pt-BR",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/pt-BRicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "pt-BR",
    "@type": "TechArticle",
    "headline": "Referência para vídeo Vidu",
    "description": "Gere vídeos Vidu Q4 com até 15 imagens e três clipes de áudio de referência.",
    "url": "https://runapi.ai/pt-BR/docs/api/vidu/reference-to-video",
    "mainEntityOfPage": "https://runapi.ai/pt-BR/docs/api/vidu/reference-to-video"
  }
]
```
