Skip to content

MiniMax-H3 API Examples ​

MiniMax-H3 is MiniMax's native video generation model. It supports text-to-video, image-to-video (first/last frame), and reference-to-video (reference image/video/audio), with 768P and 2K output. This page covers the four native MiniMax endpoints proxied by Agentsflare: video generation, video regeneration, H3-Context-IR (prompt enhancement), and task query.

Basic Configuration ​

Before starting to use the API, please ensure you have obtained an API Key. If not, please refer to Create API Key.

Endpoints ​

PurposeMethod & Path
Create video generation taskPOST https://api.agentsflare.com/minimax/v2/video_generation
Create H3-Context-IR task (prompt enhancement)POST https://api.agentsflare.com/minimax/v2/h3_context_ir
Create video regeneration task (768P → 2K)POST https://api.agentsflare.com/minimax/v2/video_regeneration
Query task status/resultGET https://api.agentsflare.com/minimax/v2/query/video_generation/{task_id}
  • Authentication: Authorization: Bearer <API_KEY>
  • Content-Type: application/json
  • All create endpoints are asynchronous: they return a task_id, which you then poll via the Query endpoint until status becomes succeeded / failed / cancelled.
  • Vendor reference: MiniMax Video Generation V2

Request Parameters (summary) ​

ParameterRequiredDescription
modelYesCurrently only MiniMax-H3
contentYesArray of multimodal input, each item has type (text/image_url/video_url/audio_url) and optional role. Every request must include exactly one non-empty text item
resolutionConditional768P or 2K. Required for video generation; regeneration only supports 2K
durationConditionalVideo duration in seconds, 4–15. Required for video generation and H3-Context-IR; not used for regeneration
ratioOptionalAspect ratio. adaptive (default), 21:9, 16:9, 4:3, 1:1, 3:4, 9:16. Required (non-adaptive) for pure text-to-video
source_task_idConditionalFor regeneration by task ID: the task_id of an existing succeeded generation task
callback_urlOptionalTask status change callback URL

Content role values: first_frame, last_frame, reference_image, reference_video, reference_audio, base_video (regeneration only). Image-to-video (first_frame/last_frame) and reference-to-video (reference_*) are mutually exclusive.

Request Examples ​

1. Create Video Generation Task ​

bash
curl -X POST "https://api.agentsflare.com/minimax/v2/video_generation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [
      {
        "type": "text",
        "text": "Epic space-opera theatrical teaser: a female captain stands alone before a massive observation window as the last fleet gathers and jumps away in a blinding flash, the bridge shaking, leaving her behind."
      }
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "16:9"
  }'
bash
curl -X POST "https://api.agentsflare.com/minimax/v2/video_generation" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [
      {
        "type": "text",
        "text": "Pull focus to the people in the background and add more steam to the ramen bowl."
      },
      {
        "type": "image_url",
        "image_url": { "url": "https://example.com/first-frame.png" },
        "role": "first_frame"
      }
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "adaptive"
  }'
python
import requests
import os

API_BASE = "https://api.agentsflare.com/minimax/v2/video_generation"
API_KEY = os.getenv("API_KEY")

payload = {
    "model": "MiniMax-H3",
    "content": [
        {"type": "text", "text": "A boy playing basketball by the sea"}
    ],
    "resolution": "2K",
    "duration": 5,
    "ratio": "16:9"
}

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

resp = requests.post(API_BASE, json=payload, headers=headers)
result = resp.json()
print("Task ID:", result.get("task_id"))
javascript
const API_BASE = 'https://api.agentsflare.com/minimax/v2/video_generation';
const API_KEY = process.env.API_KEY;

async function createVideo() {
  const payload = {
    model: 'MiniMax-H3',
    content: [
      { type: 'text', text: 'A boy playing basketball by the sea' }
    ],
    resolution: '2K',
    duration: 5,
    ratio: '16:9'
  };

  const res = await fetch(API_BASE, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
  });

  const data = await res.json();
  console.log('Task ID:', data.task_id);
}

createVideo().catch(console.error);

Response:

json
{ "task_id": "424010985738629" }

2. Create H3-Context-IR Task (Prompt Enhancement) ​

H3-Context-IR does not generate a video. It deeply interprets multimodal context and returns a structured, semantically enriched prompt (billed by tokens), which you can then feed into the video generation task.

bash
curl -X POST "https://api.agentsflare.com/minimax/v2/h3_context_ir" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [
      { "type": "text", "text": "A boy playing basketball by the sea" }
    ],
    "duration": 5,
    "ratio": "16:9"
  }'
python
import requests
import os

API_BASE = "https://api.agentsflare.com/minimax/v2/h3_context_ir"
API_KEY = os.getenv("API_KEY")

payload = {
    "model": "MiniMax-H3",
    "content": [
        {"type": "text", "text": "A boy playing basketball by the sea"}
    ],
    "duration": 5,
    "ratio": "16:9"
}

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

