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

# Pembuatan Video doubao-seedance-2.0

>  - Mode pemrosesan asinkron, mengembalikan ID tugas untuk kueri berikutnya
- Mendukung teks-ke-video, gambar-ke-video (frame pertama/frame terakhir)
- Mendukung video referensi, audio referensi, dan video dengan audio
- Mendukung rasio aspek lanskap, potret, persegi, ultra-wide, dan adaptif 

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://api.apimart.ai/v1/videos/generations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "doubao-seedance-2.0",
      "prompt": "A kitten yawning at the camera",
      "resolution": "720p",
      "size": "16:9",
      "duration": 5,
      "generate_audio": true
    }'
  ```

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

  url = "https://api.apimart.ai/v1/videos/generations"

  payload = {
      "model": "doubao-seedance-2.0",
      "prompt": "A kitten yawning at the camera",
      "resolution": "720p",
      "size": "16:9",
      "duration": 5,
      "generate_audio": True
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://api.apimart.ai/v1/videos/generations";

  const payload = {
    model: "doubao-seedance-2.0",
    prompt: "A kitten yawning at the camera",
    resolution: "720p",
    size: "16:9",
    duration: 5,
    generate_audio: true
  };

  const headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error('Error:', error));
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://api.apimart.ai/v1/videos/generations"

      payload := map[string]interface{}{
          "model":          "doubao-seedance-2.0",
          "prompt":         "A kitten yawning at the camera",
          "resolution":     "720p",
          "size":           "16:9",
          "duration":       5,
          "generate_audio": true,
      }

      jsonData, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
      req.Header.Set("Authorization", "Bearer <token>")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, err := client.Do(req)
      if err != nil {
          panic(err)
      }
      defer resp.Body.Close()

      body, _ := ioutil.ReadAll(resp.Body)
      fmt.Println(string(body))
  }
  ```

  ```java Java theme={null}
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;
  import java.net.URI;

  public class Main {
      public static void main(String[] args) throws Exception {
          String url = "https://api.apimart.ai/v1/videos/generations";

          String payload = """
          {
            "model": "doubao-seedance-2.0",
            "prompt": "A kitten yawning at the camera",
            "resolution": "720p",
            "size": "16:9",
            "duration": 5,
            "generate_audio": true
          }
          """;

          HttpClient client = HttpClient.newHttpClient();
          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create(url))
              .header("Authorization", "Bearer <token>")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(payload))
              .build();

          HttpResponse<String> response = client.send(request,
              HttpResponse.BodyHandlers.ofString());

          System.out.println(response.body());
      }
  }
  ```

  ```php PHP theme={null}
  <?php

  $url = "https://api.apimart.ai/v1/videos/generations";

  $payload = [
      "model" => "doubao-seedance-2.0",
      "prompt" => "A kitten yawning at the camera",
      "resolution" => "720p",
      "size" => "16:9",
      "duration" => 5,
      "generate_audio" => true
  ];

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
  curl_setopt($ch, CURLOPT_HTTPHEADER, [
      "Authorization: Bearer <token>",
      "Content-Type: application/json"
  ]);

  $response = curl_exec($ch);
  curl_close($ch);

  echo $response;
  ?>
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  url = URI("https://api.apimart.ai/v1/videos/generations")

  payload = {
    model: "doubao-seedance-2.0",
    prompt: "A kitten yawning at the camera",
    resolution: "720p",
    size: "16:9",
    duration: 5,
    generate_audio: true
  }

  http = Net::HTTP.new(url.host, url.port)
  http.use_ssl = true

  request = Net::HTTP::Post.new(url)
  request["Authorization"] = "Bearer <token>"
  request["Content-Type"] = "application/json"
  request.body = payload.to_json

  response = http.request(request)
  puts response.body
  ```

  ```swift Swift theme={null}
  import Foundation

  let url = URL(string: "https://api.apimart.ai/v1/videos/generations")!

  let payload: [String: Any] = [
      "model": "doubao-seedance-2.0",
      "prompt": "A kitten yawning at the camera",
      "resolution": "720p",
      "size": "16:9",
      "duration": 5,
      "generate_audio": true
  ]

  var request = URLRequest(url: url)
  request.httpMethod = "POST"
  request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
  request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  request.httpBody = try? JSONSerialization.data(withJSONObject: payload)

  let task = URLSession.shared.dataTask(with: request) { data, response, error in
      if let error = error {
          print("Error: \(error)")
          return
      }

      if let data = data, let responseString = String(data: data, encoding: .utf8) {
          print(responseString)
      }
  }

  task.resume()
  ```

  ```csharp C# theme={null}
  using System;
  using System.Net.Http;
  using System.Text;
  using System.Threading.Tasks;

  class Program
  {
      static async Task Main(string[] args)
      {
          var url = "https://api.apimart.ai/v1/videos/generations";

          var payload = @"{
              ""model"": ""doubao-seedance-2.0"",
              ""prompt"": ""A kitten yawning at the camera"",
              ""resolution"": ""720p"",
              ""size"": ""16:9"",
              ""duration"": 5,
              ""generate_audio"": true
          }";

          using var client = new HttpClient();
          client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");

          var content = new StringContent(payload, Encoding.UTF8, "application/json");
          var response = await client.PostAsync(url, content);
          var result = await response.Content.ReadAsStringAsync();

          Console.WriteLine(result);
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 200,
    "data": [
      {
        "status": "submitted",
        "task_id": "task_01KMCGF6BQGN3X28H3KSR50X5T"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "Invalid request parameters",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "Authentication failed, please check your API key",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "Insufficient account balance, please top up and try again",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "Too many requests, please try again later",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "Internal server error, please try again later",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## Autentikasi

<ParamField header="Authorization" type="string" required>
  Semua endpoint API memerlukan autentikasi Bearer Token

  Dapatkan API Key Anda:

  Kunjungi [Halaman Manajemen API Key](https://apimart.ai/keys) untuk mendapatkan API Key Anda

  Tambahkan ke header request:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Parameter Request

<ParamField body="model" type="string" required>
  Nama model pembuatan video

  Model yang didukung:

  * `doubao-seedance-2.0` - Versi standar, mendukung teks-ke-video, gambar-ke-video, video frame pertama/terakhir, video referensi, audio referensi, dan video dengan audio
  * `doubao-seedance-2.0-fast` - Versi cepat, fitur sama seperti versi standar dengan kecepatan pembuatan lebih tinggi
  * `doubao-seedance-2.0-mini` - Versi mini, fitur sama seperti versi standar
</ParamField>

<ParamField body="prompt" type="string">
  Deskripsi konten video

  Wajib untuk teks-ke-video; opsional untuk gambar-ke-video atau video-referensi-ke-video

  Disarankan untuk menentukan subjek, aksi, gerakan kamera, dan gaya dengan jelas agar hasil pembuatan lebih baik

  <Warning>
    * Prompt dibatasi hingga 4000 karakter, tetapi 500 karakter direkomendasikan.
    * Model `doubao-seedance-2.0-mini` tidak memiliki batasan jumlah karakter. Rekomendasi: prompt dalam bahasa Tionghoa sebaiknya tidak lebih dari 500 karakter dan prompt dalam bahasa Inggris tidak lebih dari 1000 kata. Teks yang terlalu panjang cenderung membuat informasi tersebar, dan model dapat mengabaikan detail serta hanya fokus pada poin utama, sehingga menyebabkan beberapa elemen hilang dalam video.
  </Warning>

  Contoh: `"A kitten yawning at the camera"`
</ParamField>

<ParamField body="duration" type="integer" default="5">
  Durasi video (detik)

  Rentang yang didukung: `4` hingga `15` detik

  Default: `5`
</ParamField>

<ParamField body="size" type="string" default="16:9">
  Rasio aspek video

  Opsi:

  * `16:9` - Lanskap
  * `9:16` - Potret
  * `1:1` - Persegi
  * `4:3` - Rasio tradisional
  * `3:4` - Rasio tradisional vertikal
  * `21:9` - Ultra-wide
  * `adaptif` - Adaptif (secara otomatis menyesuaikan dengan gambar/video input)

  Default: `16:9`
</ParamField>

<ParamField body="resolution" type="string" default="720p">
  Resolusi video

  Opsi:

  * `480p` - Definisi standar
  * `720p` - Definisi tinggi
  * `1080p` - Full HD (hanya didukung oleh `doubao-seedance-2.0`)
  * `4k` - Ultra HD (hanya didukung oleh `doubao-seedance-2.0`)

  Default: `720p`
</ParamField>

<ParamField body="seed" type="integer">
  Seed acak untuk mengontrol keacakan konten yang dibuat

  <Note>
    * Dengan request yang sama, nilai seed yang berbeda akan menghasilkan hasil berbeda
    * Dengan request yang sama, nilai seed yang sama akan menghasilkan hasil mirip, tetapi konsistensi persis tidak dijamin
  </Note>
</ParamField>

<ParamField body="generate_audio" type="boolean" default="true">
  Apakah membuat audio (video dengan audio)

  Saat disetel ke `true`, video akan menyertakan audio pengiring yang dibuat AI

  Default: `true`
</ParamField>

<ParamField body="return_last_frame" type="boolean" default="false">
  Apakah mengembalikan gambar frame terakhir

  Saat disetel ke `true`, hasil tugas juga akan mengembalikan URL gambar frame terakhir video, yang dapat digunakan untuk pembuatan video berkelanjutan

  Default: `false`
</ParamField>

<ParamField body="tools" type="array<object>">
  Daftar tool untuk kemampuan tambahan seperti web search

  Contoh: `[{"type": "web_search"}]`

  <Expandable title="Deskripsi Field">
    <ParamField body="type" type="string" required>
      Jenis tool

      Opsi:

      * `web_search` - Web search, merujuk informasi online selama pembuatan
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="image_urls" type="array<string>">
  Array URL gambar untuk gambar-ke-video

  Mendukung dua format:

  * URL gambar reguler: `https://example.com/cat.jpg`
  * Asset URL (aset yang disetujui): `asset://asset_a`

  Contoh: `["https://example.com/cat.jpg"]` atau `["asset://asset_a"]`

  <Note>
    Asset URL hanya didukung oleh model `doubao-seedance-2.0` dan `doubao-seedance-2.0-fast`. Model lain tidak mendukungnya.
  </Note>

  <Warning>
    * `image_urls` dan `image_with_roles` tidak dapat digunakan bersamaan
    * Maximum of 9 reference images
  </Warning>
