PiAPI
HomeWorkspace
HomeWorkspace
Join Discord
  1. Tools
  • Get Started
    • Overview
    • Quickstart
    • Make Instruction: How to Use PiAPI to Build a Workflow on Make?
  • Endpoints
    • Song(Udio)
      • Song API Task Creation Examples
      • [Udio] Song Extend
      • Get Task
      • Create Task
      • [Udio] Generate Lyrics
    • Kling
      • Lipsync With PiAPI Kling API Examples
      • Motion Brush With PiAPI Kling API Example
      • Kling Elements Video Generation API
      • Kling Effects Video Generation
      • Cancel Task
        • Cancel Tasks
        • Cancel Task
      • Get Task
      • Create Task
      • Kling Virtual Try-On
      • Kling Effects
      • Kling Sound
    • Hailuo
      • Hailuo Director Mode Example
      • Generate Video
      • Get Task
    • Flux
      • Flux with LoRA and Controlnet
      • Available LoRA and Controlnet
      • Flux API with Redux Variation, Fill, Inpaint and Outpaint
      • Create Task
        • Text to Image
        • Image to Image
        • Kontext
      • Get task
    • AI Hug
      • Get Task
      • Create Task
    • LLM
      • Use Cases for GPT-4o Image API
      • How To Avoid Timeouts in Completion API
      • GPT-4o Image Generation API
      • LLM API | Basic Completions
      • Get Task
    • Midjourney
      • PiAPI Penalties on Midjourney Usage
      • Detailed Explaination on Midjourney Task Result
      • Midjourney V7 API Instructions
      • Create Task
        • Imagine
        • Upscale
        • Variation
        • Reroll
        • Describe
        • Seed
        • Blend
        • Inpaint
        • Outpaint
        • Pan
      • Cancel Task
        • Cancel Task
        • Cancel Tasks
      • Get Task
    • Faceswap
      • Multi Faceswap
      • Image Faceswap
      • Video Faceswap
      • Get Task
    • TTS
      • Zeroshot Text-to-Speech F5-TTS
      • Get Task
    • Trellis
      • Create Task
      • Get Task
    • Luma Dream Machine
      • Cancel Task
        • Cancel Tasks
        • Cancel Task
      • Create Task
      • Get Task
    • WanX
      • Generate WanX Task with LoRA Using PiAPI
      • Available LoRA Types for Wanx
      • Use Cases for Wanx LoRA
      • Use Cases for Wanx Control Camera
      • Create Task
      • Get Task
    • Skyreels
      • Create Task
      • Get Task
    • Framepack
      • Create Task
      • Get Task
    • Hunyuan Video
      • How to Make a Hunyuan API Call
      • Get Task
      • Generate Video
    • Mmaudio
      • Get Task
      • Generate Audio
    • DiffRhythm
      • Generate Audio
      • Get Task
    • Ace Step
      • Create Task
        • Text to Audio
        • Audio to Audio
        • Audio Edit
        • Audio Extend
      • Get Task
    • Joycaption
      • Image Caption
      • Get Task
    • Tools
      • File Upload API
      • Remove Background API
        POST
      • Remove Background-Get Task
        GET
      • Segment With Prompt API
        POST
      • Segment With Prompt API-Get Task
        GET
      • Image Upscale(Super Resolution) API
        POST
      • Image Upscale-Get Task
        GET
      • Video Upscale
        POST
      • Video Upscale-Get Task
        GET
      • Video Remove Background
        POST
      • Video Remove Background-Get task
        GET
    • PiAPI Account Management
      • PiAPI Account Info
      • Task List Info
      • User Task History
  • Resources
    • Change Log
    • Output Storage
    • Unified API Schema
    • Webhook
    • Bulk Generation Service
    • Billings
    • PiAPI MCP Server
    • Workspace Manual
      • Host-your-account (HYA) | Back-up Account
      • Host-your-account (HYA) | Debug Checklist
      • Host-your-account (HYA) | Connected Account Status
    • Announcements
      • PiAPI 2025 January 1st Pricing Update
  • Legacy Documentation
    • Midjourney
      • Midjourney Webhook
      • Imagine
      • Reroll
      • Upscale
      • Variation
      • Inpaint
      • Outpaint
      • Pan
      • Describe
      • Blend
      • Seed
      • Fetch
      • Multi Fetch
      • Cancel
    • Face Swap
      • Video Faceswap
      • Multi-face-swap
      • Fetch
    • Dream Machine
      • Video Generation
      • Video Extend
      • Get Video Generation
    • Kling
      • Video Generation
      • Video Extend
      • Get Video Generation
  1. Tools

