{
  "openapi": "3.0.3",
  "info": {
    "title": "withoutBG Local API",
    "version": "1.0.0",
    "description": "Loopback Local API shared by withoutBG for Mac and Docker service-* images. Canonical docs: https://withoutbg.com/docs/open-model/local-api"
  },
  "servers": [{ "url": "http://127.0.0.1:8000" }],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health check",
        "responses": { "200": { "description": "OK" } }
      }
    },
    "/openapi.json": {
      "get": {
        "summary": "OpenAPI document",
        "responses": { "200": { "description": "OpenAPI 3 JSON" } }
      }
    },
    "/v1/remove-background": {
      "post": {
        "summary": "Remove background",
        "parameters": [
          {
            "name": "output",
            "in": "query",
            "schema": { "type": "string", "enum": ["cutout", "matte"], "default": "cutout" }
          }
        ],
        "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" } },
                "required": ["image"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "PNG cutout or matte",
            "headers": {
              "X-Latency-Ms": {
                "schema": { "type": "string" },
                "description": "Server-side processing latency in milliseconds"
              }
            },
            "content": { "image/png": { "schema": { "type": "string", "format": "binary" } } }
          },
          "400": { "description": "Invalid or missing image" },
          "500": { "description": "Inference failure" }
        }
      }
    }
  }
}
