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

# Tạo video（Seedance）

> Dòng này hỗ trợ định dạng tạo video OpenAI (xem chi tiết tại liên kết [Định dạng tương thích với Sora tạo video](/api-reference/vi/tao-video-dinh-dang-tuong-thich-sora/tao-video)).

Được dùng để tạo tác vụ tạo video và truy vấn trạng thái cũng như kết quả thông qua ID tác vụ.

Các trường cốt lõi để tạo tác vụ:
- `model`: Bắt buộc, tên mô hình.
- `prompt`: Bắt buộc, mô tả chính để tạo video.
- `content`: tùy chọn, mảng content của Volcano Ark, trộn văn bản, hình ảnh, video và âm thanh.
- `function_mode`: Tùy chọn, thường dùng cho các chế độ nâng cao như tham chiếu toàn năng.

Các tham số đầu vào tương thích:

Các trường sau chủ yếu dùng để tương thích với client cũ và giao thức cũ. Với tích hợp mới, vui lòng ưu tiên dùng định dạng chuẩn trong “Ví dụ yêu cầu” trên trang này: văn bản và tài liệu tham chiếu sử dụng mảng `content`, còn cấu hình sinh sử dụng các trường cấp cao nhất `duration`, `ratio`, `resolution`, `fps`, v.v.

- `mode`：`t2v / i2v / i2v_first_last / reference_images / reference_material`
- `image_url / image_urls / input_reference`
- `end_image_url / last_image_url`
- `video_urls / audio_urls`
- `seconds / duration`
- `aspect_ratio / ratio / size`
- `quality / resolution`
- `fps`
- `generate_audio / watermark`

Chi tiết gọi API:
- Khi là `mode=reference_material` hoặc `function_mode=omni_reference`, nên truyền văn bản và tài liệu tham chiếu thông qua `content`.
- `content` mục văn bản được viết theo dạng `{ "type": "text", "text": "测试文字" }`.
- `content` các mục tài nguyên hình ảnh, video, âm thanh lần lượt dùng cú pháp đối tượng `image_url`, `video_url`, `audio_url`, ví dụ `{ "type": "image_url", "image_url": { "url": "https://example.com/ref.png" }, "role": "reference_image", "name": "1" }`.
- `role` có thể dùng để xác định mục đích của tài nguyên, `name` có thể được tham chiếu theo tên trong prompt.
- `ratio`, `duration`, `resolution`, `fps` sẽ ảnh hưởng đến cấu hình tạo cuối cùng.

Gọi Gemini Omni:
- `gemini-omni` cũng có thể được gọi thông qua giao diện tác vụ Seedance này.
- `mode=t2v` dùng cho tạo video từ văn bản, `mode=r2v` dùng cho tạo bằng ảnh tham chiếu/tài nguyên tham chiếu, `mode=edit` dùng cho chỉnh sửa video.
- Văn bản có thể đặt trong mục `text` của `prompt` hoặc `content`; hình ảnh có thể đặt trong `image_url / image_urls / reference_images / input_reference / content`; video có thể đặt trong `video_urls / content`.
- Trường thời lượng có thể dùng `duration` hoặc `seconds`, hệ thống sẽ tự động khớp với các mức 4 / 6 / 8 / 10 giây.

MiniMax / Hailuo gọi:
- `minimax-h3` có thể được gọi thông qua API tác vụ này, hỗ trợ tạo video từ văn bản, tham chiếu ảnh và tham chiếu âm thanh; văn bản có thể đặt trong mục văn bản `prompt` hoặc `content`, dữ liệu có thể đặt trong các trường như `content`, `image_urls`, `audio_urls`.
- `hailuo-2.3` có thể được gọi thông qua API tác vụ này, cần ảnh khung hình đầu tiên; khuyến nghị truyền mục `image_url` của `role=first_frame` trong `content`.
- `minimax-h3` thường dùng `duration=5~15`, `resolution=1440p`; `hailuo-2.3` thường dùng `duration=6` hoặc `10`, `resolution=768p`.