Video Remove Background

POST
https://api.piapi.ai/api/v1/task

Overview#

The Video Remove Background service uses Qubico/video-toolkit model to generate foreground/background mask video.

Service Limitations#

Video Requirements#

Resolution: Maximum 1024x2048
Frame count: Between 10 and 2000 frames
File size: Maximum 20MB
Format: MP4 only

Pricing#

$0.0004 per frame processed

Request

Header Params
x-api-key
string 
required
Your API Key for authorization
Body Params application/json
model
enum<string> 
required
Allowed value:
Qubico/video-toolkit
task_type
enum<string> 
required
Allowed value:
background-remove
input
object 
required
video
string 
required
Video URL or base64 string (MP4 format only)
invert_output
boolean 
optional
Invert the output image/mask if true.
Default:
false
config
object 
optional
webhook_config
object 
optional
Webhook provides timely task notifications. Check PiAPI webhook for detail.
service_mode
enum<string> 
optional
This allows users to choose whether this specific task will get processed under PAYG or HYA mode. If unspecified, then this task will get processed under whatever mode (PAYG or HYA)
the user chose on the workspace setting of your account.
public means this task will be processed under PAYG mode.
private means this task will be processed under HYA mode.
Allowed values:
publicprivate
Example
{
    "model": "Qubico/video-toolkit",
    "task_type": "background-remove",
    "input": {
        "video": "https://storage.theapi.app/images/playground/20250725/bf82h5de80b.mp4",
        "invert_output": false
    },
    "config": {
        "webhook_config": {
            "endpoint": "https://webhook.site/8ed66cc5-8c97-4926-a452-08aed4b450a5",
            "secret": ""
        }
    }
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.piapi.ai/api/v1/task' \
--header 'x-api-key;' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "Qubico/video-toolkit",
    "task_type": "background-remove",
    "input": {
        "video": "https://storage.theapi.app/images/playground/20250725/bf82h5de80b.mp4",
        "invert_output": false
    },
    "config": {
        "webhook_config": {
            "endpoint": "https://webhook.site/8ed66cc5-8c97-4926-a452-08aed4b450a5",
            "secret": ""
        }
    }
}'

Responses

🟢200Success
application/json
Body
code
integer 
required
data
object 
required
task_id
string 
required
task_type
string 
required
status
string 
required
task_info
object 
required
task_result
object 
required
message
string 
required
Example
{
    "code": 200,
    "data": {
        "task_id": "ef501094-2039-402d-95cb-2e43af39fa03",
        "model": "Qubico/video-toolkit",
        "task_type": "background-remove",
        "status": "pending",
        "config": {
            "service_mode": "",
            "webhook_config": {
                "endpoint": "https://webhook.site/8ed66cc5-8c97-4926-a452-08aed4b450a5",
                "secret": ""
            }
        },
        "input": {
            "video": "https://storage.theapi.app/images/playground/20250725/bf82h5de80b.mp4",
            "invert_output": false
        },
        "output": null,
        "meta": {
            "created_at": "2025-07-25T22:41:18.465048+08:00",
            "started_at": "0001-01-01T00:00:00Z",
            "ended_at": "0001-01-01T00:00:00Z",
            "usage": {
                "type": "llm",
                "frozen": 0,
                "consume": 280000
            },
            "is_using_private_pool": false
        },
        "detail": null,
        "logs": [],
        "error": {
            "code": 0,
            "raw_message": "",
            "message": "",
            "detail": null
        }
    },
    "message": "success"
}
Modified at 2025-07-26 09:22:13
Previous
Video Upscale-Get Task
Next
Video Remove Background-Get task