resp = requests.post(API_BASE, json=payload, headers=headers)
print(resp.json())

3. Create Video Regeneration Task (768P → 2K) ​

Upgrades a source video that meets the MiniMax-H3 768P output specification to 2K. Supports two modes: by source_task_id (existing succeeded generation task, requires whitelist access) or by base_video (provide the original 768P video plus the exact original inputs).

bash
curl -X POST "https://api.agentsflare.com/minimax/v2/video_regeneration" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "source_task_id": "424010985738629",
    "resolution": "2K"
  }'
bash
curl -X POST "https://api.agentsflare.com/minimax/v2/video_regeneration" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "MiniMax-H3",
    "content": [
      { "type": "text", "text": "A boy playing basketball by the sea" },
      {
        "type": "video_url",
        "video_url": { "url": "https://example.com/h3-768p-source.mp4" },
        "role": "base_video"
      }
    ],
    "resolution": "2K"
  }'

Note

This endpoint only upgrades videos that already meet the MiniMax-H3 768P output spec (24fps, width/height divisible by 32, area ≤ 768×1344, 107–362 frames). It does not process arbitrary videos.

4. Query Task ​

All three task types (generation, regeneration, h3_context_ir) share the same query endpoint. Task IDs are only queryable within a 7-day window.

bash
curl -X GET "https://api.agentsflare.com/minimax/v2/query/video_generation/424010985738629" \
  -H "Authorization: Bearer YOUR_API_KEY"
python
import requests
import os

task_id = "424010985738629"
API_BASE = f"https://api.agentsflare.com/minimax/v2/query/video_generation/{task_id}"
API_KEY = os.getenv("API_KEY")

resp = requests.get(API_BASE, headers={"Authorization": f"Bearer {API_KEY}"})
result = resp.json()

status = result["task"]["status"]
print("Status:", status)
if status == "succeeded":
    print("Result:", result["task"]["content"])

Response Examples ​

Video Generation — Succeeded ​

json
{
  "task": {
    "id": "424010985738629",
    "model": "MiniMax-H3",
    "status": "succeeded",
    "created_at": 1785125529,
    "updated_at": 1785125946,
    "content": {
      "url": "https://your-cdn.example.com/h3-generated-2k-output.mp4"
    },
    "resolution": "2K",
    "duration": 5,
    "usage": {
      "total_seconds": 5,
      "input_seconds": 0,
      "output_seconds": 5,
      "input_image_count": 0
    },
    "ratio": "16:9",
    "task_type": "generation",
    "modality": "video"
  }
}

H3-Context-IR — Succeeded ​

json
{
  "task": {
    "id": "426586401755526",
    "model": "MiniMax-H3",
    "status": "succeeded",
    "created_at": 1785702855,
    "updated_at": 1785702884,
    "content": {
      "prompt": "integrated_multimodal_description: [Shot 1] Cinematic, wide shot with a slow push in..."
    },
    "duration": 5,
    "usage": {
      "total_tokens": 9090,
      "prompt_tokens": 5664,
      "completion_tokens": 3426
    },
    "ratio": "16:9",
    "task_type": "h3_context_ir",
    "modality": "text"
  }
}

Failed ​

json
{
  "task": {
    "id": "424010985738630",
    "model": "MiniMax-H3",
    "status": "failed",
    "error": { "code": "1026", "message": "video description contains sensitive content" },
    "created_at": 1785125529,
    "updated_at": 1785125700,
    "resolution": "2K",
    "duration": 5,
    "usage": { "total_seconds": 0, "input_seconds": 0, "output_seconds": 0, "input_image_count": 0 },
    "ratio": "16:9",
    "task_type": "generation",
    "modality": "video"
  }
}

Response Fields ​

FieldDescription
statusqueued / running / succeeded / failed / cancelled
task_typegeneration / regeneration / h3_context_ir
modalityvideo (generation/regeneration) or text (h3_context_ir)
content.urlVideo download URL (time-limited, download promptly) — video tasks
content.promptEnhanced prompt text — H3-Context-IR tasks
usage.total_seconds / input_image_countBilling usage for video tasks
usage.total_tokens / prompt_tokens / completion_tokensBilling usage for H3-Context-IR tasks

Important Notes ​

  1. API Key Security: Do not hardcode API Keys in your code, use environment variables
  2. Async polling: Poll the Query endpoint (recommended interval 3–5s) instead of blocking on the create request
  3. 7-day query window: Task results are only queryable for 7 days; download video URLs promptly
  4. Image-to-video vs reference-to-video: These input modes are mutually exclusive within a single request

Supported Models ​

  • MiniMax-H3

💡 Tip

The model field in the request example can be replaced with any model name above.

This documentation is licensed under CC BY-SA 4.0.