{
  "openapi": "3.1.0",
  "info": {
    "title": "Image to Video API",
    "version": "1.0.0",
    "description": "Create a Runway image-to-video task through the official-format CometAPI route."
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/runwayml/v1/image_to_video": {
      "post": {
        "summary": "Create a Runway image-to-video task",
        "operationId": "runway_images_raw_video",
        "description": "Submit a source image plus optional motion prompt and receive a task id for later polling.",
        "parameters": [
          {
            "name": "X-Runway-Version",
            "in": "header",
            "required": true,
            "description": "Runway version header, for example `2024-11-06`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "promptImage",
                  "model"
                ],
                "properties": {
                  "promptImage": {
                    "type": "string",
                    "description": "Source image URL.",
                    "default": "https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg"
                  },
                  "seed": {
                    "type": "integer",
                    "description": "Random seed for reproducible results. Range: 0–999999999."
                  },
                  "model": {
                    "type": "string",
                    "description": "Runway image-to-video model ID. Choose an available model from the [Models page](/overview/models).",
                    "default": "gen3a_turbo"
                  },
                  "promptText": {
                    "type": "string",
                    "description": "Text prompt describing the desired motion or scene. Maximum 512 characters."
                  },
                  "watermark": {
                    "type": "boolean",
                    "description": "Whether to add a watermark to the output video.",
                    "default": false
                  },
                  "duration": {
                    "type": "integer",
                    "description": "Video duration in seconds. Runway support is model/version dependent; use 5 or 10 for the broadest compatibility. CometAPI forwards this value to Runway.",
                    "default": 5
                  },
                  "ratio": {
                    "type": "string",
                    "description": "Requested output ratio. Accepted values are Runway model/version dependent. With X-Runway-Version 2024-11-06, use a resolution-style value accepted by the selected model, such as 1280:768, 768:1280, 1280:720, or 720:1280. Read these as WxH targets, but completed media may normalize, so inspect the returned file before relying on exact pixels.",
                    "default": "1280:768"
                  }
                },
                "default": {
                  "promptImage": "https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg",
                  "seed": 1,
                  "model": "gen3a_turbo",
                  "promptText": "A calm camera move.",
                  "watermark": false,
                  "duration": 5,
                  "ratio": "1280:768"
                }
              },
              "examples": {
                "Default": {
                  "summary": "Default",
                  "value": {
                    "promptImage": "https://cdn.britannica.com/70/234870-050-D4D024BB/Orange-colored-cat-yawns-displaying-teeth.jpg",
                    "seed": 1,
                    "model": "gen3a_turbo",
                    "promptText": "A calm camera move.",
                    "watermark": false,
                    "duration": 5,
                    "ratio": "1280:768"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Task accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    }
                  },
                  "example": {
                    "id": "d0658ae1-bbdd-4adc-aaba-fd8070e14d79"
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell",
            "label": "Default",
            "source": "curl https://api.cometapi.com/runwayml/v1/image_to_video \\\n  -H \"Authorization: Bearer $COMETAPI_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n      \"promptImage\": \"https://your-image-host/first-frame.png\",\n      \"promptText\": \"A calm camera move.\",\n      \"model\": \"gen3a_turbo\",\n      \"ratio\": \"1280:768\",\n      \"duration\": 5\n    }'\n"
          },
          {
            "lang": "Python",
            "label": "Default",
            "source": "import os\nimport requests\n\nresponse = requests.post(\n    \"https://api.cometapi.com/runwayml/v1/image_to_video\",\n    headers={\"Authorization\": \"Bearer \" + os.environ[\"COMETAPI_KEY\"]},\n    json={\n            \"promptImage\": \"https://your-image-host/first-frame.png\",\n            \"promptText\": \"A calm camera move.\",\n            \"model\": \"gen3a_turbo\",\n            \"ratio\": \"1280:768\",\n            \"duration\": 5\n    },\n)\n\ntask = response.json()\nprint(task[\"id\"])  # poll GET /runwayml/v1/tasks/{id} until the output array appears\n"
          },
          {
            "lang": "JavaScript",
            "label": "Default",
            "source": "const response = await fetch(\"https://api.cometapi.com/runwayml/v1/image_to_video\", {\n    method: \"POST\",\n    headers: {\n        Authorization: `Bearer ${process.env.COMETAPI_KEY}`,\n        \"Content-Type\": \"application/json\",\n    },\n    body: JSON.stringify({\n            \"promptImage\": \"https://your-image-host/first-frame.png\",\n            \"promptText\": \"A calm camera move.\",\n            \"model\": \"gen3a_turbo\",\n            \"ratio\": \"1280:768\",\n            \"duration\": 5\n        }),\n});\n\nconst task = await response.json();\nconsole.log(task.id); // poll GET /runwayml/v1/tasks/{id} until the output array appears\n"
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}
