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

# MAGI-2 Reference-to-Video マルチモーダル参照動画生成

> - 参照画像（0〜10枚）+ 参照動画（0〜5本）+ 参照音声（0〜5本）+ テキストプロンプトで動画を生成
- 3種類の参照素材のうち少なくとも1つが必要で、自由に組み合わせ可能
- 非同期処理モード。返却されたタスクIDで[照会してください](/ja/api-manual/task-management/get-task-detail)
- 生成された動画リンクの有効期限は7日間です。お早めに保存してください



## OpenAPI

````yaml ja/api-manual/video-series/magi/magi-2/magi-2-reference-to-video.json POST /v1/videos/generations
openapi: 3.1.0
info:
  title: MAGI-2 Reference-to-Video API
  description: MAGI-2 マルチモーダル Reference-to-Video API。画像・動画・音声の参照素材を組み合わせた生成に対応
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.evolink.ai
    description: 本番環境
security:
  - bearerAuth: []
tags:
  - name: 動画生成
    description: AI動画生成関連API
paths:
  /v1/videos/generations:
    post:
      tags:
        - 動画生成
      summary: MAGI-2 Reference-to-Video マルチモーダル参照動画生成
      description: >-
        - 参照画像（0〜10枚）+ 参照動画（0〜5本）+ 参照音声（0〜5本）+ テキストプロンプトで動画を生成

        - 3種類の参照素材のうち少なくとも1つが必要で、自由に組み合わせ可能

        -
        非同期処理モード。返却されたタスクIDで[照会してください](/ja/api-manual/task-management/get-task-detail)

        - 生成された動画リンクの有効期限は7日間です。お早めに保存してください
      operationId: createMagi2ReferenceToVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerationRequest'
            examples:
              multimodal:
                summary: マルチモーダル参照（画像 + 動画 + 音声）
                value:
                  model: magi-2-reference-to-video
                  prompt: 参照動画のカメラワークとリズムに合わせて、画像のキャラクターが街のビルの屋上で踊る。参照音声のビートに同期させる
                  image_urls:
                    - https://example.com/character.jpg
                  video_urls:
                    - https://example.com/reference.mp4
                  audio_urls:
                    - https://example.com/bgm.mp3
                  duration: 10
                  quality: 1080p
                  aspect_ratio: '16:9'
                  generate_audio: true
              image_reference:
                summary: 複数画像の参照
                value:
                  model: magi-2-reference-to-video
                  prompt: 画像の2人のキャラクターがカフェで向かい合って座り、静かに話している
                  image_urls:
                    - https://example.com/ref1.jpg
                    - https://example.com/ref2.jpg
                  duration: 6
                  aspect_ratio: '4:3'
              audio_reference:
                summary: 音声の参照
                value:
                  model: magi-2-reference-to-video
                  prompt: ニュースキャスターがカメラに向かって朝のニュースを伝え、口の動きが音声と同期している
                  audio_urls:
                    - https://example.com/voice.wav
                  duration: 8
                  aspect_ratio: '16:9'
      responses:
        '200':
          description: 動画生成タスクの作成に成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResponse'
        '400':
          description: リクエストパラメータエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_request
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: 未認証、Tokenが無効または期限切れ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: unauthorized
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: クォータ不足、チャージが必要
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: insufficient_quota
                  message: Insufficient quota. Please top up your account.
                  type: insufficient_quota
        '403':
          description: アクセス権限なし
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: model_access_denied
                  message: >-
                    Token does not have access to model:
                    magi-2-reference-to-video
                  type: invalid_request_error
        '429':
          description: リクエスト頻度が上限を超過
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: rate_limit_exceeded
                  message: Too many requests, please try again later
                  type: rate_limit_error
        '500':
          description: サーバー内部エラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: internal_error
                  message: Internal server error
                  type: api_error
