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

# MAGI-2 Reference to Video

> The MAGI-2 Reference to Video API combines up to 10 reference images, 5 videos and 5 audio clips into a 4–30 second 1080p video with synchronized sound.

> [!TIP]
>
> 1. After submission, a `task_id` will be returned. If you provided a `callback_url`, when the task status becomes `finished` or `failed`, a POST request will be sent to the `callback_url`.
> 2. Regardless of whether `callback_url` is provided, you can retrieve the result through the unified [Query Task Status](https://docs.vidgo.ai/api-manual/task-management/status.md) endpoint.

MAGI-2 Reference to Video generates 4–30 second 1080p videos guided by any combination of reference images, reference video clips and reference audio clips—including reference audio on its own. Describe in `prompt` how each reference contributes to character identity, motion, voice or music.

For prompt-only generation use [MAGI-2 Text to Video](https://docs.vidgo.ai/api-manual/video-series/sand-ai-magi-2-text-to-video.md); for first-and-last-frame animation use [MAGI-2 Image to Video](https://docs.vidgo.ai/api-manual/video-series/sand-ai-magi-2-image-to-video.md).

## Models

* **sand-ai/magi-2/reference-to-video** — Multimodal reference-to-video generation at 1080p for 4–30 seconds with synchronized audio.

## Features

* Up to 10 reference images, 5 reference videos and 5 reference audio clips in one task.
* Flexible multimodal combinations: mix images, videos and audio, or provide reference audio on its own.
* 1080p video from 4 to 30 seconds across six aspect ratios (`16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`).
* Prompts up to 15,000 characters with synchronized dialogue, sound effects and ambience.

## Required parameters

* `prompt` (string): Describe how each reference is used, plus scene, motion, camera and sound, up to 15,000 characters.
* At least one of `reference_image_urls`, `reference_video_urls` or `reference_audio_urls` must be non-empty.

## Optional parameters

* `reference_image_urls` (string\[]): Up to 10 public HTTP(S) reference image URLs (JPG, PNG or WEBP).
* `reference_video_urls` (string\[]): Up to 5 public HTTP(S) MP4 or MOV video URLs (each 2–30 seconds, up to 30 seconds total).
* `reference_audio_urls` (string\[]): Up to 5 public HTTP(S) MP3 or WAV audio URLs (each 2–30 seconds, up to 30 seconds total).
* `duration` (integer): Length in whole seconds from `4` to `30`. Default `5`.
* `resolution` (string): `1080p`.
* `aspect_ratio` (string): `16:9` (default), `9:16`, `1:1`, `4:3`, `3:4` or `21:9`.
* `generate_audio` (boolean): `true` (default) generates synchronized audio; `false` returns a video-only file.
* `seed` (integer): Random seed from `0` to `2147483647`.

## Output

A finished task returns one MP4 file: H.264 video at 25 fps with an AAC stereo audio track when `generate_audio` is `true`.

## Examples

* **Character image + audio reference**: keep the character from a reference image while matching the melody from a reference audio clip for 8 seconds.
* **Audio-only reference**: drive a 5-second music scene using only `reference_audio_urls`.

## Notes

* Provide at least one non-empty reference list (`reference_image_urls`, `reference_video_urls` or `reference_audio_urls`). `image_urls` is not accepted on this endpoint and returns 400.
* All media URLs must be publicly accessible and directly downloadable.
* Credits are billed per second of `duration` at 1080p; reference media and `generate_audio` do not add extra charges. Failed tasks are refunded in full. See the [pricing page](https://vidgo.ai/apis/api-pricing) for current rates.


## OpenAPI

````yaml api-manual/video-series/sand-ai-magi-2-reference-to-video.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - MAGI-2 Reference to Video
  description: >-
    The MAGI-2 Reference to Video API combines up to 10 reference images, 5
    videos and 5 audio clips into a 4–30 second 1080p video with synchronized
    sound.
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - MAGI-2 Reference to Video
      summary: Submit MAGI-2 Reference to Video Task
      operationId: submitSandAiMagi2ReferenceToVideoTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              characterAudio:
                summary: Character image and audio reference
                value:
                  model: sand-ai/magi-2/reference-to-video
                  input:
                    prompt: >-
                      The musician from the reference image walks along a sunlit
                      boardwalk playing the melody from the reference audio.
                    reference_image_urls:
                      - https://example.com/character.jpg
                    reference_audio_urls:
                      - https://example.com/melody.mp3
                    duration: 8
                    aspect_ratio: '16:9'
              audioOnly:
                summary: Audio-only reference
                value:
                  model: sand-ai/magi-2/reference-to-video
                  input:
                    prompt: >-
                      A cellist performs under warm stage spotlights in time
                      with the reference audio.
                    reference_audio_urls:
                      - https://example.com/melody.mp3
                    duration: 5
                    aspect_ratio: '16:9'
      responses:
        '200':
          description: >-
            Task submission result. A task ID identifies asynchronous work;
            generation may still be running.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          example: sand-ai/magi-2/reference-to-video
        callback_url:
          type: string
          format: uri
          description: Optional webhook URL for completion or failure notifications.
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
          additionalProperties: false
          properties:
            prompt:
              type: string
              minLength: 1
              maxLength: 15000
              description: >-
                Scene, subjects, motion, camera and sound. Put spoken lines in
                quotes.
            duration:
              type: integer
              minimum: 4
              maximum: 30
              default: 5
              description: Video length in whole seconds from 4 to 30. Default 5.
            resolution:
              type: string
              enum:
                - 1080p
              default: 1080p
              description: Output resolution tier (1080p).
            aspect_ratio:
              type: string
              enum:
                - '16:9'
                - '9:16'
                - '1:1'
                - '4:3'
                - '3:4'
                - '21:9'
              default: '16:9'
              description: Output aspect ratio. Default 16:9.
            generate_audio:
              type: boolean
              default: true
              description: >-
                Generate synchronized audio (default true); false returns video
                only.
            seed:
              type: integer
              minimum: 0
              maximum: 2147483647
              description: Optional random seed from 0 to 2147483647.
            reference_image_urls:
              type: array
              maxItems: 10
              items:
                type: string
                format: uri
              description: >-
                Up to 10 public HTTP(S) reference image URLs (JPG, PNG or WEBP).
                Provide at least one reference array across image, video or
                audio.
            reference_video_urls:
              type: array
              maxItems: 5
              items:
                type: string
                format: uri
              description: >-
                Up to 5 public HTTP(S) MP4 or MOV reference video URLs (2–30
                seconds each, up to 30 seconds total).
            reference_audio_urls:
              type: array
              maxItems: 5
              items:
                type: string
                format: uri
              description: >-
                Up to 5 public HTTP(S) MP3 or WAV reference audio URLs (2–30
                seconds each, up to 30 seconds total). Can be used on its own.
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-example-001
            status:
              type: string
              example: not_started
            created_time:
              type: string
              format: date-time
              example: '2026-11-29T10:30:00'
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Error message. See [Error Codes](/api-manual/error-codes).
          example: prompt is required
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Use `Authorization: Bearer VIDGO_API_KEY`.'

````

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