</ParamField>

<ParamField body="image_with_roles" type="array">
  Array gambar dengan role, mendukung penentuan frame pertama/frame terakhir

  <Note>
    Jika field `url` menggunakan Asset URL, hanya model `doubao-seedance-2.0` dan `doubao-seedance-2.0-fast` yang didukung. Model lain tidak mendukungnya.
  </Note>

  <Expandable title="Deskripsi Field">
    <ParamField body="url" type="string" required>
      URL gambar

      Mendukung dua format:

      * URL gambar reguler: `https://example.com/day.jpg`
      * Asset URL (aset yang disetujui): `asset://asset_a`

      <Note>
        Asset URL hanya didukung oleh model `doubao-seedance-2.0` dan `doubao-seedance-2.0-fast`. Model lain tidak mendukungnya.
      </Note>
    </ParamField>

    <ParamField body="role" type="string" required>
      Role gambar

      Opsi:

      * `first_frame` - First frame image, used as the video's starting frame
      * `last_frame` - Last frame image, used as the video's ending frame
      * `reference_image` - Reference potret image (used with Asset URL)
    </ParamField>
  </Expandable>

  Contoh:

  ```json theme={null}
  [
    {"url": "https://example.com/day.jpg", "role": "first_frame"},
    {"url": "https://example.com/night.jpg", "role": "last_frame"}
  ]
  ```

  Format Asset URL:

  ```json theme={null}
  [
    {"url": "asset://asset_a", "role": "reference_image"}
  ]
  ```

  <Warning>
    * `image_urls` dan `image_with_roles` tidak dapat digunakan bersamaan
    * Saat menggunakan gambar frame pertama/frame terakhir, `video_urls` dan `audio_urls` tidak tersedia
  </Warning>
