{
  "openapi": "3.1.0",
  "info": {
    "title": "withoutBG Pro Model Self-Host",
    "description": "Background removal with edge refinement and Smart Brush (Keep / Remove), on your own CPU servers. For AI coding assistants: [/llms.txt](/llms.txt)",
    "version": "10.12.4"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Health",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": {
                    "type": "string"
                  },
                  "type": "object",
                  "title": "Response Health Health Get"
                }
              }
            }
          }
        }
      }
    },
    "/ready": {
      "get": {
        "tags": [
          "health"
        ],
        "summary": "Ready",
        "operationId": "ready_ready_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/v1/remove-background": {
      "post": {
        "tags": [
          "inference"
        ],
        "summary": "Remove background from an image",
        "operationId": "remove_background_v1_remove_background_post",
        "parameters": [
          {
            "name": "output",
            "in": "query",
            "required": false,
            "schema": {
              "enum": [
                "cutout",
                "matte"
              ],
              "type": "string",
              "description": "PNG result kind: transparent cutout or alpha matte (black and white)",
              "default": "cutout",
              "title": "Output"
            },
            "description": "PNG result kind: transparent cutout or alpha matte (black and white)"
          }
        ],
        "responses": {
          "200": {
            "description": "PNG cutout or matte",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            },
            "headers": {
              "X-Latency-Ms": {
                "description": "Server-side inference latency in milliseconds",
                "schema": {
                  "type": "integer"
                }
              },
              "X-Route-Category": {
                "description": "Router category, e.g. fine_strand or vehicle (routed bundles)",
                "schema": {
                  "type": "string"
                }
              },
              "X-Route-Pipeline": {
                "description": "Branch that produced the alpha: matting or birefnet (routed bundles)",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid image input",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Invalid Keep / Remove mask or matte, or the bundle has no stroke-edit graph",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Model not ready",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "image/jpeg": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "image/png": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            },
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "image": {
                    "type": "string",
                    "format": "binary"
                  },
                  "keep_mask": {
                    "type": "string",
                    "format": "binary"
                  },
                  "remove_mask": {
                    "type": "string",
                    "format": "binary"
                  },
                  "matte": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/remove-background/base64": {
      "post": {
        "tags": [
          "inference"
        ],
        "summary": "Remove background: base64 image in, base64 image out",
        "description": "JSON in, JSON out, no data-URL prefixes.\n\nSmart Brush: send `keep_mask` and / or `remove_mask` (images the size of `image`),\nplus the `matte` returned for it to keep earlier fixes.",
        "operationId": "remove_background_base64_v1_remove_background_base64_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Base64Request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Base64Response"
                }
              }
            }
          },
          "400": {
            "description": "Invalid image input"
          },
          "422": {
            "description": "Invalid Smart Brush mask or matte (not an image, or not the image's size)"
          },
          "503": {
            "description": "Model not ready"
          }
        }
      }
    },
    "/v1/licenses": {
      "get": {
        "tags": [
          "licenses"
        ],
        "summary": "Licenses",
        "operationId": "licenses_v1_licenses_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LicensesResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Base64Request": {
        "properties": {
          "image": {
            "type": "string",
            "title": "Image",
            "description": "Input image, base64 (a data URL is accepted too)"
          },
          "keep_mask": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Keep Mask",
            "description": "Smart Brush Keep mask, base64: the size of the image after EXIF orientation, white (light, opaque) pixels mark what to keep."
          },
          "remove_mask": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remove Mask",
            "description": "Smart Brush Remove mask, same rules as keep_mask. Where both mark a pixel, Remove wins."
          },
          "matte": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Matte",
            "description": "Optional, needs keep_mask or remove_mask: the `matte` this endpoint returned for the image. It is edited instead of recomputed, so earlier fixes are kept."
          },
          "output": {
            "type": "string",
            "enum": [
              "cutout",
              "matte"
            ],
            "title": "Output",
            "description": "What `image` holds: the transparent cutout or the alpha matte",
            "default": "cutout"
          }
        },
        "type": "object",
        "required": [
          "image"
        ],
        "title": "Base64Request"
      },
      "Base64Response": {
        "properties": {
          "image": {
            "type": "string",
            "title": "Image",
            "description": "Base64 PNG: the cutout, or the matte when output is matte"
          },
          "matte": {
            "type": "string",
            "title": "Matte",
            "description": "Base64 PNG alpha matte (send it back with the next Smart Brush edit)"
          },
          "latencyMs": {
            "type": "integer",
            "title": "Latencyms",
            "description": "Server-side inference latency in milliseconds"
          },
          "routeCategory": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Routecategory",
            "description": "Router category, e.g. fine_strand or vehicle"
          },
          "routePipeline": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Routepipeline",
            "description": "Branch that produced the alpha: matting or birefnet"
          }
        },
        "type": "object",
        "required": [
          "image",
          "matte",
          "latencyMs"
        ],
        "title": "Base64Response"
      },
      "LicenseLink": {
        "properties": {
          "label": {
            "type": "string",
            "title": "Label"
          },
          "href": {
            "type": "string",
            "title": "Href"
          }
        },
        "type": "object",
        "required": [
          "label",
          "href"
        ],
        "title": "LicenseLink"
      },
      "LicensesResponse": {
        "properties": {
          "product_version": {
            "type": "string",
            "title": "Product Version"
          },
          "product_license": {
            "type": "string",
            "title": "Product License"
          },
          "product_license_url": {
            "type": "string",
            "title": "Product License Url"
          },
          "upstream_components": {
            "items": {
              "$ref": "#/components/schemas/UpstreamComponent"
            },
            "type": "array",
            "title": "Upstream Components"
          },
          "third_party_notices_path": {
            "type": "string",
            "title": "Third Party Notices Path"
          }
        },
        "type": "object",
        "required": [
          "product_version",
          "product_license",
          "product_license_url",
          "upstream_components",
          "third_party_notices_path"
        ],
        "title": "LicensesResponse"
      },
      "UpstreamComponent": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          },
          "license": {
            "type": "string",
            "title": "License"
          },
          "links": {
            "items": {
              "$ref": "#/components/schemas/LicenseLink"
            },
            "type": "array",
            "title": "Links"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "type": "object",
        "required": [
          "name",
          "license",
          "links"
        ],
        "title": "UpstreamComponent"
      }
    }
  },
  "servers": [
    {
      "url": "http://localhost:8000",
      "description": "Your container"
    }
  ]
}
