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

# Vidu 文生视频

> 使用 `POST /vidu/ent/v2/text2video` 提交纯文本生成视频任务。

# Vidu 文生视频

Vidu 官方格式文生视频接口,以 `application/json` 提交。

* 路由入口是 `POST /vidu/ent/v2/text2video`。
* 当前使用 `application/json` 提交。
* 支持纯文本生成视频。
* 提交成功后返回任务 `task_id` 与 `status`,后续用 [查询任务](./query) 轮询结果。

## 支持模型

* `viduq3-pro`: 高效生成优质音视频内容,让视频内容更生动、更形象、更立体
* `viduq2`: 最新模型
* `viduq1`: 画面清晰,平滑转场,运镜稳定

## 方法与路径

```http theme={null}
POST /vidu/ent/v2/text2video
```

## 请求示例

<CodeGroup>
  ```bash theme={null}
  curl -X POST https://octopusx.ai/vidu/ent/v2/text2video \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "viduq3-pro",
      "style": "general",
      "prompt": "一只猫在草地上追逐蝴蝶",
      "duration": 5,
      "seed": 0,
      "aspect_ratio": "16:9",
      "resolution": "720p",
      "bgm": false,
      "audio": true,
      "off_peak": false,
      "watermark": false
    }'
  ```

  ```python theme={null}
  import requests

  resp = requests.post(
      "https://octopusx.ai/vidu/ent/v2/text2video",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "model": "viduq3-pro",
          "style": "general",
          "prompt": "一只猫在草地上追逐蝴蝶",
          "duration": 5,
          "seed": 0,
          "aspect_ratio": "16:9",
          "resolution": "720p",
          "bgm": False,
          "audio": True,
          "off_peak": False,
          "watermark": False
      },
      timeout=60,
  )
  print(resp.json())
  ```
</CodeGroup>

## 响应示例

<ResponseExample>
  ```json 200 theme={null}
  {
    "task_id": "48038932-0ff5-4251-8b4b-7a76c09fd114",
    "status": "processing",
    "created_at": 1774494511
  }
  ```
</ResponseExample>

## 认证

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Body

<ParamField body="model" type="string" required>
  模型名称。支持 `viduq3-pro`(高效生成优质音视频内容)、`viduq2`(最新模型)、`viduq1`(画面清晰,平滑转场,运镜稳定)。
</ParamField>

<ParamField body="style" type="string">
  风格。`general`:通用风格;`anime`:动漫风格。注:使用 q2、q3 模型时该参数不生效。
</ParamField>

<ParamField body="prompt" type="string" required>
  文本提示词。生成视频的文本描述,支持中文和英文。
</ParamField>

<ParamField body="duration" type="integer">
  视频时长(秒)。`viduq2`:默认 5 秒,可选 1-10 秒;其他模型按默认值。
</ParamField>

<ParamField body="seed" type="integer">
  随机种子。不传或传 0 时使用随机数,手动设置则使用指定种子。
</ParamField>

<ParamField body="aspect_ratio" type="string">
  画幅比例。可选值:`16:9`(默认)、`9:16`、`3:4`、`4:3`、`1:1`。注:`3:4`、`4:3` 仅支持 q2、q3 模型。
</ParamField>

<ParamField body="resolution" type="string">
  分辨率。默认值依据模型和视频时长而定。`viduq2`(1-10 秒):默认 720p,可选 540p、720p、1080p。
</ParamField>

<ParamField body="bgm" type="boolean">
  是否添加背景音乐。`true`:系统将从预设 BGM 库中自动挑选合适的音乐并添加;`false`:不添加 BGM。注:BGM 参数在 q2 模型的 duration 为 9 或 10 秒时不生效;在 q3 模型中不生效。
</ParamField>

<ParamField body="audio" type="boolean">
  音视频直出(仅 q3 模型支持)。`true`:需要音视频直出,输出带台词以及背景音的视频;`false`:不需要音视频直出,输出静音视频。
</ParamField>

<ParamField body="off_peak" type="boolean">
  错峰模式。`true`:错峰生成视频,积分更低;`false`:即时生成视频。
</ParamField>

<ParamField body="watermark" type="boolean">
  是否添加水印。`true`:添加水印;`false`:不添加水印。注:水印内容固定为"内容由 AI 生成",默认不加。
</ParamField>

<ParamField body="wm_position" type="integer">
  水印位置。`1`:左上角;`2`:右上角;`3`:右下角;`4`:左下角。
</ParamField>

<ParamField body="wm_url" type="string">
  水印图片 URL。不传时使用默认水印。
</ParamField>

<ParamField body="payload" type="string">
  透传参数。不做任何处理,仅数据传输。
</ParamField>

<ParamField body="meta_data" type="string">
  元数据标识。JSON 格式字符串,透传字段。
</ParamField>

## Response

<ResponseField name="task_id" type="string">
  任务 ID,用于查询任务状态。
</ResponseField>

<ResponseField name="status" type="string">
  任务状态。可选值:`processing`(处理中)、`failed`(失败)、`completed`(已完成)。
</ResponseField>

<ResponseField name="created_at" type="integer">
  创建时间戳(Unix 时间戳)。
</ResponseField>

## 相关接口

* [Vidu 视频概览](./overview)
* [图生视频](./img2video)
* [首尾帧生视频](./start-end2video)
* [参考生视频](./reference2video)
* [查询任务](./query)