</ParamField>

<ParamField body="video_urls" type="array<string>">
  Array URL video referensi

  Mendukung dua format:

  * URL video reguler: `https://example.com/reference.mp4`
  * Asset URL (aset yang disetujui): `asset://asset_a`

  Contoh: `["https://example.com/reference.mp4"]` atau `["asset://asset_a"]`

  <Note>
    Asset URL hanya didukung oleh model `doubao-seedance-2.0` dan `doubao-seedance-2.0-fast`. Model lain tidak mendukungnya.
  </Note>

  <Warning>
    * Saat menggunakan gambar frame pertama/frame terakhir (`image_with_roles`), video referensi tidak tersedia
    * Maksimum 3 video referensi, 1.8s \< total durasi \< 15.2s
    * Resolusi video referensi harus antara 480P dan 720P
    * Video referensi tidak boleh berisi orang nyata
  </Warning>
</ParamField>

<ParamField body="audio_urls" type="array<string>">
  Array URL audio referensi

  Mendukung dua format:

  * URL audio reguler: `https://example.com/speech.wav`
  * Asset URL (aset yang disetujui): `asset://asset_a`

  Contoh: `["https://example.com/speech.wav"]` atau `["asset://asset_a"]`

  <Note>
    Asset URL hanya didukung oleh model `doubao-seedance-2.0` dan `doubao-seedance-2.0-fast`. Model lain tidak mendukungnya.
  </Note>

  <Warning>
    * Saat menggunakan gambar frame pertama/frame terakhir (`image_with_roles`), audio referensi tidak tersedia
    * Maksimum 3 file audio referensi, total durasi harus 15 dtk atau kurang
    * Audio referensi harus digunakan bersama gambar referensi atau video referensi
  </Warning>