components:
  schemas:
    VideoGenerationRequest:
      type: object
      required:
        - model
      properties:
        model:
          type: string
          description: 動画生成モデル名
          enum:
            - magi-2-reference-to-video
          default: magi-2-reference-to-video
          example: magi-2-reference-to-video
        prompt:
          type: string
          description: 生成したい動画を説明するテキストプロンプト（任意）。中国語・英語に対応。プロンプトの最大長：15000 文字
          example: 参照動画のカメラワークとリズムに合わせて、画像のキャラクターが街のビルの屋上で踊る。参照音声のビートに同期させる
        image_urls:
          type: array
          items:
            type: string
            format: uri
          maxItems: 10
          example:
            - https://example.com/ref1.jpg
          description: >-
            参照画像 URL 配列、**0〜10 枚**


            **役割の説明：**


            | メディアタイプ | 役割 | 典型的な用途 |

            |---------|------|----------|

            | 画像 | `reference_image` | キャラクター参照、スタイル参照、商品画像 |


            **画像要件：**

            - 1枚あたりのサイズ：`30MB` 以内

            - HTTPS URL のみ対応。画像URLはサーバーから直接アクセス可能である必要があります


            **注意：** `image_urls`、`video_urls`、`audio_urls`
            のうち少なくとも1つを指定する必要があります
        video_urls:
          type: array
          items:
            type: string
            format: uri
          maxItems: 5
          example:
            - https://example.com/reference.mp4
          description: >-
            参照動画 URL 配列、**0〜5 本**


            **役割の説明：**


            | メディアタイプ | 役割 | 典型的な用途 |

            |---------|------|----------|

            | 動画 | `reference_video` | カメラワーク参照、動作参照、映像スタイル参照 |


            **動画要件：**

            - 対応フォーマット：`.mp4`、`.mov`

            - 1本あたりの動画時間：`2` 〜 `30` 秒、最大5本、全動画の合計時間 ≤ `30` 秒

            - 1本あたりのサイズ：`200MB` 以内

            - HTTPS URL のみ対応。動画URLはサーバーから直接アクセス可能である必要があります


            **注意：** `image_urls`、`video_urls`、`audio_urls`
            のうち少なくとも1つを指定する必要があります
        audio_urls:
          type: array
          items:
            type: string
            format: uri
          maxItems: 5
          example:
            - https://example.com/bgm.mp3
          description: >-
            参照音声 URL 配列、**0〜5 本**


            **役割の説明：**


            | メディアタイプ | 役割 | 典型的な用途 |

            |---------|------|----------|

            | 音声 | `reference_audio` | BGM、効果音、音声/セリフ参照 |


            **音声要件：**

            - 対応フォーマット：`.wav`、`.mp3`

            - 1本あたりの音声時間：`2` 〜 `30` 秒、最大5本、全音声の合計時間 ≤ `30` 秒

            - 1本あたりのサイズ：`15MB` 以内

            - HTTPS URL のみ対応。音声URLはサーバーから直接アクセス可能である必要があります


            **注意：** `image_urls`、`video_urls`、`audio_urls`
            のうち少なくとも1つを指定する必要があります
        duration:
          type: integer
          description: |-
            出力動画の再生時間（秒）、デフォルトは `5` 秒

            **説明：**
            - `4`〜`30` 秒の任意の整数値に対応
            - 再生時間は課金に直接影響します
          default: 5
          minimum: 4
          maximum: 30
          example: 8
        quality:
          type: string
          description: 動画の解像度。`1080p` のみ対応
          enum:
            - 1080p
          default: 1080p
          example: 1080p
        aspect_ratio:
          type: string
          description: |-
            動画のアスペクト比、デフォルトは `16:9`

            **選択可能な値：**
            - `16:9`（横向き）、`9:16`（縦向き）、`1:1`（正方形）、`4:3`、`3:4`、`21:9`（ウルトラワイド）
          enum:
            - '16:9'
            - '9:16'
            - '1:1'
            - '4:3'
            - '3:4'
            - '21:9'
          default: '16:9'
          example: '16:9'
        generate_audio:
          type: boolean
          description: |-
            同期音声を生成するかどうか、デフォルトは `true`

            **選択可能な値：**
            - `true`：動画に同期音声を含む、追加料金なし
            - `false`：無音動画を出力
          default: true
          example: true
        seed:
          type: integer
          description: |-
            ランダムシード。範囲は `0`〜`4294967295`

            **説明：**
            - 指定しない場合は毎回ランダムに生成されます
            - 他のパラメータが同じ場合、同じシードを使うと近い結果を再現しやすくなります
          minimum: 0
          maximum: 4294967295
          example: 42
        callback_url:
          type: string
          description: >-
            タスク完了後の HTTPS コールバックアドレス


            **コールバックタイミング：**

            - タスク完了（completed）、失敗（failed）、またはキャンセル（cancelled）時にトリガー

            - 課金確認完了後に送信


            **セキュリティ制限：**

            - HTTPS プロトコルのみ対応

            -
            プライベートIPアドレスへのコールバックは禁止（127.0.0.1、10.x.x.x、172.16-31.x.x、192.168.x.x
            など）

            - URL の長さは `2048` 文字以内


            **コールバックメカニズム：**

            - タイムアウト：`10` 秒

            - 失敗後最大 `3` 回リトライ（失敗後 `1`/`2`/`4` 秒でそれぞれリトライ）

            - コールバックレスポンスボディのフォーマットはタスク照会APIの返却フォーマットと同一

            - 2xx ステータスコードを成功とみなし、その他のステータスコードでリトライをトリガー
          format: uri
          example: https://your-domain.com/webhooks/video-task-completed
    VideoGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: タスク作成タイムスタンプ
          example: 1761313744
        id:
          type: string
          description: タスクID
          example: task-unified-1774857405-abc123
        model:
          type: string
          description: 実際に使用されたモデル名
          example: magi-2-reference-to-video
        object:
          type: string
          enum:
            - video.generation.task
          description: タスクの具体的なタイプ
        progress:
          type: integer
          description: タスク進捗パーセンテージ (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: タスクステータス
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
        task_info:
          $ref: '#/components/schemas/VideoTaskInfo'
          description: 動画タスクの詳細情報
        type:
          type: string
          enum:
            - text
            - image
            - audio
            - video
          description: タスクの出力タイプ
          example: video
        usage:
          $ref: '#/components/schemas/VideoUsage'
          description: 使用量と課金情報
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: エラーコード識別子
            message:
              type: string
              description: エラー説明情報
            type:
              type: string
              description: エラータイプ
    VideoTaskInfo:
      type: object
      properties:
        can_cancel:
          type: boolean
          description: >-
            タスクをキャンセルできるかどうか。MAGI-2 はユーザーによるタスクのキャンセルに対応していないため、常に `false`
            を返します。
          example: false
        estimated_time:
          type: integer
          description: 推定完了時間（秒）
          minimum: 0
          example: 165
        video_duration:
          type: integer
          description: 動画の再生時間（秒）
          example: 8
    VideoUsage:
      type: object
      description: 使用量と課金情報
      properties:
        billing_rule:
          type: string
          description: 課金ルール
          enum:
            - per_call
            - per_token
            - per_second
          example: per_second
        credits_reserved:
          type: number
          description: 推定消費クレジット数
          minimum: 0
          example: 50
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIはBearer Tokenによる認証が必要です##

        **APIキーの取得：**

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

        **リクエストヘッダーに以下を追加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.