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

# MAGI-2

> Generate video from text or use one image as the first frame and a second image as the last frame.

**Pricing**

| Resolution | Tokens per requested second | USD per requested second |
|---|---:|---:|
| 1080p | 5.2 | $0.104 |

References and synchronized audio have no additional charge. The response contains an `img_uuid`. Poll `GET /api/v1/jobs/detail` or supply `custom_callback_url` for task updates.



## OpenAPI

````yaml api-reference/video-generations/openapi-magi-2.json POST /api/v1/videos/generations
openapi: 3.1.0
info:
  title: GoEnhance API - MAGI-2
  description: >-
    Generate video from text or use one image as the first frame and a second
    image as the last frame.
  version: 1.0.0
servers:
  - url: https://api.goenhance.ai
security: []
paths:
  /api/v1/videos/generations:
    post:
      tags:
        - VideoGenerations
      summary: MAGI-2
      description: >-
        Generate video from text or use one image as the first frame and a
        second image as the last frame.


        **Pricing**


        | Resolution | Tokens per requested second | USD per requested second |

        |---|---:|---:|

        | 1080p | 5.2 | $0.104 |


        References and synchronized audio have no additional charge. The
        response contains an `img_uuid`. Poll `GET /api/v1/jobs/detail` or
        supply `custom_callback_url` for task updates.
      parameters:
        - name: Authorization
          in: header
          required: true
          example: Bearer YOUR_API_KEY
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
              anyOf:
                - required:
                    - prompt
                - required:
                    - image_urls
                - required:
                    - image_url
              properties:
                model:
                  type: string
                  enum:
                    - magi-2
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 15000
                  description: Required for text-to-video. Optional with a first frame.
                image_urls:
                  type: array
                  items:
                    type: string
                    format: uri
                    pattern: ^https://
                  minItems: 1
                  maxItems: 2
                  description: >-
                    First frame followed by an optional last frame. You can also
                    use image_url and image_end_url.
                duration:
                  type: integer
                  minimum: 4
                  maximum: 30
                  default: 5
                  description: Requested output duration in seconds.
                resolution:
                  type: string
                  enum:
                    - 1080p
                  default: 1080p
                  description: Output resolution. The quality alias is accepted.
                ratio:
                  type: string
                  enum:
                    - '16:9'
                    - '9:16'
                    - '1:1'
                    - '4:3'
                    - '3:4'
                    - '21:9'
                  default: '16:9'
                  description: Output aspect ratio. The aspect_ratio alias is accepted.
                generate_audio:
                  type: boolean
                  default: true
                  description: Generate synchronized audio.
                seed:
                  type: integer
                  minimum: 0
                  maximum: 4294967295
                  description: Seed for more repeatable results.
                custom_callback_url:
                  type: string
                  format: uri
                  description: Public URL that receives task updates.
                image_url:
                  type: string
                  format: uri
                  pattern: ^https://
                  description: First-frame alias. Use either this field or image_urls.
                image_end_url:
                  type: string
                  format: uri
                  pattern: ^https://
                  description: Last-frame alias. Requires image_url.
            example:
              model: magi-2
              prompt: A slow camera push along the coastline at sunrise.
              duration: 5
      responses:
        '200':
          description: Task submitted or application-level error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                  msg:
                    type: string
                  data:
                    type: object
                    properties:
                      img_uuid:
                        type: string
                      cost:
                        type: number
                        description: >-
                          Tokens deducted for this request. This is the amount
                          actually charged, so it already reflects any discount
                          active on your account and can be lower than the
                          listed price. Tokens are deducted when the task is
                          accepted, and refunded automatically if the generation
                          ends in failure.
                        example: 5.82
                required:
                  - code
                  - msg
              example:
                code: 0
                msg: Success
                data:
                  img_uuid: c12b656c-747a-44fd-9c80-add79b0c52d5
                  cost: 5.82
        '401':
          description: Unauthorized

````

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