{
  "openapi": "3.1.0",
  "info": {
    "title": "Wan Video Create API",
    "version": "1.0.0",
    "description": "Create an asynchronous Wan video task from text, reference media, or first and last frames through CometAPI. Save the returned id, poll GET /v1/videos/{task_id}, and download the completed MP4 file."
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/videos": {
      "post": {
        "summary": "Create a Wan video task",
        "operationId": "wan_create_video",
        "description": "Create a Wan video task from text, reference media, or first and last frames. Send fields as multipart/form-data. Repeat input_reference with one publicly accessible HTTPS image URL or uploaded image file per field. Use all URLs or all files within input_reference. Send reference video or audio URLs or files through reference_videos or reference_audios. Submit frame inputs separately from reference media.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/WanCreateRequest"
              },
              "encoding": {
                "input_reference": {
                  "style": "form",
                  "explode": true,
                  "contentType": "text/plain, image/png, image/jpeg"
                },
                "reference_videos": {
                  "style": "form",
                  "explode": true
                },
                "reference_audios": {
                  "style": "form",
                  "explode": true
                },
                "first_frame": {
                  "style": "form"
                },
                "last_frame": {
                  "style": "form"
                }
              },
              "examples": {
                "text_to_video": {
                  "summary": "Text-to-video",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "A small robot walks through a bright greenhouse with smooth camera movement.",
                    "seconds": 5,
                    "size": "1920x1080"
                  }
                },
                "image_to_video": {
                  "summary": "Image-to-video with an uploaded reference image",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "Animate the uploaded image.",
                    "seconds": 5,
                    "size": "1920x1080",
                    "input_reference": [
                      "@reference.png"
                    ]
                  }
                },
                "wan26_reference_video_urls": {
                  "summary": "Wan 2.6 reference video URLs",
                  "value": {
                    "model": "wan2.6",
                    "prompt": "Keep @Video1 and @Video2 recognizable as they walk.",
                    "seconds": 5,
                    "size": "1280x720",
                    "reference_videos": [
                      "https://your-media-host/reference-1.mp4",
                      "https://your-media-host/reference-2.mp4"
                    ]
                  }
                },
                "wan26_reference_video_files": {
                  "summary": "Wan 2.6 uploaded reference videos",
                  "value": {
                    "model": "wan2.6",
                    "prompt": "Keep @Video1 and @Video2 recognizable as they walk.",
                    "seconds": 5,
                    "size": "1280x720",
                    "reference_videos": [
                      "@reference-1.mp4",
                      "@reference-2.mp4"
                    ]
                  }
                },
                "wan27_image_video_urls": {
                  "summary": "Wan 2.7 image and video URLs",
                  "value": {
                    "model": "wan2.7",
                    "prompt": "Preserve the image subjects and follow the video motion.",
                    "seconds": 5,
                    "size": "1280x720",
                    "reference_videos": [
                      "https://your-media-host/reference.mp4"
                    ],
                    "input_reference": [
                      "https://your-image-host/reference-1.png",
                      "https://your-image-host/reference-2.jpg"
                    ]
                  }
                },
                "wan27_image_video_files": {
                  "summary": "Wan 2.7 uploaded images and video",
                  "value": {
                    "model": "wan2.7",
                    "prompt": "Preserve the image subjects and follow the video motion.",
                    "seconds": 5,
                    "size": "1280x720",
                    "input_reference": [
                      "@reference-1.png",
                      "@reference-2.jpg"
                    ],
                    "reference_videos": [
                      "@reference.mp4"
                    ]
                  }
                },
                "wan30_image_video_audio_urls": {
                  "summary": "Wan 3.0 image, video, and audio URLs",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "Preserve image subjects, video motion, and audio rhythm.",
                    "seconds": 5,
                    "size": "1280x720",
                    "reference_videos": [
                      "https://your-media-host/reference.mp4"
                    ],
                    "reference_audios": [
                      "https://your-media-host/reference-1.mp3",
                      "https://your-media-host/reference-2.mp3"
                    ],
                    "input_reference": [
                      "https://your-image-host/reference-1.png",
                      "https://your-image-host/reference-2.jpg"
                    ]
                  }
                },
                "wan30_image_video_audio_files": {
                  "summary": "Wan 3.0 uploaded images, video, and audio",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "Preserve image subjects, video motion, and audio rhythm.",
                    "seconds": 5,
                    "size": "1280x720",
                    "input_reference": [
                      "@reference-1.png",
                      "@reference-2.jpg"
                    ],
                    "reference_videos": [
                      "@reference.mp4"
                    ],
                    "reference_audios": [
                      "@reference-1.mp3",
                      "@reference-2.mp3"
                    ]
                  }
                },
                "wan27_first_last_frame_urls": {
                  "summary": "Wan 2.7 first and last frame URLs",
                  "value": {
                    "model": "wan2.7",
                    "prompt": "Move smoothly from the opening frame to the ending frame.",
                    "seconds": 5,
                    "size": "1280x720",
                    "first_frame": "https://your-image-host/first-frame.png",
                    "last_frame": "https://your-image-host/last-frame.jpg"
                  }
                },
                "wan27_first_last_frame_files": {
                  "summary": "Wan 2.7 uploaded first and last frames",
                  "value": {
                    "model": "wan2.7",
                    "prompt": "Move smoothly from the opening frame to the ending frame.",
                    "seconds": 5,
                    "size": "1280x720",
                    "first_frame": "@first-frame.png",
                    "last_frame": "@last-frame.jpg"
                  }
                },
                "wan30_first_last_frame_urls": {
                  "summary": "Wan 3.0 first and last frame URLs",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "Move smoothly from the opening frame to the ending frame.",
                    "seconds": 5,
                    "size": "1280x720",
                    "first_frame": "https://your-image-host/first-frame.png",
                    "last_frame": "https://your-image-host/last-frame.jpg"
                  }
                },
                "wan30_first_last_frame_files": {
                  "summary": "Wan 3.0 uploaded first and last frames",
                  "value": {
                    "model": "wan3.0",
                    "prompt": "Move smoothly from the opening frame to the ending frame.",
                    "seconds": 5,
                    "size": "1280x720",
                    "first_frame": "@first-frame.png",
                    "last_frame": "@last-frame.jpg"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task created. Store the returned id and poll GET /v1/videos/{task_id}.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WanVideoTask"
                },
                "example": {
                  "id": "task_example",
                  "task_id": "task_example",
                  "object": "video",
                  "model": "wan3.0",
                  "status": "queued",
                  "progress": 0,
                  "created_at": 1779938152
                }
              }
            }
          },
          "400": {
            "description": "The request is missing a required field or contains a value that the selected model cannot use."
          },
          "401": {
            "description": "The API key is missing or invalid."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Text-to-video",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F model=wan3.0 \\\n  -F 'prompt=A small robot walks through a bright greenhouse with smooth camera movement.' \\\n  -F seconds=5 \\\n  -F size=1920x1080"
          },
          {
            "lang": "Python",
            "label": "Text-to-video",
            "source": "import os\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan3.0\")),\n    (\"prompt\", (None, \"A small robot walks through a bright greenhouse with smooth camera movement.\")),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1920x1080\")),\n]\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]},\n    files=fields,\n    timeout=120,\n)\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Text-to-video",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\"prompt\", \"A small robot walks through a bright greenhouse with smooth camera movement.\");\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1920x1080\");\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\nconst result = await response.json();\nconsole.log(result);\n"
          },
          {
            "lang": "Shell",
            "label": "Image-to-video",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan3.0' \\\n  -F 'prompt=Animate the uploaded image.' \\\n  -F 'seconds=5' \\\n  -F 'size=1920x1080' \\\n  -F 'input_reference=@reference.png;type=image/png'"
          },
          {
            "lang": "Python",
            "label": "Image-to-video",
            "source": "import os\n\nimport requests\n\nwith open(\"reference.png\", \"rb\") as reference:\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\": \"wan3.0\",\n            \"prompt\": \"Animate the uploaded image.\",\n            \"seconds\": \"5\",\n            \"size\": \"1920x1080\",\n        },\n        files={\n            \"input_reference\": (\n                \"reference.png\",\n                reference,\n                \"image/png\",\n            )\n        },\n        timeout=120,\n    )\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Image-to-video",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst reference = await readFile(\"reference.png\");\nconst form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\"prompt\", \"Animate the uploaded image.\");\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1920x1080\");\nform.append(\n  \"input_reference\",\n  new Blob([reference], { type: \"image/png\" }),\n  \"reference.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\nconst result = await response.json();\nconsole.log(result);\n"
          },
          {
            "lang": "Shell",
            "label": "Wan 2.6 reference video URLs",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan2.6' \\\n  --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'reference_videos=https://your-media-host/reference-1.mp4' \\\n  -F 'reference_videos=https://your-media-host/reference-2.mp4'"
          },
          {
            "lang": "Python",
            "label": "Wan 2.6 reference video URLs",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan2.6\")),\n    (\n        \"prompt\",\n        (None, \"Keep @Video1 and @Video2 recognizable as they walk.\"),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1280x720\")),\n    (\"reference_videos\", (None, \"https://your-media-host/reference-1.mp4\")),\n    (\"reference_videos\", (None, \"https://your-media-host/reference-2.mp4\")),\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": "Wan 2.6 reference video URLs",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan2.6\");\nform.append(\n  \"prompt\",\n  \"Keep @Video1 and @Video2 recognizable as they walk.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\"reference_videos\", \"https://your-media-host/reference-1.mp4\");\nform.append(\"reference_videos\", \"https://your-media-host/reference-2.mp4\");\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": "Wan 2.6 uploaded reference videos",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan2.6' \\\n  --form-string 'prompt=Keep @Video1 and @Video2 recognizable as they walk.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'reference_videos=@reference-1.mp4;type=video/mp4' \\\n  -F 'reference_videos=@reference-2.mp4;type=video/mp4'"
          },
          {
            "lang": "Python",
            "label": "Wan 2.6 uploaded reference videos",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"wan2.6\")),\n        (\n            \"prompt\",\n            (None, \"Keep @Video1 and @Video2 recognizable as they walk.\"),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1280x720\")),\n        (\n            \"reference_videos\",\n            (\n                \"reference-1.mp4\",\n                stack.enter_context(open(\"reference-1.mp4\", \"rb\")),\n                \"video/mp4\",\n            ),\n        ),\n        (\n            \"reference_videos\",\n            (\n                \"reference-2.mp4\",\n                stack.enter_context(open(\"reference-2.mp4\", \"rb\")),\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": "Wan 2.6 uploaded reference videos",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"wan2.6\");\nform.append(\n  \"prompt\",\n  \"Keep @Video1 and @Video2 recognizable as they walk.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\n  \"reference_videos\",\n  new Blob([await readFile(\"reference-1.mp4\")], {\n    type: \"video/mp4\",\n  }),\n  \"reference-1.mp4\",\n);\nform.append(\n  \"reference_videos\",\n  new Blob([await readFile(\"reference-2.mp4\")], {\n    type: \"video/mp4\",\n  }),\n  \"reference-2.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": "Wan 2.7 image and video URLs",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string model=wan2.7 \\\n  --form-string 'prompt=Preserve the image subjects and follow the video motion.' \\\n  --form-string seconds=5 \\\n  --form-string size=1280x720 \\\n  --form-string reference_videos=https://your-media-host/reference.mp4 \\\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": "Wan 2.7 image and video URLs",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan2.7\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Preserve the image subjects and follow the video motion.\"\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1280x720\")),\n    (\"reference_videos\", (None, \"https://your-media-host/reference.mp4\")),\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": "Wan 2.7 image and video URLs",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan2.7\");\nform.append(\n  \"prompt\",\n  \"Preserve the image subjects and follow the video motion.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\"reference_videos\", \"https://your-media-host/reference.mp4\");\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": "Wan 2.7 uploaded images and video",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan2.7' \\\n  -F 'prompt=Preserve the image subjects and follow the video motion.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'input_reference=@reference-1.png;type=image/png' \\\n  -F 'input_reference=@reference-2.jpg;type=image/jpeg' \\\n  -F 'reference_videos=@reference.mp4;type=video/mp4'"
          },
          {
            "lang": "Python",
            "label": "Wan 2.7 uploaded images and video",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"wan2.7\")),\n        (\n            \"prompt\",\n            (None, \"Preserve the image subjects and follow the video motion.\"),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1280x720\")),\n        (\n            \"input_reference\",\n            (\n                \"reference-1.png\",\n                stack.enter_context(open(\"reference-1.png\", \"rb\")),\n                \"image/png\",\n            ),\n        ),\n        (\n            \"input_reference\",\n            (\n                \"reference-2.jpg\",\n                stack.enter_context(open(\"reference-2.jpg\", \"rb\")),\n                \"image/jpeg\",\n            ),\n        ),\n        (\n            \"reference_videos\",\n            (\n                \"reference.mp4\",\n                stack.enter_context(open(\"reference.mp4\", \"rb\")),\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": "Wan 2.7 uploaded images and video",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"wan2.7\");\nform.append(\n  \"prompt\",\n  \"Preserve the image subjects and follow the video motion.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\n  \"input_reference\",\n  new Blob([await readFile(\"reference-1.png\")], {\n    type: \"image/png\",\n  }),\n  \"reference-1.png\",\n);\nform.append(\n  \"input_reference\",\n  new Blob([await readFile(\"reference-2.jpg\")], {\n    type: \"image/jpeg\",\n  }),\n  \"reference-2.jpg\",\n);\nform.append(\n  \"reference_videos\",\n  new Blob([await readFile(\"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": "Wan 3.0 image, video, and audio URLs",
            "source": "curl \\\n  https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --form-string model=wan3.0 \\\n  --form-string 'prompt=Preserve image subjects, video motion, and audio rhythm.' \\\n  --form-string seconds=5 \\\n  --form-string size=1280x720 \\\n  --form-string reference_videos=https://your-media-host/reference.mp4 \\\n  --form-string reference_audios=https://your-media-host/reference-1.mp3 \\\n  --form-string reference_audios=https://your-media-host/reference-2.mp3 \\\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": "Wan 3.0 image, video, and audio URLs",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan3.0\")),\n    (\n        \"prompt\",\n        (\n            None,\n            \"Preserve image subjects, video motion, and audio rhythm.\"\n        ),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1280x720\")),\n    (\"reference_videos\", (None, \"https://your-media-host/reference.mp4\")),\n    (\"reference_audios\", (None, \"https://your-media-host/reference-1.mp3\")),\n    (\"reference_audios\", (None, \"https://your-media-host/reference-2.mp3\")),\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": "Wan 3.0 image, video, and audio URLs",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\n  \"prompt\",\n  \"Preserve image subjects, video motion, and audio rhythm.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\"reference_videos\", \"https://your-media-host/reference.mp4\");\nform.append(\"reference_audios\", \"https://your-media-host/reference-1.mp3\");\nform.append(\"reference_audios\", \"https://your-media-host/reference-2.mp3\");\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": "Wan 3.0 uploaded images, video, and audio",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan3.0' \\\n  -F 'prompt=Preserve image subjects, video motion, and audio rhythm.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'input_reference=@reference-1.png;type=image/png' \\\n  -F 'input_reference=@reference-2.jpg;type=image/jpeg' \\\n  -F 'reference_videos=@reference.mp4;type=video/mp4' \\\n  -F 'reference_audios=@reference-1.mp3;type=audio/mpeg' \\\n  -F 'reference_audios=@reference-2.mp3;type=audio/mpeg'"
          },
          {
            "lang": "Python",
            "label": "Wan 3.0 uploaded images, video, and audio",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"wan3.0\")),\n        (\n            \"prompt\",\n            (None, \"Preserve image subjects, video motion, and audio rhythm.\"),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1280x720\")),\n        (\n            \"input_reference\",\n            (\n                \"reference-1.png\",\n                stack.enter_context(open(\"reference-1.png\", \"rb\")),\n                \"image/png\",\n            ),\n        ),\n        (\n            \"input_reference\",\n            (\n                \"reference-2.jpg\",\n                stack.enter_context(open(\"reference-2.jpg\", \"rb\")),\n                \"image/jpeg\",\n            ),\n        ),\n        (\n            \"reference_videos\",\n            (\n                \"reference.mp4\",\n                stack.enter_context(open(\"reference.mp4\", \"rb\")),\n                \"video/mp4\",\n            ),\n        ),\n        (\n            \"reference_audios\",\n            (\n                \"reference-1.mp3\",\n                stack.enter_context(open(\"reference-1.mp3\", \"rb\")),\n                \"audio/mpeg\",\n            ),\n        ),\n        (\n            \"reference_audios\",\n            (\n                \"reference-2.mp3\",\n                stack.enter_context(open(\"reference-2.mp3\", \"rb\")),\n                \"audio/mpeg\",\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": "Wan 3.0 uploaded images, video, and audio",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\n  \"prompt\",\n  \"Preserve image subjects, video motion, and audio rhythm.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\n  \"input_reference\",\n  new Blob([await readFile(\"reference-1.png\")], {\n    type: \"image/png\",\n  }),\n  \"reference-1.png\",\n);\nform.append(\n  \"input_reference\",\n  new Blob([await readFile(\"reference-2.jpg\")], {\n    type: \"image/jpeg\",\n  }),\n  \"reference-2.jpg\",\n);\nform.append(\n  \"reference_videos\",\n  new Blob([await readFile(\"reference.mp4\")], {\n    type: \"video/mp4\",\n  }),\n  \"reference.mp4\",\n);\nform.append(\n  \"reference_audios\",\n  new Blob([await readFile(\"reference-1.mp3\")], {\n    type: \"audio/mpeg\",\n  }),\n  \"reference-1.mp3\",\n);\nform.append(\n  \"reference_audios\",\n  new Blob([await readFile(\"reference-2.mp3\")], {\n    type: \"audio/mpeg\",\n  }),\n  \"reference-2.mp3\",\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": "Wan 2.7 first and last frame URLs",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan2.7' \\\n  -F 'prompt=Move smoothly from the opening frame to the ending frame.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'first_frame=https://your-image-host/first-frame.png' \\\n  -F 'last_frame=https://your-image-host/last-frame.jpg'"
          },
          {
            "lang": "Python",
            "label": "Wan 2.7 first and last frame URLs",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan2.7\")),\n    (\n        \"prompt\",\n        (None, \"Move smoothly from the opening frame to the ending frame.\"),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1280x720\")),\n    (\"first_frame\", (None, \"https://your-image-host/first-frame.png\")),\n    (\"last_frame\", (None, \"https://your-image-host/last-frame.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": "Wan 2.7 first and last frame URLs",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan2.7\");\nform.append(\n  \"prompt\",\n  \"Move smoothly from the opening frame to the ending frame.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\"first_frame\", \"https://your-image-host/first-frame.png\");\nform.append(\"last_frame\", \"https://your-image-host/last-frame.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": "Wan 2.7 uploaded first and last frames",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan2.7' \\\n  -F 'prompt=Move smoothly from the opening frame to the ending frame.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'first_frame=@first-frame.png;type=image/png' \\\n  -F 'last_frame=@last-frame.jpg;type=image/jpeg'"
          },
          {
            "lang": "Python",
            "label": "Wan 2.7 uploaded first and last frames",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"wan2.7\")),\n        (\n            \"prompt\",\n            (None, \"Move smoothly from the opening frame to the ending frame.\"),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1280x720\")),\n        (\n            \"first_frame\",\n            (\n                \"first-frame.png\",\n                stack.enter_context(open(\"first-frame.png\", \"rb\")),\n                \"image/png\",\n            ),\n        ),\n        (\n            \"last_frame\",\n            (\n                \"last-frame.jpg\",\n                stack.enter_context(open(\"last-frame.jpg\", \"rb\")),\n                \"image/jpeg\",\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": "Wan 2.7 uploaded first and last frames",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"wan2.7\");\nform.append(\n  \"prompt\",\n  \"Move smoothly from the opening frame to the ending frame.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\n  \"first_frame\",\n  new Blob([await readFile(\"first-frame.png\")], {\n    type: \"image/png\",\n  }),\n  \"first-frame.png\",\n);\nform.append(\n  \"last_frame\",\n  new Blob([await readFile(\"last-frame.jpg\")], {\n    type: \"image/jpeg\",\n  }),\n  \"last-frame.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": "Wan 3.0 first and last frame URLs",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan3.0' \\\n  -F 'prompt=Move smoothly from the opening frame to the ending frame.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'first_frame=https://your-image-host/first-frame.png' \\\n  -F 'last_frame=https://your-image-host/last-frame.jpg'"
          },
          {
            "lang": "Python",
            "label": "Wan 3.0 first and last frame URLs",
            "source": "import os\n\nimport requests\n\nfields = [\n    (\"model\", (None, \"wan3.0\")),\n    (\n        \"prompt\",\n        (None, \"Move smoothly from the opening frame to the ending frame.\"),\n    ),\n    (\"seconds\", (None, \"5\")),\n    (\"size\", (None, \"1280x720\")),\n    (\"first_frame\", (None, \"https://your-image-host/first-frame.png\")),\n    (\"last_frame\", (None, \"https://your-image-host/last-frame.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": "Wan 3.0 first and last frame URLs",
            "source": "const form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\n  \"prompt\",\n  \"Move smoothly from the opening frame to the ending frame.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\"first_frame\", \"https://your-image-host/first-frame.png\");\nform.append(\"last_frame\", \"https://your-image-host/last-frame.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": "Wan 3.0 uploaded first and last frames",
            "source": "curl https://api.cometapi.com/v1/videos \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -F 'model=wan3.0' \\\n  -F 'prompt=Move smoothly from the opening frame to the ending frame.' \\\n  -F 'seconds=5' \\\n  -F 'size=1280x720' \\\n  -F 'first_frame=@first-frame.png;type=image/png' \\\n  -F 'last_frame=@last-frame.jpg;type=image/jpeg'"
          },
          {
            "lang": "Python",
            "label": "Wan 3.0 uploaded first and last frames",
            "source": "import os\nfrom contextlib import ExitStack\n\nimport requests\n\nwith ExitStack() as stack:\n    fields = [\n        (\"model\", (None, \"wan3.0\")),\n        (\n            \"prompt\",\n            (None, \"Move smoothly from the opening frame to the ending frame.\"),\n        ),\n        (\"seconds\", (None, \"5\")),\n        (\"size\", (None, \"1280x720\")),\n        (\n            \"first_frame\",\n            (\n                \"first-frame.png\",\n                stack.enter_context(open(\"first-frame.png\", \"rb\")),\n                \"image/png\",\n            ),\n        ),\n        (\n            \"last_frame\",\n            (\n                \"last-frame.jpg\",\n                stack.enter_context(open(\"last-frame.jpg\", \"rb\")),\n                \"image/jpeg\",\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": "Wan 3.0 uploaded first and last frames",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst form = new FormData();\nform.append(\"model\", \"wan3.0\");\nform.append(\n  \"prompt\",\n  \"Move smoothly from the opening frame to the ending frame.\",\n);\nform.append(\"seconds\", \"5\");\nform.append(\"size\", \"1280x720\");\nform.append(\n  \"first_frame\",\n  new Blob([await readFile(\"first-frame.png\")], {\n    type: \"image/png\",\n  }),\n  \"first-frame.png\",\n);\nform.append(\n  \"last_frame\",\n  new Blob([await readFile(\"last-frame.jpg\")], {\n    type: \"image/jpeg\",\n  }),\n  \"last-frame.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"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer authentication. Use your CometAPI API key."
      }
    },
    "schemas": {
      "WanCreateRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Wan model ID: wan2.6, wan2.7, wan3.0, or wan3.0-prime. Use wan2.6 for text or reference-video input. Use wan2.7 for text, image/video references, or frame inputs. Use wan3.0 or wan3.0-prime to also include reference audio.",
            "example": "wan3.0"
          },
          "prompt": {
            "type": "string",
            "description": "Text prompt that describes the video to generate. Describe the appearance and motion to preserve from references, or the transition between first_frame and last_frame. For wan2.6 video references, use @Video1, @Video2, and @Video3 in input order.",
            "example": "A small robot walks through a bright greenhouse with smooth camera movement."
          },
          "seconds": {
            "type": "integer",
            "minimum": 2,
            "maximum": 30,
            "description": "Requested output duration in whole seconds. Send an explicit integer. For wan2.6 reference-to-video, use 5 or 10; text-to-video also accepts 15. For wan2.7 reference-to-video, use 2 through 10; text and frame inputs accept 2 through 15. For wan3.0 and wan3.0-prime, use 2 through 30. Default is 5.",
            "example": 5
          },
          "size": {
            "type": "string",
            "description": "Supported WxH size values. For wan3.0 and wan3.0-prime: 832x480, 480x832, 624x624, 640x480, 480x640, 1280x720, 720x1280, 960x960, 1088x832, 832x1088, 1920x1080, 1080x1920, 1440x1440, 1632x1248, 1248x1632. For wan2.6: 1280x720, 720x1280, 1088x832, 832x1088, 1920x1080, 1080x1920, 1440x1440, 1632x1248, 1248x1632. For wan2.7: 1280x720, 720x1280, 1920x1080, 1080x1920, 1440x1440. Default is 1920x1080. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier.",
            "example": "1920x1080"
          },
          "input_reference": {
            "description": "PNG or JPEG reference images for wan2.7, wan3.0, and wan3.0-prime. Repeat input_reference with one publicly accessible HTTPS image URL or uploaded image file per field. Use all URLs or all files within this field. Do not combine URLs into a comma-separated value. A single URL or file uses the image-to-video workflow. Each image can be up to 20 MB. For wan3.0 and wan3.0-prime, send at most 10 reference images, whether you use URLs or uploaded files. Image and video references can share a request; reference audio requires wan3.0 or wan3.0-prime. Submit frame inputs separately. Omit for text-to-video and wan2.6 reference-to-video. 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,
                "items": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://",
                  "description": "One publicly accessible HTTPS reference image URL."
                }
              },
              {
                "title": "Image files",
                "type": "array",
                "minItems": 1,
                "items": {
                  "type": "string",
                  "format": "binary",
                  "description": "One uploaded reference image file."
                }
              }
            ]
          },
          "reference_videos": {
            "type": "array",
            "minItems": 1,
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://"
                },
                {
                  "type": "string",
                  "format": "binary"
                }
              ]
            },
            "description": "Reference videos for wan2.6, wan2.7, wan3.0, and wan3.0-prime. Repeat reference_videos with publicly accessible HTTPS URLs or uploaded MP4 files with H.264 video. Use one input type within this field: all URLs or all files. For wan2.6, send 1 to 3 clips, each 2 to 30 seconds and up to 30 MB, with at least 16 fps; omit image, audio, and frame fields. For wan2.7, combine video references with image references. For wan3.0 and wan3.0-prime, send at most 5 clips totaling at most 15 seconds, with at least 16 fps. Video uploads are limited to 5 files, each at most 50 MiB (50 x 1024 x 1024 bytes); the lower wan2.6 limits still apply. Submit frame inputs separately."
          },
          "reference_audios": {
            "type": "array",
            "minItems": 1,
            "items": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://"
                },
                {
                  "type": "string",
                  "format": "binary"
                }
              ]
            },
            "description": "Reference audio for wan3.0 and wan3.0-prime, combined with image or video references. Repeat reference_audios with publicly accessible HTTPS MP3 URLs or uploaded MP3 files. Use one input type within this field: all URLs or all files. Send at most 5 audio references totaling at most 15 seconds, counted separately from reference video duration. Audio uploads are limited to 5 files, each at most 15 MiB (15 x 1024 x 1024 bytes). Submit frame inputs separately. Omit for wan2.6 and wan2.7."
          },
          "first_frame": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              {
                "type": "string",
                "format": "binary"
              }
            ],
            "description": "Opening frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file. Use first_frame alone or add last_frame to guide the ending. Submit frame inputs in a separate request from input_reference, reference_videos, and reference_audios. Omit for wan2.6. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier."
          },
          "last_frame": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri",
                "pattern": "^https://"
              },
              {
                "type": "string",
                "format": "binary"
              }
            ],
            "description": "Ending frame for wan2.7, wan3.0, and wan3.0-prime, as one publicly accessible HTTPS PNG or JPEG URL or one uploaded PNG or JPEG file. Use with first_frame to guide the ending. Submit frame inputs in a separate request from input_reference, reference_videos, and reference_audios. Omit for wan2.6. For Wan 2.7 frame inputs, the opening image determines the aspect ratio; size selects the output resolution tier."
          }
        },
        "additionalProperties": false
      },
      "WanVideoTask": {
        "type": "object",
        "required": [
          "id",
          "object",
          "model",
          "status",
          "progress",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Task ID. Use this value with retrieve and content endpoints.",
            "example": "task_example"
          },
          "task_id": {
            "type": "string",
            "description": "Compatibility alias for id when present.",
            "example": "task_example"
          },
          "object": {
            "type": "string",
            "description": "Object type. Video tasks return video.",
            "example": "video"
          },
          "model": {
            "type": "string",
            "description": "Model ID used for the task.",
            "example": "wan3.0"
          },
          "status": {
            "type": "string",
            "description": "Task lifecycle status. Poll until the value is completed, failed, or error.",
            "enum": [
              "queued",
              "in_progress",
              "completed",
              "failed",
              "error"
            ],
            "example": "queued"
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100,
            "description": "Task progress as a coarse percentage.",
            "example": 0
          },
          "created_at": {
            "type": "integer",
            "description": "Task creation time as a Unix timestamp in seconds.",
            "example": 1779938152
          },
          "completed_at": {
            "type": "integer",
            "description": "Task completion time as a Unix timestamp in seconds. This field appears on completed tasks.",
            "example": 1779938219
          },
          "video_url": {
            "type": "string",
            "description": "Temporary video delivery URL. This field appears on completed tasks.",
            "example": "<temporary-video-url>"
          },
          "error": {
            "type": "object",
            "description": "Failure details. This field appears when the task fails.",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
