{
  "openapi": "3.1.0",
  "info": {
    "title": "Omni Video Create API",
    "version": "1.0.0",
    "description": "Create an asynchronous beta Omni text-to-video, image-to-video, or reference-video editing task 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 an Omni video task",
        "operationId": "omni_create_video",
        "description": "Create a beta Omni text-to-video or image-to-video task with multipart/form-data, or a reference-video editing task with application/json.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/OmniCreateRequest"
              },
              "examples": {
                "text_to_video": {
                  "summary": "Text-to-video",
                  "value": {
                    "model": "omni-fast",
                    "prompt": "Ocean waves rolling onto a sandy beach at golden hour",
                    "seconds": "4",
                    "aspect_ratio": "16:9",
                    "resolution": "720p"
                  }
                },
                "image_to_video": {
                  "summary": "Image-to-video with one PNG reference",
                  "value": {
                    "model": "omni-fast",
                    "prompt": "Animate the uploaded reference image with gentle movement while preserving its colors, shapes, and layout.",
                    "seconds": "4",
                    "aspect_ratio": "16:9",
                    "resolution": "720p",
                    "input_reference": "<binary PNG file>"
                  }
                }
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OmniVideoEditRequest"
              },
              "examples": {
                "video_to_video": {
                  "summary": "Video-to-video with an inline MP4",
                  "value": {
                    "model": "omni-fast-v2v",
                    "prompt": "Change the background to ocean blue. Preserve every foreground object and its motion.",
                    "video": "data:video/mp4;base64,<your-video-base64>",
                    "seconds": "4",
                    "aspect_ratio": "16:9",
                    "resolution": "720p"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task accepted. Store the returned id and poll GET /v1/videos/{task_id}.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OmniVideoTask"
                },
                "example": {
                  "id": "task_example",
                  "task_id": "task_example",
                  "object": "video",
                  "model": "omni-fast",
                  "status": "queued",
                  "progress": 0,
                  "created_at": 1779938152
                }
              }
            }
          }
        },
        "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=omni-fast \\\n  -F 'prompt=Ocean waves rolling onto a sandy beach at golden hour' \\\n  -F seconds=4 \\\n  -F aspect_ratio=16:9 \\\n  -F resolution=720p"
          },
          {
            "lang": "Python",
            "label": "Text-to-video",
            "source": "import os\nimport requests\n\nfields = [\n    (\"model\", (None, \"omni-fast\")),\n    (\"prompt\", (None, \"Ocean waves rolling onto a sandy beach at golden hour\")),\n    (\"seconds\", (None, \"4\")),\n    (\"aspect_ratio\", (None, \"16:9\")),\n    (\"resolution\", (None, \"720p\")),\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\", \"omni-fast\");\nform.append(\"prompt\", \"Ocean waves rolling onto a sandy beach at golden hour\");\nform.append(\"seconds\", \"4\");\nform.append(\"aspect_ratio\", \"16:9\");\nform.append(\"resolution\", \"720p\");\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=omni-fast \\\n  -F 'prompt=Animate the uploaded reference image with gentle movement while preserving its colors, shapes, and layout.' \\\n  -F seconds=4 \\\n  -F aspect_ratio=16:9 \\\n  -F resolution=720p \\\n  -F 'input_reference=@reference.png;type=image/png'"
          },
          {
            "lang": "Python",
            "label": "Image-to-video",
            "source": "import os\nfrom pathlib import Path\n\nimport requests\n\nwith Path(\"reference.png\").open(\"rb\") as reference:\n    fields = [\n        (\"model\", (None, \"omni-fast\")),\n        (\"prompt\", (None, \"Animate the uploaded reference image with gentle movement while preserving its colors, shapes, and layout.\")),\n        (\"seconds\", (None, \"4\")),\n        (\"aspect_ratio\", (None, \"16:9\")),\n        (\"resolution\", (None, \"720p\")),\n        (\"input_reference\", (\"reference.png\", reference, \"image/png\")),\n    ]\n\n    response = 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": "Image-to-video",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst reference = await readFile(\"reference.png\");\nconst form = new FormData();\nform.append(\"model\", \"omni-fast\");\nform.append(\"prompt\", \"Animate the uploaded reference image with gentle movement while preserving its colors, shapes, and layout.\");\nform.append(\"seconds\", \"4\");\nform.append(\"aspect_ratio\", \"16:9\");\nform.append(\"resolution\", \"720p\");\nform.append(\"input_reference\", new Blob([reference], { type: \"image/png\" }), \"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\nconst result = await response.json();\nconsole.log(result);\n"
          },
          {
            "lang": "Shell",
            "label": "Video-to-video",
            "source": "curl \"https://api.cometapi.com/v1/videos\" \\\n  --request POST \\\n  --header \"Authorization: Bearer $COMETAPI_KEY\" \\\n  --header \"Content-Type: application/json\" \\\n  --data-binary @- <<'JSON'\n{\n  \"model\": \"omni-fast-v2v\",\n  \"prompt\": \"Change the background to ocean blue. Preserve every foreground object and its motion.\",\n  \"video\": \"data:video/mp4;base64,<base64-encoded-mp4>\",\n  \"seconds\": \"4\",\n  \"aspect_ratio\": \"16:9\",\n  \"resolution\": \"720p\"\n}\nJSON"
          },
          {
            "lang": "Python",
            "label": "Video-to-video",
            "source": "import base64\nimport os\nfrom pathlib import Path\n\nimport requests\n\nvideo_data = base64.b64encode(Path(\"reference.mp4\").read_bytes()).decode(\"ascii\")\n\nresponse = requests.post(\n    \"https://api.cometapi.com/v1/videos\",\n    headers={\n        \"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"],\n        \"Content-Type\": \"application/json\",\n    },\n    json={\n        \"model\": \"omni-fast-v2v\",\n        \"prompt\": \"Change the background to ocean blue. Preserve every foreground object and its motion.\",\n        \"video\": \"data:video/mp4;base64,\" + video_data,\n        \"seconds\": \"4\",\n        \"aspect_ratio\": \"16:9\",\n        \"resolution\": \"720p\",\n    },\n    timeout=120,\n)\n\nresponse.raise_for_status()\nprint(response.json())\n"
          },
          {
            "lang": "JavaScript",
            "label": "Video-to-video",
            "source": "import { readFile } from \"node:fs/promises\";\n\nconst videoData = (await readFile(\"reference.mp4\")).toString(\"base64\");\n\nconst response = await fetch(\"https://api.cometapi.com/v1/videos\", {\n  method: \"POST\",\n  headers: {\n    Authorization: `Bearer ${process.env.COMETAPI_KEY}`,\n    \"Content-Type\": \"application/json\",\n  },\n  body: JSON.stringify({\n    model: \"omni-fast-v2v\",\n    prompt: \"Change the background to ocean blue. Preserve every foreground object and its motion.\",\n    video: `data:video/mp4;base64,${videoData}`,\n    seconds: \"4\",\n    aspect_ratio: \"16:9\",\n    resolution: \"720p\",\n  }),\n});\n\nconst result = await response.json();\nconsole.log(result);\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer authentication. Use your CometAPI API key."
      }
    },
    "schemas": {
      "OmniCreateRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Omni model ID for this endpoint. Use omni-fast for text-to-video and image-to-video.",
            "example": "omni-fast"
          },
          "prompt": {
            "type": "string",
            "description": "Text prompt that describes the video to generate. For image-to-video, focus on motion and name the reference content that should be preserved.",
            "example": "Ocean waves rolling onto a sandy beach at golden hour"
          },
          "input_reference": {
            "type": "string",
            "format": "binary",
            "description": "One PNG reference image uploaded as a multipart file. Optional for text-to-video and required for image-to-video. This contract does not define URL input, other image formats, multiple references, or a file-size limit."
          },
          "seconds": {
            "type": "string",
            "description": "Requested clip duration in seconds. The completed video can use a different duration.",
            "example": "4"
          },
          "aspect_ratio": {
            "type": "string",
            "description": "Output aspect ratio preference. 16:9 and 9:16 are the most predictable; 1:1 can be accepted but may render as landscape.",
            "enum": [
              "16:9",
              "9:16",
              "1:1"
            ],
            "default": "16:9",
            "example": "16:9"
          },
          "resolution": {
            "type": "string",
            "description": "Output resolution preference. Start with 720p. A request for 1080p can render at 720p.",
            "example": "720p"
          }
        },
        "additionalProperties": false
      },
      "OmniVideoEditRequest": {
        "type": "object",
        "required": [
          "model",
          "prompt",
          "video"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Omni model ID for video-to-video. Confirm that the model ID is visible to your API key with GET /v1/models.",
            "example": "omni-fast-v2v"
          },
          "prompt": {
            "type": "string",
            "description": "Text instructions that describe the requested edit and the source content that the result should preserve.",
            "example": "Change the background to ocean blue. Preserve every foreground object and its motion."
          },
          "video": {
            "type": "string",
            "description": "Reference MP4 as a data URL. Prefix the MP4 file bytes encoded as base64 with data:video/mp4;base64,. This field determines the source video to edit.",
            "example": "data:video/mp4;base64,<your-video-base64>"
          },
          "seconds": {
            "type": "string",
            "description": "Requested clip duration in seconds. Start with 4 for an inline MP4 edit.",
            "example": "4"
          },
          "aspect_ratio": {
            "type": "string",
            "description": "Output aspect ratio preference. 16:9 and 9:16 are the most predictable; 1:1 can be accepted but may render as landscape.",
            "enum": [
              "16:9",
              "9:16",
              "1:1"
            ],
            "default": "16:9",
            "example": "16:9"
          },
          "resolution": {
            "type": "string",
            "description": "Output resolution preference. Start with 720p. 1080p can be accepted but current production output may normalize to 720p.",
            "example": "720p"
          }
        },
        "additionalProperties": false
      },
      "OmniVideoTask": {
        "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": "omni-fast"
          },
          "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.",
            "properties": {
              "code": {
                "type": "string",
                "description": "Provider or CometAPI error code."
              },
              "message": {
                "type": "string",
                "description": "Human-readable failure reason."
              },
              "type": {
                "type": "string",
                "description": "Error category when returned."
              }
            },
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}
