{
  "openapi": "3.1.0",
  "info": {
    "title": "MiniMax H3 Video Create API",
    "version": "1.0.0",
    "description": "Create an asynchronous MiniMax H3 video task from text, reference media, or first and last frames through CometAPI. Send the request as multipart/form-data, then use the returned id to retrieve the task and download its completed MP4 file."
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/videos": {
      "post": {
        "summary": "Create a MiniMax H3 video task",
        "operationId": "minimax_h3_create_video",
        "description": "Create a MiniMax H3 video task from a text prompt, reference images, reference video or audio, or first and last frames. Repeat input_reference with one publicly accessible HTTPS image URL or uploaded image file per field, up to nine images. Use all URLs or all files within input_reference. Send size in WxH form. The service can normalize the final output dimensions.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/MiniMaxH3CreateRequest"
              },
              "encoding": {
                "input_reference": {
                  "contentType": "text/plain, image/png, image/jpeg",
                  "style": "form",
                  "explode": true
                },
                "reference_videos": {
                  "style": "form",
                  "explode": true,
                  "contentType": "text/plain, video/mp4"
                },
                "reference_audios": {
                  "style": "form",
                  "explode": true,
                  "contentType": "text/plain, audio/mpeg"
                },
                "first_frame": {
                  "style": "form"
                },
                "last_frame": {
                  "style": "form"
                }
              },
              "examples": {
                "text_2544x1456": {
                  "summary": "Text-to-video at 2544x1456",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "A paper boat glides across a still pond, daylight, locked camera, no text.",
                    "seconds": 5,
                    "size": "2544x1456"
                  }
                },
                "text_1344x768": {
                  "summary": "Text-to-video at 1344x768",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "A cinematic view of clouds moving over green mountains, locked camera, no text.",
                    "seconds": 5,
                    "size": "1344x768"
                  }
                },
                "url_reference_image": {
                  "summary": "HTTPS reference images at 1344x768",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "The referenced characters walk together through a city street. Preserve their appearance and use natural motion. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "input_reference": [
                      "https://your-image-host/reference-1.png",
                      "https://your-image-host/reference-2.jpg"
                    ]
                  }
                },
                "uploaded_reference_images": {
                  "summary": "Uploaded reference images",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "The uploaded reference characters walk together through a city street. Preserve their appearance and use natural motion. No text.",
                    "seconds": 5,
                    "size": "2544x1456",
                    "input_reference": [
                      "@/path/to/reference-1.png",
                      "@/path/to/reference-2.jpg"
                    ]
                  }
                },
                "https_reference_video": {
                  "summary": "HTTPS MP4 reference video",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Follow the reference clip's shot structure and motion. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "reference_videos": [
                      "https://your-media-host/reference.mp4"
                    ]
                  }
                },
                "https_reference_audio": {
                  "summary": "HTTPS MP3 reference audio with an image",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Animate the reference image and synchronize the motion with the reference audio. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "reference_audios": [
                      "https://your-media-host/reference.mp3"
                    ],
                    "input_reference": "https://your-image-host/reference.png"
                  }
                },
                "https_first_last_frames": {
                  "summary": "HTTPS first and last frames",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Move naturally from the opening frame to the ending frame. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "first_frame": "https://your-image-host/first-frame.png",
                    "last_frame": "https://your-image-host/last-frame.png"
                  }
                },
                "uploaded_first_last_frames": {
                  "summary": "Uploaded first and last frames",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Move naturally from the uploaded opening frame to the uploaded ending frame. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "first_frame": "<binary PNG file>",
                    "last_frame": "<binary PNG file>"
                  }
                },
                "uploaded_reference_video": {
                  "summary": "Uploaded MP4 reference video",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Follow the uploaded reference video shot structure and motion. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "reference_videos": [
                      "@/path/to/reference.mp4"
                    ]
                  }
                },
                "uploaded_reference_audio_with_image": {
                  "summary": "Uploaded MP3 reference audio with an image",
                  "value": {
                    "model": "minimax-h3",
                    "prompt": "Animate the reference image and synchronize the motion with the uploaded reference audio. No text.",
                    "seconds": 5,
                    "size": "1344x768",
                    "reference_audios": [
                      "@/path/to/reference.mp3"
                    ],
                    "input_reference": "https://your-image-host/reference.png"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created. Store the returned id and use it in retrieve and content requests.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MiniMaxH3VideoTask"
                },
                "example": {
                  "id": "<task_id>",
                  "task_id": "<task_id>",
                  "object": "video",
                  "model": "minimax-h3",
                  "status": "queued",
                  "progress": 0,
                  "created_at": 1779938152
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Text-to-video at 2544x1456",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=A paper boat glides across a still pond, daylight, locked camera, no text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=2544x1456'"
          },
          {
            "lang": "Python",
            "label": "Text-to-video at 2544x1456",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"A paper boat glides across a still pond, daylight, \"\n            \"locked camera, no text.\",\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"2544x1456\")),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Text-to-video at 2544x1456",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"A paper boat glides across a still pond, daylight, \" +\n    \"locked camera, no text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"2544x1456\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "Text-to-video at 1344x768",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=A cinematic view of clouds moving over green mountains, locked camera, no text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768'"
          },
          {
            "lang": "Python",
            "label": "Text-to-video at 1344x768",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"A cinematic view of clouds moving over green mountains, \"\n            \"locked camera, no text.\",\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Text-to-video at 1344x768",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"A cinematic view of clouds moving over green mountains, \" +\n    \"locked camera, no text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "HTTPS reference images at 1344x768",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string model=minimax-h3 \\\n  --form-string 'prompt=The referenced characters walk together through a city street. Preserve their appearance and use natural motion. No text.' \\\n  --form-string seconds=5 \\\n  --form-string size=1344x768 \\\n  --form-string input_reference=https://your-image-host/reference-1.png \\\n  --form-string input_reference=https://your-image-host/reference-2.jpg\n"
          },
          {
            "lang": "Python",
            "label": "HTTPS reference images at 1344x768",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"The referenced characters walk together through a city street. \"\n            \"Preserve their appearance and use natural motion. No text.\"\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n    (\"input_reference\", (None, \"https://your-image-host/reference-1.png\")),\n    (\"input_reference\", (None, \"https://your-image-host/reference-2.jpg\")),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "HTTPS reference images at 1344x768",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"The referenced characters walk together through a city street. \" +\n    \"Preserve their appearance and use natural motion. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\"input_reference\", \"https://your-image-host/reference-1.png\");\nform.append(\"input_reference\", \"https://your-image-host/reference-2.jpg\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "Uploaded reference images",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=The uploaded reference characters walk together through a city street. Preserve their appearance and use natural motion. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=2544x1456' \\\n  --form 'input_reference=@/path/to/reference-1.png;type=image/png' \\\n  --form 'input_reference=@/path/to/reference-2.jpg;type=image/jpeg'"
          },
          {
            "lang": "Python",
            "label": "Uploaded reference images",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nprompt = (\n    \"The uploaded reference characters walk together through a city street. \"\n    \"Preserve their appearance and use natural motion. No text.\"\n)\n\nwith ExitStack() as stack:\n    files = [\n        (\n            \"input_reference\",\n            (\n                \"reference-1.png\",\n                stack.enter_context(\n                    open(\"/path/to/reference-1.png\", \"rb\")\n                ),\n                \"image/png\",\n            ),\n        ),\n        (\n            \"input_reference\",\n            (\n                \"reference-2.jpg\",\n                stack.enter_context(\n                    open(\"/path/to/reference-2.jpg\", \"rb\")\n                ),\n                \"image/jpeg\",\n            ),\n        ),\n    ]\n    response = requests.post(\n        \"https://api.cometapi.com/v1/videos\",\n        headers={\n            \"Authorization\": \"Bearer \"\n            + os.environ[\"COMETAPI_KEY\"]\n        },\n        data={\n            \"model\": \"minimax-h3\",\n            \"prompt\": prompt,\n            \"seconds\": \"5\",\n            \"size\": \"2544x1456\",\n        },\n        files=files,\n        timeout=120,\n    )\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Uploaded reference images",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst firstReference = await readFile(\"/path/to/reference-1.png\");\nconst secondReference = await readFile(\"/path/to/reference-2.jpg\");\n\nconst form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"The uploaded reference characters walk together through a city street. \" +\n    \"Preserve their appearance and use natural motion. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"2544x1456\");\nform.append(\n  \"input_reference\",\n  new Blob([firstReference], { type: \"image/png\" }),\n  \"reference-1.png\",\n);\nform.append(\n  \"input_reference\",\n  new Blob([secondReference], { type: \"image/jpeg\" }),\n  \"reference-2.jpg\",\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "HTTPS MP4 reference video",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=Follow the reference clip shot structure and motion. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768' \\\n  --form-string 'reference_videos=https://your-media-host/reference.mp4'"
          },
          {
            "lang": "Python",
            "label": "HTTPS MP4 reference video",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Follow the reference clip shot structure and motion. \"\n            \"No text.\",\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n    (\n        \"reference_videos\",\n        (None, \"https://your-media-host/reference.mp4\"),\n    ),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "HTTPS MP4 reference video",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Follow the reference clip shot structure and motion. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"reference_videos\",\n  \"https://your-media-host/reference.mp4\",\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "MP4 reference video data URI",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=Follow the reference clip shot structure and motion. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768' \\\n  --form 'reference_videos=<-;type=text/plain' \\\n  < <(printf 'data:video/mp4;base64,'; openssl base64 -A -in /path/to/reference.mp4)"
          },
          {
            "lang": "Python",
            "label": "MP4 reference video data URI",
            "source": "import base64\nimport os\nfrom pathlib import Path\n\nimport requests\n\nvideo_base64 = base64.b64encode(\n    Path(\"/path/to/reference.mp4\").read_bytes()\n).decode(\"ascii\")\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Follow the reference clip shot structure and motion. \"\n            \"No text.\",\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n    (\n        \"reference_videos\",\n        (None, \"data:video/mp4;base64,\" + video_base64),\n    ),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "MP4 reference video data URI",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst videoBase64 = (\n  await readFile(\"/path/to/reference.mp4\")\n).toString(\"base64\");\n\nconst form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Follow the reference clip shot structure and motion. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"reference_videos\",\n  `data:video/mp4;base64,${videoBase64}`,\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "HTTPS MP3 reference audio with an image",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string model=minimax-h3 \\\n  --form-string 'prompt=Animate the reference image and synchronize the motion with the reference audio. No text.' \\\n  --form-string seconds=5 \\\n  --form-string size=1344x768 \\\n  --form-string reference_audios=https://your-media-host/reference.mp3 \\\n  --form-string input_reference=https://your-image-host/reference.png\n"
          },
          {
            "lang": "Python",
            "label": "HTTPS MP3 reference audio with an image",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Animate the reference image and synchronize the motion with the \"\n            \"reference audio. No text.\"\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n    (\"reference_audios\", (None, \"https://your-media-host/reference.mp3\")),\n    (\"input_reference\", (None, \"https://your-image-host/reference.png\")),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "HTTPS MP3 reference audio with an image",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Animate the reference image and synchronize the motion with the \" +\n  \"reference audio. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\"reference_audios\", \"https://your-media-host/reference.mp3\");\nform.append(\"input_reference\", \"https://your-image-host/reference.png\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "HTTPS first and last frames",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=Move naturally from the opening frame to the ending frame. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768' \\\n  --form-string 'first_frame=https://your-image-host/first-frame.png' \\\n  --form-string 'last_frame=https://your-image-host/last-frame.png'"
          },
          {
            "lang": "Python",
            "label": "HTTPS first and last frames",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"minimax-h3\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Move naturally from the opening frame to the ending \"\n            \"frame. No text.\",\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1344x768\")),\n    (\n        \"first_frame\",\n        (None, \"https://your-image-host/first-frame.png\"),\n    ),\n    (\n        \"last_frame\",\n        (None, \"https://your-image-host/last-frame.png\"),\n    ),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n    },\n    files=fields,\n    timeout=120,\n)\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "HTTPS first and last frames",
            "source": "const form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Move naturally from the opening frame to the ending frame. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"first_frame\",\n  \"https://your-image-host/first-frame.png\",\n);\nform.append(\n  \"last_frame\",\n  \"https://your-image-host/last-frame.png\",\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "Uploaded first and last frames",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=Move naturally from the uploaded opening frame to the uploaded ending frame. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768' \\\n  --form 'first_frame=@/path/to/first-frame.png;type=image/png' \\\n  --form 'last_frame=@/path/to/last-frame.png;type=image/png'"
          },
          {
            "lang": "Python",
            "label": "Uploaded first and last frames",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nprompt = (\n    \"Move naturally from the uploaded opening frame to the uploaded \"\n    \"ending frame. No text.\"\n)\n\nwith ExitStack() as stack:\n    files = {\n        \"first_frame\": (\n            \"first-frame.png\",\n            stack.enter_context(\n                open(\"/path/to/first-frame.png\", \"rb\")\n            ),\n            \"image/png\",\n        ),\n        \"last_frame\": (\n            \"last-frame.png\",\n            stack.enter_context(\n                open(\"/path/to/last-frame.png\", \"rb\")\n            ),\n            \"image/png\",\n        ),\n    }\n    response = requests.post(\n        \"https://api.cometapi.com/v1/videos\",\n        headers={\n            \"Authorization\": \"Bearer \"\n            + os.environ[\"COMETAPI_KEY\"]\n        },\n        data={\n            \"model\": \"minimax-h3\",\n            \"prompt\": prompt,\n            \"seconds\": \"5\",\n            \"size\": \"1344x768\",\n        },\n        files=files,\n        timeout=120,\n    )\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Uploaded first and last frames",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst firstFrame = await readFile(\"/path/to/first-frame.png\");\nconst lastFrame = await readFile(\"/path/to/last-frame.png\");\n\nconst form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Move naturally from the uploaded opening frame to the uploaded \" +\n    \"ending frame. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"first_frame\",\n  new Blob([firstFrame], { type: \"image/png\" }),\n  \"first-frame.png\",\n);\nform.append(\n  \"last_frame\",\n  new Blob([lastFrame], { type: \"image/png\" }),\n  \"last-frame.png\",\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "Uploaded MP4 reference video",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string 'model=minimax-h3' \\\n  --form-string 'prompt=Follow the uploaded reference video shot structure and motion. No text.' \\\n  --form-string 'seconds=5' \\\n  --form-string 'size=1344x768' \\\n  --form 'reference_videos=@/path/to/reference.mp4;type=video/mp4'\n"
          },
          {
            "lang": "Python",
            "label": "Uploaded MP4 reference video",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nprompt = (\n    \"Follow the uploaded reference video shot structure and motion. No \"\n    \"text.\"\n)\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"minimax-h3\")),\n        (\"prompt\", (None, prompt)),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1344x768\")),\n        (\n            \"reference_videos\",\n            (\n                \"reference.mp4\",\n                stack.enter_context(\n                    open(\"/path/to/reference.mp4\", \"rb\")\n                ),\n                \"video/mp4\",\n            ),\n        ),\n    ]\n\n    response = requests.post(\n        \"https://api.cometapi.com/v1/videos\",\n        headers={\n            \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n        },\n        files=fields,\n        timeout=120,\n    )\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Uploaded MP4 reference video",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Follow the uploaded reference video shot structure and motion. No \" +\n  \"text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"reference_videos\",\n  new Blob([await readFile(\"/path/to/reference.mp4\")], {\n    type: \"video/mp4\",\n  }),\n  \"reference.mp4\",\n);\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          },
          {
            "lang": "Shell",
            "label": "Uploaded MP3 reference audio with an image",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string model=minimax-h3 \\\n  --form-string 'prompt=Animate the reference image and synchronize the motion with the uploaded reference audio. No text.' \\\n  --form-string seconds=5 \\\n  --form-string size=1344x768 \\\n  --form 'reference_audios=@/path/to/reference.mp3;type=audio/mpeg' \\\n  --form-string input_reference=https://your-image-host/reference.png\n"
          },
          {
            "lang": "Python",
            "label": "Uploaded MP3 reference audio with an image",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"minimax-h3\")),\n        (\n            \"prompt\",\n            (\n                None,\n                \"Animate the reference image and synchronize the motion with \"\n                \"the uploaded reference audio. No text.\"\n            ),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1344x768\")),\n        (\n            \"reference_audios\",\n            (\n                \"reference.mp3\",\n                stack.enter_context(open(\"/path/to/reference.mp3\", \"rb\")),\n                \"audio/mpeg\",\n            ),\n        ),\n        (\"input_reference\", (None, \"https://your-image-host/reference.png\")),\n    ]\n\n    response = requests.post(\n        \"https://api.cometapi.com/v1/videos\",\n        headers={\n            \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]\n        },\n        files=fields,\n        timeout=120,\n    )\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Uploaded MP3 reference audio with an image",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"minimax-h3\");\nform.append(\n  \"prompt\",\n  \"Animate the reference image and synchronize the motion with the \" +\n  \"uploaded reference audio. No text.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1344x768\");\nform.append(\n  \"reference_audios\",\n  new Blob([await readFile(\"/path/to/reference.mp3\")], {\n    type: \"audio/mpeg\",\n  }),\n  \"reference.mp3\",\n);\nform.append(\"input_reference\", \"https://your-image-host/reference.png\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` },\n  body: form,\n});\n\nif (!response.ok) {\n  throw new Error(await response.text());\n}\n\nconsole.log(await response.json());\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer authentication. Use your CometAPI API key."
      }
    },
    "schemas": {
      "MiniMaxH3CreateRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "const": "minimax-h3",
            "default": "minimax-h3",
            "description": "Model ID for this route. Use minimax-h3."
          },
          "prompt": {
            "type": "string",
            "minLength": 1,
            "description": "Text that describes the scene, motion, camera behavior, and visual details that the video should preserve.",
            "default": "A paper boat glides across a still pond, daylight, locked camera, no text."
          },
          "seconds": {
            "type": "integer",
            "minimum": 5,
            "maximum": 15,
            "default": 5,
            "description": "Requested clip duration in whole seconds. Use an integer from 5 through 15. The default is 5."
          },
          "size": {
            "type": "string",
            "pattern": "^[1-9][0-9]*x[1-9][0-9]*$",
            "examples": [
              "1536x672",
              "1344x768",
              "1024x768",
              "768x768",
              "768x1024",
              "768x1344",
              "2912x1280",
              "2544x1456",
              "1920x1440",
              "1440x1440",
              "1440x1920",
              "1440x2560"
            ],
            "description": "Requested frame size in WxH form. The service can normalize the final output dimensions based on the requested size and supplied reference media."
          },
          "input_reference": {
            "description": "PNG or JPEG reference images. Repeat input_reference with one publicly accessible HTTPS image URL or uploaded image file per field. Send up to nine reference images, whether you use URLs or uploaded files. Use all URLs or all files within this field. Do not combine URLs into a comma-separated value. Keep each uploaded image at or below 20 MiB. Do not combine this field with first_frame or last_frame. Across images, videos, and audio, send at most 12 reference inputs. Each reference video or audio clip must be 2–15 seconds; keep the combined video duration and combined audio duration at or below 15 seconds each. Submit images in the order you want to reference them in the prompt.",
            "anyOf": [
              {
                "title": "Single image URL",
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "description": "One publicly accessible HTTPS image URL."
              },
              {
                "title": "Image URLs",
                "type": "array",
                "minItems": 1,
                "maxItems": 9,
                "items": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://",
                  "description": "One publicly accessible HTTPS reference image URL."
                }
              },
              {
                "title": "Image files",
                "type": "array",
                "minItems": 1,
                "maxItems": 9,
                "items": {
                  "type": "string",
                  "format": "binary",
                  "description": "One uploaded reference image file."
                }
              }
            ]
          },
          "reference_videos": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^(https://|data:video/mp4;base64,)",
                  "example": "https://your-media-host/reference.mp4"
                },
                {
                  "type": "string",
                  "format": "binary"
                }
              ]
            },
            "description": "Reference video inputs. Repeat reference_videos with a direct publicly accessible HTTPS MP4 URL or an uploaded MP4 file. Use only text values or only files within this field. Each uploaded file can be up to 50 MiB. Send no more than three video inputs. A complete data:video/mp4;base64,... URI is also accepted as a text value. Use MP4 with H.264 video; an AAC audio track is optional. Do not combine this field with first_frame or last_frame. Across images, videos, and audio, send at most 12 reference inputs. Each reference video or audio clip must be 2–15 seconds; keep the combined video duration and combined audio duration at or below 15 seconds each."
          },
          "reference_audios": {
            "type": "array",
            "minItems": 1,
            "maxItems": 3,
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://",
                  "example": "https://your-media-host/reference.mp3"
                },
                {
                  "type": "string",
                  "format": "binary"
                }
              ]
            },
            "description": "Reference audio inputs. Repeat reference_audios with a direct publicly accessible HTTPS MP3 URL or an uploaded MP3 file. Use only text values or only files within this field. Each uploaded file can be up to 15 MiB. Send no more than three audio inputs. Pair reference audio with at least one reference image. Do not combine this field with first_frame or last_frame. Across images, videos, and audio, send at most 12 reference inputs. Each reference video or audio clip must be 2–15 seconds; keep the combined video duration and combined audio duration at or below 15 seconds each."
          },
          "first_frame": {
            "description": "Opening frame input as one direct publicly accessible HTTPS PNG URL or one uploaded PNG file at or below 20 MiB (20 x 1024 x 1024 bytes). Do not combine frame fields with reference media fields.",
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "example": "https://your-image-host/first-frame.png"
              },
              {
                "type": "string",
                "format": "binary"
              }
            ]
          },
          "last_frame": {
            "description": "Optional ending frame input, used with first_frame, as one direct publicly accessible HTTPS PNG URL or one uploaded PNG file at or below 20 MiB (20 x 1024 x 1024 bytes). Do not combine frame fields with reference media fields.",
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "pattern": "^https://",
                "example": "https://your-image-host/last-frame.png"
              },
              {
                "type": "string",
                "format": "binary"
              }
            ]
          }
        },
        "dependentRequired": {
          "last_frame": [
            "first_frame"
          ]
        },
        "additionalProperties": false
      },
      "MiniMaxH3VideoTask": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "status",
          "progress",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Task ID. Use this value as task_id in retrieve and content requests.",
            "example": "<task_id>"
          },
          "task_id": {
            "type": "string",
            "description": "Compatibility alias for id. This field can be omitted from retrieve responses.",
            "example": "<task_id>"
          },
          "object": {
            "type": "string",
            "const": "video",
            "description": "Object type for the asynchronous video task."
          },
          "model": {
            "type": "string",
            "const": "minimax-h3",
            "description": "Model ID that the task uses."
          },
          "status": {
            "type": "string",
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed"
            ],
            "description": "Task lifecycle status. Poll until the value is completed or failed."
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Task progress as a coarse percentage."
          },
          "created_at": {
            "type": "integer",
            "format": "int64",
            "description": "Task creation time as a Unix timestamp in seconds."
          },
          "completed_at": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp returned by the platform. Use status, not this field, to decide when polling can stop."
          },
          "expires_at": {
            "type": "integer",
            "format": "int64",
            "description": "Result expiration time as a Unix timestamp in seconds when the task provides one."
          },
          "video_url": {
            "type": "string",
            "format": "uri",
            "description": "Video delivery URL. This field appears on completed tasks.",
            "example": "https://your-media-host/result.mp4"
          },
          "error": {
            "type": "object",
            "description": "Failure details. This field appears when the task fails.",
            "properties": {
              "message": {
                "type": "string",
                "description": "Human-readable failure description."
              },
              "code": {
                "type": "string",
                "description": "Failure code when the task provides one."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
