{"info":{"title":"ZhengPeng7/birefnet","version":"1.0.0"},"paths":{"/":{"post":{"summary":"Generate","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Output"}}},"description":"Successful Response"}},"operationId":"zhengpeng7_birefnet_generate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Input"}}},"required":true}}}},"openapi":"3.1.0","components":{"schemas":{"Input":{"type":"object","title":"Input","required":["image"],"properties":{"image":{"type":"string","title":"Image","format":"uri","x-order":0,"description":"Source image to cut out. Still images (PNG, JPEG, WebP) are the normal case. An animated GIF or WebP is also accepted and comes back as an animated WebP with transparency, processed frame by frame — cost and turnaround scale with the frame count. Video files are not supported."},"variant":{"allOf":[{"$ref":"#/components/schemas/VariantEnum"}],"title":"Variant","default":"general","x-order":1,"description":"Which BiRefNet checkpoint to run. 'general' is the all-purpose default. Pick a specialist when your subject fits one: 'portrait' for people, 'matting' or 'dynamic-matting' for hair and fur, 'toonout' for anime and flat-colour illustration, 'lite' / 'lite-2k' / 'lite-matting' for a smaller, faster backbone. The '-hr' and '-2k' checkpoints infer at a higher internal resolution for a more accurate matte — the returned image is still the size of your input, never larger."},"mask_blur":{"type":"integer","title":"Mask Blur","default":0,"maximum":64,"minimum":0,"x-order":5,"description":"Gaussian blur radius in pixels applied to the matte, softening the cut edge."},"precision":{"allOf":[{"$ref":"#/components/schemas/PrecisionEnum"}],"title":"Precision","default":"fp32","x-order":7,"description":"GPU inference precision. 'fp32' is full precision and the default; 'fp16' is somewhat faster and uses less memory, with negligible quality difference."},"refine_fg":{"type":"boolean","title":"Refine Fg","default":false,"x-order":4,"description":"Refine foreground colours (FB blur fusion) so soft edges do not carry colour bleed from the original background. Worth enabling when compositing onto a light or strongly coloured backdrop. Ignored when output_format is 'mask'."},"resolution":{"type":"integer","title":"Resolution","default":0,"maximum":2048,"minimum":0,"x-order":3,"description":"Square inference resolution. 0 uses the chosen checkpoint's native resolution (1024, or 2048 for the HR and 2K checkpoints). This sets how finely the matte is computed, not the size of the returned image — the output always matches the input's dimensions. Higher values cost more compute time."},"mask_offset":{"type":"integer","title":"Mask Offset","default":0,"maximum":64,"minimum":-64,"x-order":6,"description":"Grow (positive) or shrink (negative) the matte by this many pixels. A small positive value removes a thin background fringe; a small negative value bites into the subject."},"output_format":{"allOf":[{"$ref":"#/components/schemas/OutputFormatEnum"}],"title":"Output Format","default":"cutout","x-order":2,"description":"'cutout' returns an RGBA image with the background removed. 'mask' returns the raw single-channel alpha matte instead, for pipelines that key the subject themselves."}}},"Output":{"type":"string","title":"Output","format":"uri","description":"URL of the result image: an RGBA cutout with a transparent background, or the single-channel alpha matte when output_format is 'mask'. Dimensions match the input image."},"VariantEnum":{"enum":["general","general-hr","portrait","matting","matting-hr","dynamic","dynamic-matting","lite","lite-2k","lite-matting","toonout"],"type":"string","title":"VariantEnum","description":"BiRefNet checkpoint. 'general' — all-purpose default. 'general-hr' — the general checkpoint trained for high-resolution photos, inferring at 2048. 'portrait' — tuned for people. 'matting' — soft-edge matting for hair, fur and fine detail. 'matting-hr' — matting at high resolution. 'dynamic' — trained across a wide range of input resolutions. 'dynamic-matting' — the matting counterpart of 'dynamic'. 'lite' — a smaller, faster backbone for general use. 'lite-2k' — the lite backbone at 2K-class resolution. 'lite-matting' — the matting task on the lite backbone. 'toonout' — a community fine-tune for anime and stylised illustration by the ToonOut authors (Muratori and Seytre, MIT-licensed), not one of the original BiRefNet checkpoints."},"PrecisionEnum":{"enum":["fp16","fp32"],"type":"string","title":"PrecisionEnum","description":"GPU inference precision: 'fp32' full precision, 'fp16' half precision."},"OutputFormatEnum":{"enum":["cutout","mask"],"type":"string","title":"OutputFormatEnum","description":"'cutout' = RGBA image with the background removed; 'mask' = the raw single-channel alpha matte."}}}}