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

# Image to Video Generation



## OpenAPI

````yaml api-reference/en/zmodelVideo/minimax/video-generation/image-to-video.json POST /minimax/v1/video_generation
openapi: 3.0.1
info:
  title: MiniMax API
  description: >-
    Use this API to input an image and text content to create a video generation
    task.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.powertokens.ai
security:
  - bearerAuth: []
paths:
  /minimax/v1/video_generation:
    post:
      tags:
        - Video
      summary: Video Generation
      operationId: videoGeneration
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: >-
            Media type of the request body. Set to `application/json` to ensure
            the request data is in JSON format.
          schema:
            type: string
            enum:
              - application/json
            default: application/json
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoGenerationReq'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoGenerationResp'
components:
  schemas:
    VideoGenerationReq:
      type: object
      required:
        - model
        - first_frame_image
      properties:
        model:
          type: string
          description: >-
            Model name. Available values: `MiniMax-Hailuo-2.3`,
            `MiniMax-Hailuo-2.3-Fast`, `MiniMax-Hailuo-02`.
          enum:
            - MiniMax-Hailuo-2.3
            - MiniMax-Hailuo-2.3-Fast
            - MiniMax-Hailuo-02
        first_frame_image:
          type: string
          description: "Use the specified image as the first frame of the video. Supports public URL or Base64-encoded [Data URL](https://developer.mozilla.org/en-US/docs/Web/URI/Reference/Schemes/data) (`data:image/jpeg;base64,...`)\n\n- Image requirements:\n\t- Format: JPG, JPEG, PNG, WebP\n\t- Size: less than 20MB\n\t- Dimensions: Short side greater than 300px, aspect ratio between 2:5 and 5:2  "
        prompt:
          type: string
          description: "Text description of the video, up to 2000 characters. For `MiniMax-Hailuo-2.3`, `MiniMax-Hailuo-2.3-Fast`, and `MiniMax-Hailuo-02` models, the `[command]` syntax is supported for camera movement control.\nYou can add camera movement commands in the prompt using the `[command]` format for precise camera control.\n\n- 15 supported camera movement commands:\n\t - Pan left/right: [Pan left], [Pan right]\n\t - Tilt left/right: [Tilt left], [Tilt right]\n\t - Dolly: [Dolly in], [Dolly out]\n\t - Pedestal: [Pedestal up], [Pedestal down]\n\t - Tilt up/down: [Tilt up], [Tilt down]\n\t - Zoom: [Zoom in], [Zoom out]\n\t - Others: [Shake], [Follow], [Static]\n\n - Usage rules:\n\t - Combined movements: Multiple commands within the same pair of `[]` take effect simultaneously, e.g. [Tilt left, Pedestal up]. It is recommended to combine no more than 3 commands.\n\t - Sequential movements: Commands appearing sequentially in the prompt take effect in order, e.g. \"...[Dolly in], then...[Dolly out]\"\n\t - Natural language: Natural language descriptions of camera movements are also supported, but using standard commands yields more accurate results. "
        prompt_optimizer:
          type: boolean
          description: >-
            Whether to automatically optimize the `prompt`. Defaults to `true`.
            Set to `false` for more precise control.
        fast_pretreatment:
          type: boolean
          description: >-
            Whether to shorten the `prompt_optimizer` optimization time.
            Defaults to false. Only takes effect for `MiniMax-Hailuo-2.3`,
            `MiniMax-Hailuo-2.3-Fast`, and `MiniMax-Hailuo-02` models.
        duration:
          type: integer
          description: >-
            Video duration in seconds. Defaults to 6. Available values depend on
            model and resolution:

            | Model | 768P | 1080P |

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

            | MiniMax-Hailuo-2.3 | `6` or `10` | `6` |

            | MiniMax-Hailuo-2.3-Fast | `6` or `10` | `6` |

            | MiniMax-Hailuo-02 | `6` or `10` | `6` |
        resolution:
          type: string
          description: >-
            Video resolution. Available values depend on model:


            | Model | 6s | 10s |

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

            | MiniMax-Hailuo-2.3 | `768P` (default), `1080P` | `768P` (default)
            |

            | MiniMax-Hailuo-2.3-Fast | `768P` (default), `1080P` | `768P`
            (default) |

            | MiniMax-Hailuo-02 | `512P`, `768P` (default), `1080P` | `512P`,
            `768P` (default) |
          enum:
            - 512P
            - 768P
            - 1080P
        callback_url:
          type: string
          description: "Callback URL for receiving task status update notifications. You can configure a callback via the `callback_url` parameter to receive asynchronous notifications of task status updates.\n\nAddress verification: After configuration, the MiniMax server sends a POST request to `callback_url` with a `challenge` field in the request body. Your server must echo back the challenge value within 3 seconds to complete verification.\nStatus updates: After successful verification, whenever the task status changes, MiniMax pushes the latest task status to this URL. The pushed data structure matches the response body of the query video generation task API.\n\nThe callback returns the following \"status\" values:\n- `\"processing\"` - Generating\n- `\"success\"` - Success\n- `\"failed\"` - Failed\n\n```python\nfrom fastapi import FastAPI, HTTPException, Request\r\nimport json\r\n\r\napp = FastAPI()\r\n\r\n@app.post(\"/get_callback\")\r\nasync def get_callback(request: Request):\r\n    try:\r\n        json_data = await request.json()\r\n        challenge = json_data.get(\"challenge\")\r\n        if challenge is not None:\r\n            # Validation request, echo back challenge\r\n            return {\"challenge\": challenge}\r\n        else:\r\n            # Status update request, handle accordingly\r\n            # {\r\n            #     \"task_id\": \"115334141465231360\",\r\n            #     \"status\": \"success\",\r\n            #     \"file_id\": \"205258526306433\",\r\n            #     \"base_resp\": {\r\n            #         \"status_code\": 0,\r\n            #         \"status_msg\": \"success\"\r\n            #     }\r\n            # }\r\n            return {\"status\": \"success\"}\r\n    except Exception as e:\r\n        raise HTTPException(status_code=500, detail=str(e))\r\n\r\nif __name__ == \"__main__\":\r\n    import uvicorn\r\n    uvicorn.run(\r\n        app,  # Required\r\n        host=\"0.0.0.0\",  # Required\r\n        port=8000,  # Required, port is configurable\r\n        # ssl_keyfile=\"yourname.yourDomainName.com.key\",  # Optional, depends on whether SSL is enabled\r\n        # ssl_certfile=\"yourname.yourDomainName.com.key\",  # Optional, depends on whether SSL is enabled\r\n    )\n```"
        aigc_watermark:
          type: boolean
          description: >-
            Whether to add a watermark to the generated video. Defaults to
            `false`.
      example:
        prompt: A mouse runs toward the camera, smiling and blinking.
        first_frame_image: >-
          https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg
        model: MiniMax-Hailuo-2.3
        duration: 6
        resolution: 1080P
    VideoGenerationResp:
      type: object
      properties:
        task_id:
          type: string
          description: >-
            ID of the video generation task, used for subsequent task status
            queries.
        base_resp:
          $ref: '#/components/schemas/BaseResp'
      example:
        task_id: '106916112212032'
        base_resp:
          status_code: 0
          status_msg: success
    BaseResp:
      type: object
      properties:
        status_code:
          type: integer
          description: >+
            Status codes:

            - 0: Request succeeded

            - 1002: Rate limit triggered, please retry later

            - 1004: Authentication failed, please check if the API-Key is
            correct

            - 1008: Insufficient balance

            - 1026: Video description involves sensitive content, please adjust

            - 2013: Invalid input parameters, please check if the parameters are
            filled in correctly

            - 2049: Invalid API key, please check the API key

        status_msg:
          type: string
          description: Error details
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: 'Pass `Authorization: Bearer <token>` in the request header.'

````