</ParamField>

## Respons

<ResponseField name="code" type="integer">
  Kode status respons, 200 jika berhasil
</ResponseField>

<ResponseField name="data" type="array">
  Array data respons

  <Expandable title="Elemen Array">
    <ResponseField name="status" type="string">
      Status tugas, `submitted` saat pertama kali dikirim
    </ResponseField>

    <ResponseField name="task_id" type="string">
      Pengidentifikasi tugas unik untuk mengueri status dan hasil tugas
    </ResponseField>
  </Expandable>
</ResponseField>

## Kasus Penggunaan

### Kasus 1: Teks-ke-Video

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "A kitten yawning at the camera",
  "resolution": "720p",
  "size": "16:9",
  "duration": 5,
  "seed": 42,
  "generate_audio": true
}
```

### Kasus 2: Gambar-ke-Video (Frame Pertama)

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "The kitten stands up and walks toward the camera",
  "image_urls": ["https://example.com/cat.jpg"],
  "duration": 5
}
```

### Kasus 3: Video Frame Pertama/Terakhir

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "Transition from day to night",
  "image_with_roles": [
    {"url": "https://example.com/day.jpg", "role": "first_frame"},
    {"url": "https://example.com/night.jpg", "role": "last_frame"}
  ],
  "duration": 5
}
```

### Kasus 4: Video-Referensi-ke-Video

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "Convert the video style to anime style",
  "video_urls": ["https://example.com/reference.mp4"]
}
```

### Kasus 5: Video Referensi + Audio Referensi

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "A scene of a person speaking",
  "video_urls": ["https://example.com/reference.mp4"],
  "audio_urls": ["https://example.com/speech.wav"],
  "size": "16:9",
  "duration": 11
}
```

### Kasus 6: Video dengan Audio

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "A man stops a woman and says: \"Remember, you must never point your finger at the moon.\"",
  "generate_audio": true
}
```

### Kasus 7: Pembuatan Video Berkelanjutan (Mengembalikan Frame Terakhir)

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "The kitten continues walking toward the camera",
  "image_urls": ["https://example.com/last_frame_from_prev.png"],
  "return_last_frame": true
}
```

### Kasus 8: Pembuatan Versi Cepat

```json theme={null}
{
  "model": "doubao-seedance-2.0-fast",
  "prompt": "City nightscape timelapse photography",
  "size": "21:9",
  "duration": 8
}
```

### Kasus 9: Gambar Referensi + Video Referensi + Audio Referensi (Video Multimodal)

Gabungkan gambar referensi, video referensi, dan audio referensi untuk menghasilkan video iklan perspektif orang pertama yang imersif. Ideal untuk promosi produk, iklan brand, dan skenario lain yang memerlukan fusi materi dari beberapa sumber.

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "Use video 1's first-person perspective throughout, and use audio 1 as the background music throughout. First-person POV fruit tea advertisement for seedance brand 'Peace Apple' apple fruit tea limited edition. First frame is image 1: your hand picks a dewy Aksu red apple with a crisp apple collision sound. 2-4s: quick cut, your hand drops apple chunks into a shaker cup, adds ice and tea base, shakes vigorously, ice collision and shaking sounds sync with upbeat drum beats, background voice: 'Fresh-cut, fresh-shaken'. 4-6s: first-person close-up of the finished product, layered fruit tea poured into a clear cup, your hand gently squeezes cream cap spreading on top, sticks a pink label on the cup, camera zooms in on the layered texture of cream cap and fruit tea. 6-8s: first-person handheld cup raise, you lift the fruit tea from image 2 toward the camera (simulating handing it to the viewer), cup label clearly visible, background voice 'Take a sip of freshness', final frame freezes on image 2. Background voice consistently uses a female tone.",
  "image_urls": [
    "https://example.com/tea_pic1.jpg",
    "https://example.com/tea_pic2.jpg"
  ],
  "video_urls": ["https://example.com/tea_video1.mp4"],
  "audio_urls": ["https://example.com/tea_audio1.mp3"],
  "generate_audio": true,
  "size": "16:9",
  "duration": 11
}
```

