{
  "openapi": "3.1.0",
  "info": {
    "title": "generate(text) API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.cometapi.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/runway/pro/generate": {
      "post": {
        "summary": "generate(text)",
        "operationId": "generate",
        "parameters": [
          {
            "name": "X-Runway-Version",
            "in": "header",
            "required": false,
            "description": "Optional Runway API version header, for example `2024-11-06`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "callback_url",
                  "ratio",
                  "prompt",
                  "style",
                  "model",
                  "options"
                ],
                "properties": {
                  "callback_url": {
                    "type": "string",
                    "description": "Webhook URL that receives a POST request with the result when the task completes.",
                    "default": "https://example.com/webhook"
                  },
                  "ratio": {
                    "type": "string",
                    "description": "Frame ratio for the generated video. Use colon-separated WxH ratio values such as 1280:720, 720:1280, or 960:960 when you need predictable Runway frames; some workflows also accept aspect-ratio labels such as 16:9, 9:16, and 1:1.",
                    "default": "1280:720"
                  },
                  "prompt": {
                    "type": "string",
                    "description": "Text prompt describing the video content to generate.",
                    "default": "A cat sitting on a windowsill."
                  },
                  "style": {
                    "type": "string",
                    "description": "Artistic style for the generated video, e.g. `cinematic`.",
                    "default": "cinematic"
                  },
                  "model": {
                    "type": "string",
                    "description": "Model version to use, e.g. `gen4`.",
                    "default": "gen4"
                  },
                  "options": {
                    "type": "object",
                    "description": "Advanced generation options including duration and camera motion.",
                    "required": [
                      "seconds",
                      "motion_vector"
                    ],
                    "properties": {
                      "seconds": {
                        "type": "integer",
                        "description": "Duration of the generated video in seconds. Use 5 or 10 for standard Runway video generations."
                      },
                      "motion_vector": {
                        "type": "object",
                        "description": "Camera motion control parameters.",
                        "required": [
                          "x",
                          "y",
                          "z",
                          "r",
                          "bg_x_pan",
                          "bg_y_pan"
                        ],
                        "properties": {
                          "x": {
                            "type": "integer",
                            "description": "Horizontal camera movement (left/right)."
                          },
                          "y": {
                            "type": "number",
                            "description": "Vertical camera movement (up/down)."
                          },
                          "z": {
                            "type": "integer",
                            "description": "Depth camera movement (zoom in/out)."
                          },
                          "r": {
                            "type": "integer",
                            "description": "Camera rotation amount."
                          },
                          "bg_x_pan": {
                            "type": "integer",
                            "description": "Horizontal background pan offset."
                          },
                          "bg_y_pan": {
                            "type": "integer",
                            "description": "Vertical background pan offset."
                          }
                        }
                      }
                    },
                    "default": {
                      "seconds": 1,
                      "motion_vector": {
                        "x": 1,
                        "y": 1,
                        "z": 1,
                        "r": 1,
                        "bg_x_pan": 1,
                        "bg_y_pan": 1
                      }
                    }
                  }
                },
                "default": {
                  "callback_url": "https://example.com/webhook",
                  "ratio": "1280:720",
                  "prompt": "A cat sitting on a windowsill.",
                  "style": "cinematic",
                  "model": "gen4",
                  "options": {
                    "seconds": 5,
                    "motion_vector": {
                      "x": 1,
                      "y": 1,
                      "z": 1,
                      "r": 1,
                      "bg_x_pan": 1,
                      "bg_y_pan": 1
                    }
                  }
                }
              },
              "examples": {
                "Default": {
                  "summary": "Default",
                  "value": {
                    "callback_url": "https://example.com/webhook",
                    "ratio": "1280:720",
                    "prompt": "a cat",
                    "style": "cinematic",
                    "model": "gen4",
                    "options": {
                      "seconds": 10,
                      "motion_vector": {
                        "x": 0,
                        "y": 0.3999999999999999,
                        "z": 0,
                        "r": -6,
                        "bg_x_pan": 0,
                        "bg_y_pan": 0
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "code",
                    "data"
                  ],
                  "properties": {
                    "code": {
                      "type": "integer",
                      "description": "HTTP status code returned by the task service."
                    },
                    "data": {
                      "type": "object",
                      "required": [
                        "task_id"
                      ],
                      "properties": {
                        "task_id": {
                          "type": "string",
                          "description": "Task ID returned by the create endpoint."
                        }
                      }
                    },
                    "message": {
                      "type": "string",
                      "description": "Empty on success."
                    },
                    "msg": {
                      "type": "string",
                      "description": "Result message."
                    }
                  },
                  "example": {
                    "code": 200,
                    "message": "",
                    "msg": "success",
                    "data": {
                      "task_id": "196642a0-05e1-441a-981e-eb0c1f5d983b"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Bearer token authentication. Use your CometAPI key."
      }
    }
  }
}
