> ## 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.

# doubao-seedance-1-0-pro 動画生成

>  - 非同期処理モード、後続のクエリ用にタスクIDを返却
- テキストから動画、画像から動画（最初のフレーム/最後のフレーム）をサポート
- 横向き、縦向き、正方形の複数のアスペクト比をサポート 

<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-1-0-pro-fast",
      "prompt": "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
      "duration": 5,
      "aspect_ratio": "16:9",
      "resolution": "1080p"
    }'
  ```

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

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

  payload = {
      "model": "doubao-seedance-1-0-pro-fast",
      "prompt": "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
      "duration": 5,
      "aspect_ratio": "16:9",
      "resolution": "1080p"
  }

  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-1-0-pro-fast",
    prompt: "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
    duration: 5,
    aspect_ratio: "16:9",
    resolution: "720p"
  };

  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-1-0-pro-fast",
          "prompt":       "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
          "duration":     5,
          "aspect_ratio": "16:9",
          "resolution":   "720p",
      }

      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-1-0-pro-fast",
            "prompt": "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
            "duration": 5,
            "aspect_ratio": "16:9",
            "resolution": "1080p"
          }
          """;

          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-1-0-pro-fast",
      "prompt" => "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
      "duration" => 5,
      "aspect_ratio" => "16:9",
      "resolution" => "720p"
  ];

  $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-1-0-pro-fast",
    prompt: "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
    duration: 5,
    aspect_ratio: "16:9",
    resolution: "720p"
  }

  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-1-0-pro-fast",
      "prompt": "太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目",
      "duration": 5,
      "aspect_ratio": "16:9",
      "resolution": "1080p"
  ]

  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-1-0-pro-fast"",
              ""prompt"": ""太陽の光の中で遊ぶかわいい子猫、ふわふわの毛、明るい目"",
              ""duration"": 5,
              ""aspect_ratio"": ""16:9"",
              ""resolution"": ""720p""
          }";

          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_01K8SGYNNNVBQTXNR4MM964S7K"
      }
    ]
  }
  ```

  ```json 400 theme={null}
  {
    "error": {
      "code": 400,
      "message": "リクエストパラメータが無効です",
      "type": "invalid_request_error"
    }
  }
  ```

  ```json 401 theme={null}
  {
    "error": {
      "code": 401,
      "message": "認証に失敗しました。APIキーを確認してください",
      "type": "authentication_error"
    }
  }
  ```

  ```json 402 theme={null}
  {
    "error": {
      "code": 402,
      "message": "残高が不足しています。チャージしてください",
      "type": "payment_required"
    }
  }
  ```

  ```json 429 theme={null}
  {
    "error": {
      "code": 429,
      "message": "リクエストが多すぎます。後でもう一度お試しください",
      "type": "rate_limit_error"
    }
  }
  ```

  ```json 500 theme={null}
  {
    "error": {
      "code": 500,
      "message": "サーバー内部エラー。後でもう一度お試しください",
      "type": "server_error"
    }
  }
  ```
</ResponseExample>

## 認証