Các trường cần lưu ý trong kết quả truy vấn:
- `items[].status`
- `items[].content.video_url` hoặc `items[].video_url`
- `items[].error`
- `items[].progress`

Error fields: `error.code`, `error.message`.

```json
{
  "error": {
    "code": "invalid_request_error",
    "message": "requires at least one image in `images`"
  }
}
```



## OpenAPI

````yaml api-reference/vi/openapi.json POST /api/v3/contents/generations/tasks
openapi: 3.0.0
info:
  title: Tài liệu tham khảo API của 出海营
  version: 1.0.0
  description: Public AI Gateway API Reference
servers:
  - url: https://api.aiid.edu.kg
security:
  - BearerAuth: []
tags:
  - name: Định dạng OpenAI (Chat)
  - name: Định dạng OpenAI (Responses)
  - name: Định dạng Gemini cho tạo ảnh
  - name: Tạo hình ảnhOpenAI định dạng DALL-E
  - name: Lấy danh sách mô hình
  - name: Tạo video HappyHorse và Wan
  - name: Định dạngKling tạo video
  - name: Định dạng Video Generation Omni và Veo
  - name: Tạo video Seedance
  - name: Định dạng tương thích Sora cho tạo video
  - name: Tạo video Vidu
  - name: Định dạng tác vụ tạo nhạc