### Kasus 10: Gambar-ke-Video dengan Asset URL

Aset avatar virtual yang disetujui dapat diteruskan langsung sebagai gambar referensi tanpa perlu diunggah ulang atau direview ulang.

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "The character walks naturally on a city street under bright sunshine",
  "image_urls": ["asset://asset_a"],
  "duration": 5,
  "resolution": "720p"
}
```

### Kasus 11: Tentukan Potret Referensi dengan Asset URL (image\_with\_roles)

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "Using the reference portrait, the character walks elegantly toward the camera",
  "image_with_roles": [
    {
      "url": "asset://asset_a",
      "role": "reference_image"
    }
  ],
  "resolution": "720p",
  "duration": 5
}
```

### Kasus 12: Versi Cepat + Gambar-ke-Video Asset URL

```json theme={null}
{
  "model": "doubao-seedance-2.0-fast",
  "prompt": "The character strolls in a park with a gentle breeze",
  "image_urls": ["asset://asset_a"],
  "duration": 5,
  "resolution": "720p"
}
```

### Kasus 13: Gambar Asset URL + Video Referensi (Transfer Gerakan)

Gabungkan aset potret yang disetujui dengan video referensi untuk menggerakkan karakter melakukan gerakan tertentu.

```json theme={null}
{
  "model": "doubao-seedance-2.0",
  "prompt": "The character dances to the rhythm of the reference video with smooth and natural movements",
  "image_urls": ["https://example.com/dance_reference.jpg", "asset://asset_a"],
  "video_urls": ["https://example.com/dance_reference.mp4", "asset://asset_a"],
  "duration": 8,
  "resolution": "720p"
}
```

<Note>
  **Kueri Hasil Tugas**

  Pembuatan video adalah tugas asinkron yang mengembalikan `task_id` saat dikirim. Gunakan endpoint [Dapatkan Status Tugas](/id/api-reference/tasks/status) untuk mengueri progres dan hasil pembuatan.
</Note>

## Perbedaan dari Versi 1.5 Pro

| Fitur                 | 1.5 Pro                           | 2.0 / 2.0 fast                                  |
| --------------------- | --------------------------------- | ----------------------------------------------- |
| Resolusi              | 480p/720p/1080p                   | **480p/720p/1080p/4k** (fast hanya 480p/720p)   |
| Rentang durasi        | 4-12s                             | **5-15s**                                       |
| Durasi default        | 5s                                | **5s**                                          |
| Parameter rasio aspek | `aspect_ratio`                    | **`size`** (opsi `adaptive` baru)               |
| Pembuatan audio       | parameter `audio`                 | **parameter `generate_audio`**                  |
| Video referensi       | Tidak didukung                    | **Didukung melalui `video_urls`**               |
| Audio referensi       | Tidak didukung                    | **Didukung melalui `audio_urls`**               |
| Gambar-ke-video       | `image_urls` / `image_with_roles` | **`image_urls` / `image_with_roles`**           |
| Video dengan audio    | Tidak didukung                    | **Didukung melalui `generate_audio`**           |
| Video berkelanjutan   | Tidak didukung                    | **Didukung melalui `return_last_frame`**        |
| Versi cepat           | Tidak didukung                    | **Didukung melalui `doubao-seedance-2.0-fast`** |
