---
title: "Generate video"
method: POST
path: "/videos/generations"
tags: ["Video"]
---

# Generate video

`POST /videos/generations`

## Request

- Base URL: `https://www.aimagicx.com/api/v1`
- URL: `https://www.aimagicx.com/api/v1/videos/generations`
- Auth: HTTP bearer

Creates a video from a text prompt or source image using MiniMax, Luma, and other models.

## Query parameters

- `async` boolean

## Request body

- VideoGenerationRequest
  - `prompt` string, required: Text description of the video
  - `model` string
  - `duration_seconds` number
  - `resolution` '720p' | '1080p' | '4k'
  - `fps` 30 | 60
  - `aspect_ratio` '16:9' | '9:16' | '1:1' | '4:3' | '3:4'
  - `mode` 'text_to_video' | 'image_to_video' | 'video_to_video'
  - `source_image` string, uri, nullable: Image URL for image-to-video mode
  - `source_video` string, uri, nullable: Video URL for video-to-video mode
  - `negative_prompt` string, nullable
  - `seed` integer, nullable
  - `prompt_optimizer` boolean: Enhance prompt (MiniMax)
  - `loop` boolean: Create looping video (Luma)

## Response `200`

Successful response

- union
  - VideoGenerationResponse
    - `created` integer
    - `data` object
      - `url` string, uri
      - `duration_seconds` number
      - `width` integer
      - `height` integer
    - `model` string
    - `model_tier` string
    - `usage` Usage
      - `credits_used` integer
      - `credits_breakdown` object
      - `prompt_tokens` integer
      - `completion_tokens` integer
      - `total_tokens` integer
  - AsyncJobResponse
    - `id` string: Job ID for polling
    - `status` 'pending' | 'processing' | 'completed' | 'failed'
    - `created` integer
    - `model` string
    - `estimated_credits` integer

## Other responses

- `400`: Bad request - invalid parameters
- `401`: Unauthorized - invalid or missing API key
- `429`: Rate limit exceeded

---

[API](https://skmtc.dev/aimagicx/apis/ai-magicx-api.md) - [All operations](https://skmtc.dev/aimagicx/apis/ai-magicx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/aimagicx/apis/ai-magicx-api/revisions/08210272abb4?raw)