<ParamField header="Authorization" type="string" required>
  すべてのAPIエンドポイントにはBearer Token認証が必要です

  APIキーの取得：

  [APIキー管理ページ](https://apimart.ai/keys)にアクセスしてAPIキーを取得してください

  リクエストヘッダーに追加：

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

## リクエストパラメータ

<ParamField body="model" type="string" required>
  動画生成モデル名

  サポートされているモデル：

  * `doubao-seedance-1-0-pro-fast` - 高速版、素早い生成、プレビューや反復に適しています
  * `doubao-seedance-1-0-pro-quality` - 高品質版、生成時間が長い、画質がより良い
</ParamField>

<ParamField body="prompt" type="string" required>
  動画内容の説明

  シーン、アクション、スタイルなどを詳しく説明すると、より良い生成結果が得られます

  例：`"ビーチの夕日、海面に金色の太陽光、砂浜を優しく打つ波"`
</ParamField>

<ParamField body="duration" type="integer" default="5">
  動画の長さ（秒）

  サポート範囲：`2` \~ `12` 秒

  デフォルト：`5`
</ParamField>

<ParamField body="aspect_ratio" type="string" default="16:9">
  動画のアスペクト比

  選択肢：

  * `16:9` - 横向き
  * `9:16` - 縦向き
  * `1:1` - 正方形
  * `4:3` - 伝統的な比率
  * `3:4` - 縦向き伝統的な比率
  * `21:9` - ウルトラワイド

  デフォルト：`16:9`
</ParamField>

<ParamField body="resolution" type="string" default="1080p">
  動画の解像度

  選択肢：

  * `480p` - 標準画質
  * `720p` - HD
  * `1080p` - フルHD

  デフォルト：`1080p`
</ParamField>

<ParamField body="seed" type="integer">
  生成コンテンツのランダム性を制御するためのシード整数

  値の範囲：`-1` ～ `2^32-1` の整数

  <Note>
    * 同じリクエストで、モデルが異なる seed 値を受け取った場合（例：seed を指定しない、または seed を -1 に設定するとランダムな数値が使用されます）、異なる結果が生成されます
    * 同じリクエストで、モデルが同じ seed 値を受け取った場合、類似した結果が生成されますが、完全に一致することは保証されません
  </Note>
</ParamField>

## 解像度とアスペクト比の組み合わせ

| 解像度   | サポートされるアスペクト比                   | 備考      |
| ----- | ------------------------------- | ------- |
| 480p  | 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 | すべてサポート |
| 720p  | 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 | すべてサポート |
| 1080p | 16:9, 4:3, 1:1, 3:4, 9:16, 21:9 | すべてサポート |

<ParamField body="image_with_roles" type="array">
  より細かい制御のためのロール付き画像配列

  <Expandable title="フィールド説明">
    <ParamField body="url" type="string" required>
      画像URLアドレス
    </ParamField>

    <ParamField body="role" type="string" required>
      画像の役割

      選択肢：

      * `first_frame` - 最初のフレーム画像、動画の開始フレームとして（1枚のみ対応）
      * `last_frame` - 最後のフレーム画像、動画の終了フレームとして（quality版のみ対応、1枚のみ対応）
    </ParamField>
  </Expandable>

  例：

  ```json theme={null}
  [
    {"url": "https://example.com/start.png", "role": "first_frame"},
    {"url": "https://example.com/end.png", "role": "last_frame"}
  ]
  ```

  <Warning>
    * 各ロールの画像は1枚のみ対応
    * `last_frame`（最終フレーム画像）は `doubao-seedance-1-0-pro-quality` 版のみ対応、fast版は最初と最後のフレームの同時使用に対応していません
  </Warning>
</ParamField>

## レスポンス

<ResponseField name="code" type="integer">
  レスポンスステータスコード、成功時は200
</ResponseField>

<ResponseField name="data" type="array">
  レスポンスデータ配列

  <Expandable title="配列要素">
    <ResponseField name="status" type="string">
      タスク状態、初期送信時は `submitted`
    </ResponseField>

    <ResponseField name="task_id" type="string">
      タスク状態と結果をクエリするための一意のタスク識別子
    </ResponseField>
  </Expandable>
</ResponseField>

## 使用シナリオ

### シナリオ 1：横向きプレビュー動画の高速生成

```json theme={null}
{
  "model": "doubao-seedance-1-0-pro-fast",
  "prompt": "ビーチの夕日、海面に金色の太陽光、砂浜を優しく打つ波"
}
```

### シナリオ 2：高品質縦向きショート動画

```json theme={null}
{
  "model": "doubao-seedance-1-0-pro-quality",
  "prompt": "桜の木の下で回転する女の子、風に舞う花びら",
  "duration": 5,
  "aspect_ratio": "9:16",
  "resolution": "1080p"
}
```

### シナリオ 3：ダイナミックトランジション効果（最初/最後のフレーム）

```json theme={null}
{
  "model": "doubao-seedance-1-0-pro-quality",
  "prompt": "シーンが昼から夜へ移行、街の灯りが徐々に点灯",
  "image_with_roles": [
    {"url": "https://example.com/day.png", "role": "first_frame"},
    {"url": "https://example.com/night.png", "role": "last_frame"}
  ],
  "duration": 5
}
```

<Note>
  **タスク結果のクエリ**

  動画生成は非同期タスクで、送信時に `task_id` が返されます。[タスク状態取得](/ja/api-reference/tasks/status) エンドポイントを使用して、生成の進行状況と結果をクエリしてください。
</Note>
