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

# Seedance動画を作成

> <ul><li>ElkAPI 経由で Doubao Seedance 2.0 の動画生成を呼び出します。</li><li>非同期タスクエンドポイントです。送信後にタスクIDを返します。</li><li>Seedance公式パラメーターは metadata に入れて透過転送してください。</li></ul>

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/video/generations' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "doubao-seedance-2-0-260128",
      "prompt": "一人称視点のフルーツティー広告。手でリンゴを摘み、切りたてをシェイクし、完成品をクローズアップ。映画的、高精細",
      "metadata": {
        "duration": 8,
        "ratio": "16:9",
        "resolution": "720p",
        "generate_audio": true,
        "watermark": false
      }
    }'
  ```

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

  url = "https://api.elkapi.com/v1/video/generations"
  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }
  payload = {
      "model": "doubao-seedance-2-0-260128",
      "prompt": "一人称視点のフルーツティー広告。手でリンゴを摘み、切りたてをシェイクし、完成品をクローズアップ。映画的、高精細",
      "metadata": {
          "duration": 8,
          "ratio": "16:9",
          "resolution": "720p",
          "generate_audio": True,
          "watermark": False
      }
  }

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

  ```javascript JavaScript theme={null} theme={null}
  const response = await fetch("https://api.elkapi.com/v1/video/generations", {
    method: "POST",
    headers: {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "doubao-seedance-2-0-260128",
      prompt: "一人称視点のフルーツティー広告。手でリンゴを摘み、切りたてをシェイクし、完成品をクローズアップ。映画的、高精細",
      metadata: {
        duration: 8,
        ratio: "16:9",
        resolution: "720p",
        generate_audio: true,
        watermark: false
      }
    })
  });

  console.log(await response.json());
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null} theme={null}
  {
    "id": "task_abc123",
    "task_id": "task_abc123",
    "object": "video",
    "model": "doubao-seedance-2-0-260128",
    "status": "queued",
    "progress": 0,
    "created_at": 1760000000
  }
  ```

  ```json 400 theme={null} theme={null}
  {
    "error": {
      "message": "prompt is required",
      "type": "invalid_request_error",
      "param": "prompt",
      "code": "invalid_request"
    }
  }
  ```
</ResponseExample>

## Authorizations

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

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

## Body

<ParamField body="model" type="string" required default="doubao-seedance-2-0-260128">
  SeedanceモデルID。

  利用可能な値:`doubao-seedance-2-0-260128`、`doubao-seedance-2-0-fast-260128`
</ParamField>

<ParamField body="prompt" type="string" required>
  テキストプロンプト。現在のアダプターはこのフィールドを最終的な `content` テキスト項目として上流へ送信します。
</ParamField>

<ParamField body="images" type="array<string>">
  画像URLまたはBase64文字列の配列です。`role` を指定する必要がある場合は、`metadata.content` の使用を推奨します。
</ParamField>

<ParamField body="seconds" type="string">
  動画の長さ（秒）。指定すると `metadata.duration` を上書きします。
</ParamField>

<ParamField body="metadata" type="object">
  Seedance上流へ透過転送するパラメーターオブジェクトです。Seedance公式フィールドはここに入れてください。
</ParamField>

<ParamField body="metadata.duration" type="integer">
  動画の長さ。Seedance 2.0 では通常 `4`〜`15` 秒です。上流が対応していれば `-1` も渡せます。
</ParamField>

<ParamField body="metadata.ratio" type="string">
  動画のアスペクト比。

  例:`16:9`、`4:3`、`1:1`、`3:4`、`9:16`、`21:9`、`adaptive`
</ParamField>

<ParamField body="metadata.resolution" type="string">
  解像度。

  例:`480p`、`720p`、`1080p`
</ParamField>

<ParamField body="metadata.generate_audio" type="boolean">
  音声を生成するかどうか。
</ParamField>

<ParamField body="metadata.watermark" type="boolean">
  ウォーターマークを追加するかどうか。
</ParamField>

<ParamField body="metadata.seed" type="integer">
  ランダムシード。
</ParamField>

<ParamField body="metadata.content" type="array<object>">
  マルチモーダル参照コンテンツです。`image_url`、`video_url`、`audio_url` に対応します。テキスト内容にはトップレベルの `prompt` を使用してください。

  ```json theme={null}
  [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://example.com/reference.png"
      },
      "role": "reference_image"
    },
    {
      "type": "video_url",
      "video_url": {
        "url": "https://example.com/reference.mp4"
      },
      "role": "reference_video"
    },
    {
      "type": "audio_url",
      "audio_url": {
        "url": "https://example.com/reference.mp3"
      },
      "role": "reference_audio"
    }
  ]
  ```
</ParamField>

## マルチモーダル例

<RequestExample>
  ```bash cURL theme={null} theme={null}
  curl --request POST \
    --url 'https://api.elkapi.com/v1/video/generations' \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "doubao-seedance-2-0-260128",
      "prompt": "参照動画の一人称構図を全編で使用し、参照音声をBGMとして使って、フルーツティー広告を生成する",
      "metadata": {
        "duration": 11,
        "ratio": "16:9",
        "generate_audio": true,
        "watermark": false,
        "content": [
          {
            "type": "image_url",
            "image_url": {
              "url": "https://example.com/first-frame.jpg"
            },
            "role": "reference_image"
          },
          {
            "type": "video_url",
            "video_url": {
              "url": "https://example.com/reference.mp4"
            },
            "role": "reference_video"
          },
          {
            "type": "audio_url",
            "audio_url": {
              "url": "https://example.com/music.mp3"
            },
            "role": "reference_audio"
          }
        ]
      }
    }'
  ```
</RequestExample>

## Response

<ResponseField name="id" type="string">
  ElkAPIが返す公開タスクID。
</ResponseField>

<ResponseField name="task_id" type="string">
  互換フィールドです。値は `id` と同じです。
</ResponseField>

<ResponseField name="object" type="string">
  オブジェクトタイプ。`video` 固定です。
</ResponseField>

<ResponseField name="model" type="string">
  リクエストで使用したモデル。
</ResponseField>

<ResponseField name="status" type="string">
  タスク状態。送信成功後は通常 `queued` です。
</ResponseField>

<ResponseField name="created_at" type="integer">
  タスク作成タイムスタンプ。
</ResponseField>
