{
 "openapi": "3.0.3",
 "info": {
  "title": "Mattes and backgrounds (commercial): BiRefNet per frame",
  "version": "2026-11-21",
  "description": "Curated ZeroGPU tool from the ZeroGPU lineup catalog. Calls go straight to the upstream Space innova-ai/video-background-removal; send your own HF token as a bearer token so the call uses your ZeroGPU quota."
 },
 "servers": [
  {
   "url": "https://innova-ai-video-background-removal.hf.space"
  }
 ],
 "x-zerogpu": {
  "category": "Video",
  "slot": "Mattes and backgrounds",
  "need": "Alpha mattes for compositing, or a new background behind a subject.",
  "role": "commercial",
  "space": "innova-ai/video-background-removal",
  "space_url": "https://huggingface.co/spaces/innova-ai/video-background-removal",
  "model": "BiRefNet per frame",
  "license": "MIT",
  "license_class": "open",
  "gpu_seconds_booked": "60",
  "notes": "Replaces the background with a color, image or video. Older but dependable.",
  "caveats": "",
  "lineup_call": "/fn(vid, bg_type, bg_image, bg_video, color, fps, video_handling, fast_mode) \u2192 video",
  "api_style": "v1"
 },
 "components": {
  "securitySchemes": {
   "hfToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "Your own Hugging Face token (read scope is enough). It is sent only to the upstream Space and bills that call to your account's ZeroGPU quota. Without it the call runs on the small anonymous quota."
   }
  },
  "schemas": {}
 },
 "paths": {
  "/gradio_api/call/fn": {
   "post": {
    "description": "Alpha mattes for compositing, or a new background behind a subject. Step 1 of 2: returns {\"event_id\"}; then GET /gradio_api/call/fn/{event_id} reads an SSE stream whose `event: complete` data is the JSON output array (`event: error` on failure). Upstream: https://huggingface.co/spaces/innova-ai/video-background-removal. License: MIT. \n\nUpstream description: \nReturns, in order: Streaming Output: dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: dict()); Final Output Video: dict(video: filepath, subtitles: filepath | None); Time Elapsed: str",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "data"
        ],
        "properties": {
         "data": {
          "type": "array",
          "minItems": 1,
          "maxItems": 9,
          "items": {},
          "description": "Positional inputs, in this order:\n0. vid: dict(video: filepath, subtitles: filepath | None) (required)\n1. bg_type: Literal['Color', 'Image', 'Video'] (default \"Color\")\n2. bg_image: dict(path: str | None (Path to a local file), url: str | None (Publicly available url or base64 encoded image), size: int | None (Size of image in bytes), orig_name: str | None (Original filename), mime_type: str | None (mime type of image), is_stream: bool (Can always be set to False), meta: dict()) (default null)\n3. bg_video: dict(video: filepath, subtitles: filepath | None) (default null)\n4. color: str (default \"#00FF00\")\n5. fps: float (default 0)\n6. video_handling: Literal['slow_down', 'loop'] (default \"slow_down\")\n7. fast_mode: bool (default true)\n8. max_workers: float (default 10)"
         }
        }
       }
      }
     }
    },
    "x-gradio-parameters": [
     {
      "name": "vid",
      "schema": {
       "properties": {
        "video": {
         "description": "The FileData class is a subclass of the GradioModel class that represents a file object within a Gradio interface. It is used to store file data and metadata when a file is uploaded.\n\nAttributes:\n    path: The server file path where the file is stored.\n    url: The normalized server URL pointing to the file.\n    size: The size of the file in bytes.\n    orig_name: The original filename before upload.\n    mime_type: The MIME type of the file.\n    is_stream: Indicates whether the file is a stream.\n    meta: Additional metadata used internally (should not be changed).",
         "properties": {
          "path": {
           "title": "Path",
           "type": "string"
          },
          "url": {
           "type": "string",
           "default": null,
           "title": "Url",
           "nullable": true
          },
          "size": {
           "type": "integer",
           "default": null,
           "title": "Size",
           "nullable": true
          },
          "orig_name": {
           "type": "string",
           "default": null,
           "title": "Orig Name",
           "nullable": true
          },
          "mime_type": {
           "type": "string",
           "default": null,
           "title": "Mime Type",
           "nullable": true
          },
          "is_stream": {
           "default": false,
           "title": "Is Stream",
           "type": "boolean"
          },
          "meta": {
           "properties": {
            "_type": {
             "title": "Type",
             "type": "string",
             "enum": [
              "gradio.FileData"
             ]
            }
           },
           "required": [
            "_type"
           ],
           "title": "FileDataMeta",
           "type": "object"
          }
         },
         "required": [
          "path"
         ],
         "title": "FileData",
         "type": "object"
        },
        "subtitles": {
         "description": "The FileData class is a subclass of the GradioModel class that represents a file object within a Gradio interface. It is used to store file data and metadata when a file is uploaded.\n\nAttributes:\n    path: The server file path where the file is stored.\n    url: The normalized server URL pointing to the file.\n    size: The size of the file in bytes.\n    orig_name: The original filename before upload.\n    mime_type: The MIME type of the file.\n    is_stream: Indicates whether the file is a stream.\n    meta: Additional metadata used internally (should not be changed).",
         "properties": {
          "path": {
           "title": "Path",
           "type": "string"
          },
          "url": {
           "type": "string",
           "default": null,
           "title": "Url",
           "nullable": true
          },
          "size": {
           "type": "integer",
           "default": null,
           "title": "Size",
           "nullable": true
          },
          "orig_name": {
           "type": "string",
           "default": null,
           "title": "Orig Name",
           "nullable": true
          },
          "mime_type": {
           "type": "string",
           "default": null,
           "title": "Mime Type",
           "nullable": true
          },
          "is_stream": {
           "default": false,
           "title": "Is Stream",
           "type": "boolean"
          },
          "meta": {
           "properties": {
            "_type": {
             "title": "Type",
             "type": "string",
             "enum": [
              "gradio.FileData"
             ]
            }
           },
           "required": [
            "_type"
           ],
           "title": "FileDataMeta",
           "type": "object"
          }
         },
         "required": [
          "path"
         ],
         "title": "FileData",
         "type": "object",
         "default": null,
         "nullable": true
        }
       },
       "required": [
        "video"
       ],
       "title": "VideoData",
       "type": "object",
       "additional_description": null
      },
      "required": true,
      "default": null
     },
     {
      "name": "bg_type",
      "schema": {
       "enum": [
        "Color",
        "Image",
        "Video"
       ],
       "title": "Radio",
       "type": "string"
      },
      "required": false,
      "default": "Color"
     },
     {
      "name": "bg_image",
      "schema": {
       "type": "object",
       "required": [
        "path",
        "meta"
       ],
       "description": "A file. Set path to a public https URL (or a path returned by POST /gradio_api/upload on the same Space) and meta to {\"_type\": \"gradio.FileData\"}.",
       "properties": {
        "path": {
         "type": "string"
        },
        "url": {
         "type": "string"
        },
        "orig_name": {
         "type": "string"
        },
        "meta": {
         "type": "object",
         "properties": {
          "_type": {
           "type": "string",
           "enum": [
            "gradio.FileData"
           ]
          }
         }
        }
       }
      },
      "required": false,
      "default": null
     },
     {
      "name": "bg_video",
      "schema": {
       "properties": {
        "video": {
         "description": "The FileData class is a subclass of the GradioModel class that represents a file object within a Gradio interface. It is used to store file data and metadata when a file is uploaded.\n\nAttributes:\n    path: The server file path where the file is stored.\n    url: The normalized server URL pointing to the file.\n    size: The size of the file in bytes.\n    orig_name: The original filename before upload.\n    mime_type: The MIME type of the file.\n    is_stream: Indicates whether the file is a stream.\n    meta: Additional metadata used internally (should not be changed).",
         "properties": {
          "path": {
           "title": "Path",
           "type": "string"
          },
          "url": {
           "type": "string",
           "default": null,
           "title": "Url",
           "nullable": true
          },
          "size": {
           "type": "integer",
           "default": null,
           "title": "Size",
           "nullable": true
          },
          "orig_name": {
           "type": "string",
           "default": null,
           "title": "Orig Name",
           "nullable": true
          },
          "mime_type": {
           "type": "string",
           "default": null,
           "title": "Mime Type",
           "nullable": true
          },
          "is_stream": {
           "default": false,
           "title": "Is Stream",
           "type": "boolean"
          },
          "meta": {
           "properties": {
            "_type": {
             "title": "Type",
             "type": "string",
             "enum": [
              "gradio.FileData"
             ]
            }
           },
           "required": [
            "_type"
           ],
           "title": "FileDataMeta",
           "type": "object"
          }
         },
         "required": [
          "path"
         ],
         "title": "FileData",
         "type": "object"
        },
        "subtitles": {
         "description": "The FileData class is a subclass of the GradioModel class that represents a file object within a Gradio interface. It is used to store file data and metadata when a file is uploaded.\n\nAttributes:\n    path: The server file path where the file is stored.\n    url: The normalized server URL pointing to the file.\n    size: The size of the file in bytes.\n    orig_name: The original filename before upload.\n    mime_type: The MIME type of the file.\n    is_stream: Indicates whether the file is a stream.\n    meta: Additional metadata used internally (should not be changed).",
         "properties": {
          "path": {
           "title": "Path",
           "type": "string"
          },
          "url": {
           "type": "string",
           "default": null,
           "title": "Url",
           "nullable": true
          },
          "size": {
           "type": "integer",
           "default": null,
           "title": "Size",
           "nullable": true
          },
          "orig_name": {
           "type": "string",
           "default": null,
           "title": "Orig Name",
           "nullable": true
          },
          "mime_type": {
           "type": "string",
           "default": null,
           "title": "Mime Type",
           "nullable": true
          },
          "is_stream": {
           "default": false,
           "title": "Is Stream",
           "type": "boolean"
          },
          "meta": {
           "properties": {
            "_type": {
             "title": "Type",
             "type": "string",
             "enum": [
              "gradio.FileData"
             ]
            }
           },
           "required": [
            "_type"
           ],
           "title": "FileDataMeta",
           "type": "object"
          }
         },
         "required": [
          "path"
         ],
         "title": "FileData",
         "type": "object",
         "default": null,
         "nullable": true
        }
       },
       "required": [
        "video"
       ],
       "title": "VideoData",
       "type": "object",
       "additional_description": null
      },
      "required": false,
      "default": null
     },
     {
      "name": "color",
      "schema": {
       "type": "string"
      },
      "required": false,
      "default": "#00FF00"
     },
     {
      "name": "fps",
      "schema": {
       "type": "number",
       "description": "numeric value between 0 and 60"
      },
      "required": false,
      "default": 0
     },
     {
      "name": "video_handling",
      "schema": {
       "enum": [
        "slow_down",
        "loop"
       ],
       "title": "Radio",
       "type": "string"
      },
      "required": false,
      "default": "slow_down"
     },
     {
      "name": "fast_mode",
      "schema": {
       "type": "boolean"
      },
      "required": false,
      "default": true
     },
     {
      "name": "max_workers",
      "schema": {
       "type": "number",
       "description": "numeric value between 1 and 32"
      },
      "required": false,
      "default": 10
     }
    ],
    "operationId": "video_mattes_and_backgrounds_commercial",
    "tags": [
     "Video"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ],
    "summary": "Mattes and backgrounds (commercial): BiRefNet per frame",
    "responses": {
     "200": {
      "description": "Job accepted.",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "required": [
          "event_id"
         ],
         "properties": {
          "event_id": {
           "type": "string"
          }
         }
        }
       }
      }
     }
    }
   }
  },
  "/gradio_api/call/fn/{event_id}": {
   "get": {
    "summary": "Read the result stream for /fn",
    "description": "Server-sent events. The final `event: complete` carries a JSON array of outputs; `event: error` means the call failed.",
    "parameters": [
     {
      "name": "event_id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "SSE stream",
      "content": {
       "text/event-stream": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "operationId": "video_mattes_and_backgrounds_commercial_result",
    "tags": [
     "Video"
    ],
    "security": [
     {
      "hfToken": []
     },
     {}
    ]
   }
  }
 }
}