> ## 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 Image to Video

> The MAGI-2 Image to Video API animates one opening frame or a first-and-last-frame pair into a 4–30 second 1080p video with synchronized audio.

> [!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 Image to Video turns a starting image—or both a starting frame and an ending frame—into a 4–30 second 1080p video with synchronized dialogue, sound effects and ambience. The output follows the aspect ratio of the first frame automatically.

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 multimodal references use [MAGI-2 Reference to Video](https://docs.vidgo.ai/api-manual/video-series/sand-ai-magi-2-reference-to-video.md).

## Models

* **sand-ai/magi-2/image-to-video** — First-frame and first-and-last-frame video generation at 1080p for 4–30 seconds with synchronized audio.

## Features

* Single opening frame or first-and-last-frame keyframe control (`1–2` images in `image_urls`).
* 1080p video from 4 to 30 seconds in one generation.
* Automatic aspect-ratio matching to the first input image.
* Synchronized dialogue, sound effects and ambience, with an option to disable audio.
* Prompts up to 15,000 characters and optional `seed`.

## Required parameters

* `prompt` (string): Motion, camera, action and sound instructions, up to 15,000 characters. Put spoken lines in quotes.
* `image_urls` (string\[]): One or two public HTTP(S) image URLs (JPG, PNG or WEBP). The first image sets the opening frame; an optional second image sets the closing frame.

## Optional parameters

* `duration` (integer): Length in whole seconds from `4` to `30`. Default `5`.
* `resolution` (string): `1080p`.
* `aspect_ratio` (string): `auto` (default). The output matches the first frame's aspect ratio.
* `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

* **First frame animation**: animate one opening frame for 5 seconds with camera motion and synchronized ambience.
* **First and last frame transition**: transition smoothly between two keyframes over 6 seconds.

## Notes

* `image_urls` must contain 1 or 2 publicly accessible HTTP(S) URLs; `aspect_ratio` accepts only `auto` (or omit it). Reference fields (`reference_*`) are rejected with 400.
* Credits are billed per second of `duration` at 1080p; `generate_audio` does not change the price. 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-image-to-video.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - MAGI-2 Image to Video
  description: >-
    The MAGI-2 Image to Video API animates one opening frame or a
    first-and-last-frame pair into a 4–30 second 1080p video with synchronized
    audio.
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - MAGI-2 Image to Video
      summary: Submit MAGI-2 Image to Video Task
      operationId: submitSandAiMagi2ImageToVideoTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              firstFrame:
                summary: Animate an opening frame
                value:
                  model: sand-ai/magi-2/image-to-video
                  input:
                    prompt: >-
                      Slow dolly-in as warm sunlight drifts across the table and
                      coffee steam rises gently.
                    image_urls:
                      - https://example.com/opening-frame.jpg
                    duration: 5
              firstLastFrame:
                summary: First and last frame transition
                value:
                  model: sand-ai/magi-2/image-to-video
                  input:
                    prompt: >-
                      Smooth camera orbit transitioning from day to golden
                      twilight.
                    image_urls:
                      - https://example.com/start.jpg
                      - https://example.com/end.jpg
                    duration: 6
                    aspect_ratio: auto
      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/image-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
            - image_urls
          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:
                - auto
              default: auto
              description: >-
                Follows the first frame's aspect ratio automatically (auto
                only).
            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.
            image_urls:
              type: array
              minItems: 1
              maxItems: 2
              items:
                type: string
                format: uri
              description: >-
                One or two public HTTP(S) image URLs (JPG, PNG or WEBP): opening
                frame and optional closing frame.
    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.