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

> - Guide a 4-30 second 1080p video with up to 10 reference images, 5 videos, and 5 audio tracks; at least one reference is required
- The prompt is optional
- Billed per requested second; reference images, videos, and audio are not billed
- Asynchronous processing mode, use the returned task ID to query status with `GET /v1/tasks/{task_id}`; generation can take several minutes
- Generated video links are valid for 7 days, please save them promptly



## OpenAPI

````yaml en/api-manual/video-series/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: Guide a 4-30 second 1080p video with up to 10 reference images, 5 videos, and 5 audio tracks; at least one reference is required
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.evolink.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Video Generation
    description: AI video generation endpoints
paths:
  /v1/videos/generations:
    post:
      tags:
        - Video Generation
      summary: MAGI-2 Reference-to-Video
      description: >-
        - Guide a 4-30 second 1080p video with up to 10 reference images, 5 videos, and 5 audio tracks; at least one reference is required
        - The prompt is optional
        - Billed per requested second; reference images, videos, and audio are not billed
        - Asynchronous processing mode, use the returned task ID to query status with `GET /v1/tasks/{task_id}`; generation can take several minutes
        - Generated video links are valid for 7 days, please save them promptly
      operationId: createMagi2ReferenceToVideo
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerationRequest'
            examples:
              basic:
                summary: Reference-to-video with an image
                value:
                  model: magi-2-reference-to-video
                  prompt: >-
                    The same character from the reference image walks through a sunlit market, handheld tracking shot
                  duration: 5
                  quality: 1080p
                  aspect_ratio: '16:9'
                  generate_audio: true
                  image_urls:
                    - https://example.com/character.jpg
      responses:
        '200':
          description: Video generation task created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResponse'
        '400':
          description: >-
            Invalid request parameters (including fields this route does not
            accept)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: invalid_parameter
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthenticated, token invalid or expired
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '402':
          description: Insufficient quota, top-up required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    VideoGenerationRequest:
      type: object
      required:
        - model
      description: >-
        At least one of `image_urls`, `video_urls`, or `audio_urls` must be a non-empty array; any one type on its own is accepted
      anyOf:
        - required:
            - image_urls
          properties:
            image_urls:
              minItems: 1
        - required:
            - video_urls
          properties:
            video_urls:
              minItems: 1
        - required:
            - audio_urls
          properties:
            audio_urls:
              minItems: 1
      properties:
        model:
          type: string
          description: Video generation model name
          enum:
            - magi-2-reference-to-video
          default: magi-2-reference-to-video
          example: magi-2-reference-to-video
        prompt:
          type: string
          description: >-
            Optional text prompt, up to 15,000 characters. When provided it must not be blank
        image_urls:
          type: array
          description: >-
            Up to 10 publicly accessible HTTPS reference image URLs, each under 30MB. At least one of `image_urls`, `video_urls`, or `audio_urls` is required
          items:
            type: string
            format: uri
          maxItems: 10
          example:
            - https://example.com/character.jpg
        video_urls:
          type: array
          description: >-
            Up to 5 publicly accessible HTTPS MP4/MOV reference video URLs, each up to 200MB and 2-30 seconds; combined duration must not exceed 30 seconds. Reference videos do not change the price
          items:
            type: string
            format: uri
          maxItems: 5
          example:
            - https://example.com/reference.mp4
        audio_urls:
          type: array
          description: >-
            Up to 5 publicly accessible HTTPS WAV/MP3 reference audio URLs, each up to 15MB and 2-30 seconds; combined duration must not exceed 30 seconds
          items:
            type: string
            format: uri
          maxItems: 5
          example:
            - https://example.com/reference.mp3
        duration:
          type: integer
          description: >-
            Output duration in seconds as a JSON integer, defaults to `5`. Any integer from `4` to `30`. Billed per requested second
          minimum: 4
          maximum: 30
          default: 5
          example: 5
        quality:
          type: string
          description: >-
            Video resolution. `1080p` is the only supported value and the default
          enum:
            - 1080p
          default: 1080p
          example: 1080p
        aspect_ratio:
          type: string
          description: >-
            Video aspect ratio, defaults to `16: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: >-
            Whether to generate synchronized audio, defaults to `true`, at no additional charge. `false` outputs a video without generated audio
          default: true
          example: true
        seed:
          type: integer
          description: >-
            Optional random seed for more repeatable results
          minimum: 0
          maximum: 4294967295
          example: 42
        callback_url:
          type: string
          description: >-
            HTTPS callback URL for task completion. Triggered when the task is completed, failed, or cancelled. Only HTTPS is supported; private network addresses are rejected. Keep the task ID as a polling fallback
          format: uri
          example: https://your-domain.com/webhooks/video-task-completed
    VideoGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: Task creation timestamp
          example: 1761313744
        id:
          type: string
          description: Task ID
          example: task-unified-1774857405-abc123
        model:
          type: string
          description: Actual model name used
          example: magi-2-reference-to-video
        object:
          type: string
          enum:
            - video.generation.task
          description: Specific type of the task
        progress:
          type: integer
          description: Task progress percentage (0-100)
          minimum: 0
          maximum: 100
          example: 0
        status:
          type: string
          description: Task status
          enum:
            - pending
            - processing
            - completed
            - failed
          example: pending
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Error code identifier
            message:
              type: string
              description: Error description message
            type:
              type: string
              description: Error type
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All endpoints require Bearer Token authentication. Get your API key on
        the API Key Management Page (https://evolink.ai/dashboard/keys) and send
        it as `Authorization: Bearer YOUR_API_KEY`

````



# Query Task Status

> Query the status, progress, and result information of the asynchronous task by task ID

- Endpoint: `GET https://api.evolink.ai/v1/tasks/{task_id}`
- Header: `Authorization: Bearer YOUR_API_KEY`
- `status` is one of `pending`, `processing`, `completed`, `failed`
- When `status` is `completed`, `results` contains the video URL (valid for 7 days)
- A task whose final status is `failed` is not charged
