{
  "openapi": "3.0.1",
  "info": {
    "title": "Video Background Remover",
    "version": "0.6",
    "x-build-id": "fngIK4llvtxkJ9f63"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/andrew_babo~video-background-remover/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-andrew_babo-video-background-remover",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/andrew_babo~video-background-remover/runs": {
      "post": {
        "operationId": "runs-sync-andrew_babo-video-background-remover",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/andrew_babo~video-background-remover/run-sync": {
      "post": {
        "operationId": "run-sync-andrew_babo-video-background-remover",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "videoUrl"
        ],
        "properties": {
          "videoUrl": {
            "title": "Video URL",
            "type": "string",
            "description": "Direct link to the source video (MP4/MOV/WebM, H.264/H.265/VP9). Must be downloadable without login. Output keeps the source resolution, frame rate and audio."
          },
          "target": {
            "title": "What to cut out",
            "enum": [
              "person",
              "object"
            ],
            "type": "string",
            "description": "person: the main person in frame (human matting model, no selection needed, fastest). object: any single thing — a dog, a cat, a product, a car, a logo — chosen with objectPrompt, objectBox, objectPoint or objectMaskUrl and tracked through the video.",
            "default": "person"
          },
          "outputMode": {
            "title": "Output",
            "enum": [
              "green",
              "matte",
              "demo"
            ],
            "type": "string",
            "description": "green: subject on pure green (#00FF00) for chroma keying. matte: grayscale alpha matte video (white = subject) to use as a luma/track matte. demo: subject composited on a dark studio background for a quick visual check.",
            "default": "green"
          },
          "objectPrompt": {
            "title": "Object description (AI picks it)",
            "type": "string",
            "description": "target=object only. Plain-text description of the thing to cut out, e.g. \"the golden retriever\", \"the red coffee mug on the table\", \"the white car\". A vision model draws the box on the selection frame and again after every scene cut. Needs visionApiKey (or the actor owner's MATTE_AI_* environment). Ignored when objectBox / objectPoint / objectMaskUrl is given, except as a hint for re-finding the object after cuts."
          },
          "objectBox": {
            "title": "Object box [x1, y1, x2, y2]",
            "type": "array",
            "description": "target=object only. Rectangle around the object on the selection frame, in pixels of the source video (or fractions 0-1 of width/height). Example: [448, 311, 1221, 902]. No vision model needed."
          },
          "objectPoint": {
            "title": "Object point [x, y]",
            "type": "array",
            "description": "target=object only. One pixel inside the object on the selection frame (pixels, or fractions 0-1). Example: [947, 595]. No vision model needed."
          },
          "objectMaskUrl": {
            "title": "Object mask image URL (painted selection)",
            "type": "string",
            "description": "target=object only. URL of a PNG/JPG the same size as the video (or any size, it is scaled) where the object is painted white / opaque and the rest is black / transparent — a brush stroke over the object is enough, it is snapped to the object edges. Takes priority over objectBox, objectPoint and objectPrompt."
          },
          "selectionFrame": {
            "title": "Selection frame",
            "minimum": 0,
            "type": "integer",
            "description": "target=object only. 0-based frame index the box / point / mask / prompt refers to. Pick a frame where the whole object is visible; tracking runs backwards and forwards from it inside that shot.",
            "default": 0
          },
          "previewOnly": {
            "title": "Preview only (no video)",
            "type": "boolean",
            "description": "target=object only. Segment just the selection frame and return previewUrl (frame with the picked object tinted green + box) and previewMaskUrl. Takes a few seconds; use it to confirm the right object was picked before rendering.",
            "default": false
          },
          "visionApiKey": {
            "title": "Vision model API key",
            "type": "string",
            "description": "Only for objectPrompt (and for re-finding a lost object after scene cuts). Key for an OpenAI-compatible chat-completions endpoint that accepts images: OpenAI, OpenRouter, Google Gemini (OpenAI-compatible endpoint), etc. Stored encrypted, never logged. A run makes 1 call per scene cut plus 1 per worker start after a cut (typically 1–10 small calls, ~1.2k tokens each)."
          },
          "visionBaseUrl": {
            "title": "Vision API base URL",
            "type": "string",
            "description": "Base URL of the OpenAI-compatible API. Examples: https://api.openai.com/v1 (default), https://openrouter.ai/api/v1, https://generativelanguage.googleapis.com/v1beta/openai.",
            "default": "https://api.openai.com/v1"
          },
          "visionModel": {
            "title": "Vision model",
            "type": "string",
            "description": "Model id that accepts images and returns JSON. Examples: gpt-4.1-mini (default, OpenAI), gpt-5-mini, google/gemini-2.5-flash (OpenRouter), gemini-2.5-flash (Gemini endpoint).",
            "default": "gpt-4.1-mini"
          },
          "maxAiCalls": {
            "title": "Max vision calls per run",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on vision model requests in one run (cost guard). When reached, the object is simply not re-found after further cuts and the row carries the AI_BUDGET_EXCEEDED warning.",
            "default": 60
          },
          "startFrame": {
            "title": "Start frame",
            "minimum": 0,
            "type": "integer",
            "description": "First frame to render (0-based). Use with endFrame to split one long video across several runs and stitch the slices afterwards."
          },
          "endFrame": {
            "title": "End frame (exclusive)",
            "minimum": 1,
            "type": "integer",
            "description": "Render frames up to, but not including, this index. Leave empty for the rest of the video."
          },
          "workers": {
            "title": "Worker processes",
            "minimum": 0,
            "maximum": 32,
            "type": "integer",
            "description": "Parallel matting processes inside this run. 0 = one per available vCPU (recommended).",
            "default": 0
          },
          "parallelRuns": {
            "title": "Parallel runs (object)",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "Split the video over this many parallel runs of the actor and stitch the slices - same masks, much shorter wait. Off by default (1 = one run); only worth it when your plan can run several machines at once (total memory above 16 GB). Only for target=object without startFrame/endFrame.",
            "default": 1
          },
          "parallelMemoryMbytes": {
            "title": "Memory per parallel run",
            "minimum": 4096,
            "maximum": 32768,
            "type": "integer",
            "description": "Memory (MB) for each parallel run; 8192 gives 4 vCPUs. Only used when parallelRuns applies.",
            "default": 8192
          },
          "crf": {
            "title": "x264 quality (CRF)",
            "minimum": 10,
            "maximum": 30,
            "type": "integer",
            "description": "Lower is better quality and bigger files. 17 is visually lossless.",
            "default": 17
          },
          "x264Preset": {
            "title": "x264 preset",
            "enum": [
              "ultrafast",
              "superfast",
              "veryfast",
              "faster",
              "fast",
              "medium"
            ],
            "type": "string",
            "description": "Encoder speed/size trade-off. superfast keeps encoding under 10% of the render time.",
            "default": "superfast"
          },
          "sliceFormat": {
            "title": "Slice container",
            "enum": [
              "ts",
              "mp4"
            ],
            "type": "string",
            "description": "Only with startFrame/endFrame. ts (default) slices stitch frame-exact with `ffmpeg -f concat -c copy`; mp4 slices are playable on their own but can lose a frame at each seam when concatenated.",
            "default": "ts"
          },
          "outputKey": {
            "title": "Output file name",
            "type": "string",
            "description": "Key of the rendered video in the run's key-value store. Previews and the selection snapshot use the same name with -preview / -selection suffixes.",
            "default": "output.mp4"
          },
          "disableSmartCrop": {
            "title": "Disable smart crop (person)",
            "type": "boolean",
            "description": "target=person only. Always run the model on the whole frame instead of a window around the person. Slower; only for debugging.",
            "default": false
          },
          "maxFrames": {
            "title": "Max frames",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many frames (benchmarking aid). 0 = whole video.",
            "default": 0
          },
          "demoLabel": {
            "title": "Demo label",
            "type": "string",
            "description": "Caption drawn on the demo composite background.",
            "default": "CREMYX   /   FAST MATTE"
          },
          "visionReasoning": {
            "title": "Vision reasoning effort",
            "enum": [
              "low",
              "medium",
              "high",
              "none"
            ],
            "type": "string",
            "description": "reasoning_effort sent to the vision model (low keeps calls at ~2 s). Set to none for models without a reasoning knob; the actor also drops it automatically when the provider rejects it.",
            "default": "low"
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}