paths:
  /api/v3/contents/generations/tasks:
    post:
      tags:
        - Tạo video Seedance
      summary: Tạo video（Seedance）
      description: >-
        Dòng này hỗ trợ định dạng tạo video OpenAI (xem chi tiết tại liên kết
        [Định dạng tương thích với Sora tạo
        video](/api-reference/vi/tao-video-dinh-dang-tuong-thich-sora/tao-video)).


        Được dùng để tạo tác vụ tạo video và truy vấn trạng thái cũng như kết
        quả thông qua ID tác vụ.


        Các trường cốt lõi để tạo tác vụ:

        - `model`: Bắt buộc, tên mô hình.

        - `prompt`: Bắt buộc, mô tả chính để tạo video.

        - `content`: tùy chọn, mảng content của Volcano Ark, trộn văn bản, hình
        ảnh, video và âm thanh.

        - `function_mode`: Tùy chọn, thường dùng cho các chế độ nâng cao như
        tham chiếu toàn năng.


        Các tham số đầu vào tương thích:


        Các trường sau chủ yếu dùng để tương thích với client cũ và giao thức
        cũ. Với tích hợp mới, vui lòng ưu tiên dùng định dạng chuẩn trong “Ví dụ
        yêu cầu” trên trang này: văn bản và tài liệu tham chiếu sử dụng mảng
        `content`, còn cấu hình sinh sử dụng các trường cấp cao nhất `duration`,
        `ratio`, `resolution`, `fps`, v.v.


        - `mode`：`t2v / i2v / i2v_first_last / reference_images /
        reference_material`

        - `image_url / image_urls / input_reference`

        - `end_image_url / last_image_url`

        - `video_urls / audio_urls`

        - `seconds / duration`

        - `aspect_ratio / ratio / size`

        - `quality / resolution`

        - `fps`

        - `generate_audio / watermark`


        Chi tiết gọi API:

        - Khi là `mode=reference_material` hoặc `function_mode=omni_reference`,
        nên truyền văn bản và tài liệu tham chiếu thông qua `content`.

        - `content` mục văn bản được viết theo dạng `{ "type": "text", "text":
        "测试文字" }`.

        - `content` các mục tài nguyên hình ảnh, video, âm thanh lần lượt dùng
        cú pháp đối tượng `image_url`, `video_url`, `audio_url`, ví dụ `{
        "type": "image_url", "image_url": { "url": "https://example.com/ref.png"
        }, "role": "reference_image", "name": "1" }`.

        - `role` có thể dùng để xác định mục đích của tài nguyên, `name` có thể
        được tham chiếu theo tên trong prompt.

        - `ratio`, `duration`, `resolution`, `fps` sẽ ảnh hưởng đến cấu hình tạo
        cuối cùng.


        Gọi Gemini Omni:

        - `gemini-omni` cũng có thể được gọi thông qua giao diện tác vụ Seedance
        này.

        - `mode=t2v` dùng cho tạo video từ văn bản, `mode=r2v` dùng cho tạo bằng
        ảnh tham chiếu/tài nguyên tham chiếu, `mode=edit` dùng cho chỉnh sửa
        video.

        - Văn bản có thể đặt trong mục `text` của `prompt` hoặc `content`; hình
        ảnh có thể đặt trong `image_url / image_urls / reference_images /
        input_reference / content`; video có thể đặt trong `video_urls /
        content`.

        - Trường thời lượng có thể dùng `duration` hoặc `seconds`, hệ thống sẽ
        tự động khớp với các mức 4 / 6 / 8 / 10 giây.


        MiniMax / Hailuo gọi:

        - `minimax-h3` có thể được gọi thông qua API tác vụ này, hỗ trợ tạo
        video từ văn bản, tham chiếu ảnh và tham chiếu âm thanh; văn bản có thể
        đặt trong mục văn bản `prompt` hoặc `content`, dữ liệu có thể đặt trong
        các trường như `content`, `image_urls`, `audio_urls`.

        - `hailuo-2.3` có thể được gọi thông qua API tác vụ này, cần ảnh khung
        hình đầu tiên; khuyến nghị truyền mục `image_url` của `role=first_frame`
        trong `content`.

        - `minimax-h3` thường dùng `duration=5~15`, `resolution=1440p`;
        `hailuo-2.3` thường dùng `duration=6` hoặc `10`, `resolution=768p`.


        Các trường cần lưu ý trong kết quả truy vấn:

        - `items[].status`

        - `items[].content.video_url` hoặc `items[].video_url`

        - `items[].error`

        - `items[].progress`


        Error fields: `error.code`, `error.message`.


        ```json

        {
          "error": {
            "code": "invalid_request_error",
            "message": "requires at least one image in `images`"
          }
        }

        ```
      operationId: create__seedance__task
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  example: doubao-seedance-2-0-260128
                  enum:
                    - doubao-seedance-1-0-lite-i2v-250428
                    - doubao-seedance-1-0-lite-t2v-250428
                    - doubao-seedance-1-0-pro-250528
                    - doubao-seedance-1-0-pro-fast-251015
                    - doubao-seedance-1-5-pro-251215
                    - doubao-seedance-2-0-260128
                    - doubao-seedance-2-0-fast-260128
                    - minimax-h3
                    - hailuo-2.3
                    - gemini-omni
                  description: >-
                    Bắt buộc. Tên mô hình. Có thể truyền Seedance mô hình bên
                    ngoài, `gemini-omni`, `minimax-h3` hoặc `hailuo-2.3`.
                prompt:
                  type: string
                  example: 参考素材生成一段剧情短视频
                  description: Bắt buộc. Mô tả chính để tạo video, không được để trống.
                content:
                  type: array
                  description: >-
                    Tùy chọn. Mảng content của Volcano Ark, sắp xếp xen kẽ theo
                    thứ tự giữa văn bản và các mục nội dung. Mục văn bản dùng `{
                    "type": "text", "text": "..." }`; các mục hình ảnh, video,
                    âm thanh lần lượt dùng các đối tượng `image_url`,
                    `video_url`, `audio_url` và đặt `url` bên trong, có thể kết
                    hợp với `role` (như `reference_image`, `reference_video`,
                    `reference_audio`) và `name` để văn bản tham chiếu.
                  items:
                    type: object
                    required:
                      - type
                    properties:
                      type:
                        type: string
                        enum:
                          - text
                          - image_url
                          - video_url
                          - audio_url
                        description: Loại mục nội dung.
                      text:
                        type: string
                        description: Nội dung văn bản, chỉ dùng khi type=text.
                      image_url:
                        oneOf:
                          - type: string
                          - type: object
                            properties:
                              url:
                                type: string
                        description: >-
                          URL hình ảnh, khuyến nghị dùng dạng đối tượng:
                          `{"url":"https://..."}`.
                      video_url:
                        oneOf:
                          - type: string
                          - type: object
                            properties:
                              url:
                                type: string
                        description: >-
                          URL video, khuyến nghị dùng dạng object:
                          `{"url":"https://..."}`.
                      audio_url:
                        oneOf:
                          - type: string
                          - type: object
                            properties:
                              url:
                                type: string
                        description: >-
                          URL âm thanh, khuyến nghị dùng dạng đối tượng:
                          `{"url":"https://..."}`.
                      role:
                        type: string
                        description: >-
                          Mã định danh mục đích sử dụng tài nguyên, các giá trị
                          thường gặp như reference_image, reference_video,
                          reference_audio.
                      name:
                        type: string
                        description: >-
                          Tên tài liệu, có thể được tham chiếu trong prompt văn
                          bản hoặc dùng để phân biệt nhiều tài liệu.
                function_mode:
                  type: string
                  description: >-
                    Tùy chọn. Chế độ tính năng nâng cao, chẳng hạn như
                    `omni_reference` dùng để tham khảo toàn diện.
                mode:
                  type: string
                  description: >-
                    Tùy chọn. Các trường ở chế độ tương thích, như `t2v`, `i2v`,
                    `i2v_first_last`, `reference_images`, `reference_material`;
                    `gemini-omni` hỗ trợ `t2v`, `r2v`, `edit`.
                image_url:
                  type: string
                  description: Tùy chọn. URL của một ảnh tham chiếu duy nhất.
                image_urls:
                  type: array
                  items:
                    type: string
                  description: Tùy chọn. Danh sách URL của nhiều ảnh tham chiếu.
                input_reference:
                  type: string
                  description: Tùy chọn. Tương thích với các trường nhập liệu tham chiếu.
                end_image_url:
                  type: string
                  description: Tùy chọn. URL hình ảnh tham chiếu cho khung hình cuối.
                last_image_url:
                  type: string
                  description: Tùy chọn. Alias URL của hình ảnh tham chiếu khung hình cuối.
                video_urls:
                  type: array
                  items:
                    type: string
                  description: Tùy chọn. Danh sách URL video tham chiếu.
                audio_urls:
                  type: array
                  items:
                    type: string
                  description: Tùy chọn. Danh sách URL âm thanh tham chiếu.
                seconds:
                  oneOf:
                    - type: number
                    - type: string
                  description: >-
                    Tùy chọn. Thời lượng video, tính bằng giây; tương thích với
                    `duration`.
                duration:
                  oneOf:
                    - type: number
                    - type: string
                  description: >-
                    Tùy chọn. Thời lượng video, tính bằng giây; tương thích với
                    `seconds`.
                aspect_ratio:
                  type: string
                  description: 'Tùy chọn. Tỷ lệ khung hình, ví dụ: `16:9`.'
                ratio:
                  type: string
                  description: 'Tùy chọn. Biệt danh của tỷ lệ khung hình, ví dụ: `16:9`.'
                size:
                  type: string
                  description: >-
                    Tùy chọn. Trường tương thích với độ phân giải hoặc kích
                    thước.
                quality:
                  type: string
                  description: Tùy chọn. Cấu hình chất lượng tạo.
                resolution:
                  type: string
                  description: Tùy chọn. Độ phân giải đầu ra.
                fps:
                  type: number
                  description: Tùy chọn. Tốc độ khung hình.
                generate_audio:
                  type: boolean
                  description: Tùy chọn. Có tạo âm thanh hay không.
                watermark:
                  type: boolean
                  description: Tùy chọn. Có thêm hình mờ (watermark) hay không.
            examples:
              seedance_tasks_reference_material:
                summary: Seedance nội dung nhiệm vụ
                value:
                  model: doubao-seedance-1-0-lite-i2v-250428
                  mode: reference_material
                  prompt: 测试文字
                  content:
                    - type: text
                      text: 测试文字
                    - type: image_url
                      image_url:
                        url: >-
                          https://imageproxy.zhongzhuan.chat/api/proxy/image/9979f1a754b3571d5e8bdcc397eedf53.png
                      role: reference_image
                      name: '1'
                    - type: video_url
                      video_url:
                        url: >-
                          https://imageproxy.zhongzhuan.chat/api/proxy/video/1979f1a754b3571d5e8bdcc397eedf53.mp4
                      role: reference_video
                      name: '2'
                    - type: audio_url
                      audio_url:
                        url: >-
                          https://imageproxy.zhongzhuan.chat/api/proxy/video/3979f1a754b3571d5e8bdcc397eedf53.mp3
                      role: reference_audio
                      name: '3'
                  duration: 5
                  size: 1280x720
              minimax_h3_tasks_content:
                summary: Nhiệm vụ nội dung MiniMax H3
                value:
                  model: minimax-h3
                  prompt: A cinematic product video with smooth camera motion
                  content:
                    - type: text
                      text: >-
                        Use the product image as reference and match the rhythm
                        of the audio.
                    - type: image_url
                      image_url:
                        url: https://example.com/product.jpg
                      role: reference_image
                      name: product
                    - type: audio_url
                      audio_url:
                        url: https://example.com/music.mp3
                      role: reference_audio
                      name: music
                  duration: 8
                  resolution: 1440p
                  ratio: '16:9'
                  generate_audio: true
              hailuo_2_3_tasks_first_frame:
                summary: Hailuo 2.3 Tạo video từ ảnh khung đầu tiên
                value:
                  model: hailuo-2.3
                  prompt: >-
                    The camera slowly pushes in, natural motion and cinematic
                    lighting.
                  content:
                    - type: text
                      text: >-
                        The camera slowly pushes in, natural motion and
                        cinematic lighting.
                    - type: image_url
                      image_url:
                        url: https://example.com/first-frame.jpg
                      role: first_frame
                      name: first
                  duration: 10
                  resolution: 768p
                  ratio: '16:9'
              gemini_omni_seedance_t2v:
                summary: Gemini Omni t2v
                value:
                  model: gemini-omni
                  mode: t2v
                  prompt: A cinematic product video with smooth camera motion
                  duration: 8
                  size: 1280x720
              gemini_omni_seedance_r2v:
                summary: Gemini Omni r2v
                value:
                  model: gemini-omni
                  mode: r2v
                  content:
                    - type: text
                      text: Keep the product consistent and create a short ad video
                    - type: image_url
                      image_url:
                        url: https://example.com/product.jpg
                  duration: 8
                  size: 1280x720
              gemini_omni_seedance_edit:
                summary: Gemini Omni edit
                value:
                  model: gemini-omni
                  mode: edit
                  content:
                    - type: text
                      text: Change the outfit color while keeping the motion natural
                    - type: video_url
                      video_url:
                        url: https://example.com/input.mp4
                    - type: image_url
                      image_url:
                        url: https://example.com/style.jpg
                  duration: 8
                  size: 1280x720
      responses:
        '200':
          description: Tạo nhiệm vụ thành công
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                    example: task_xxx
                    description: ID của tác vụ.
                  status:
                    type: string
                    description: Trạng thái nhiệm vụ.
                    enum:
                      - queued
                      - running
                      - succeeded
                      - failed
                  created_at:
                    type: string
                    description: Thời gian tạo (giây Unix).
                  items:
                    type: string
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: ID của tác vụ.
                        status:
                          type: string
                          description: >-
                            Trạng thái tác vụ, thường là `queued`, `running`,
                            `succeeded`, `failed`.
                        content:
                          type: object
                          properties:
                            video_url:
                              type: string
                              description: Địa chỉ kết quả video.
                        video_url:
                          type: string
                          description: Địa chỉ kết quả video.
                        error:
                          type: string
                          description: Thông báo lỗi khi thất bại.
                        progress:
                          type: string
                          description: Tiến độ tác vụ.
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |-
        Sử dụng xác thực Bearer Token.
        Định dạng: `Authorization: Bearer sk-xxxxxx`

````