{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Similarity Search & Clustering (CLIP / SigLIP)",
    "description": "Find visually similar images, group a photo collection into clusters of look-alikes, or search images with text. Self-hosted CLIP and SigLIP AI embeddings on CPU with cosine similarity scores. No external APIs.",
    "version": "1.0",
    "x-build-id": "gq3v9F2m5AVgh8uNL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/freecamp008~image-similarity-search/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-freecamp008-image-similarity-search",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/freecamp008~image-similarity-search/runs": {
      "post": {
        "operationId": "runs-sync-freecamp008-image-similarity-search",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/freecamp008~image-similarity-search/run-sync": {
      "post": {
        "operationId": "run-sync-freecamp008-image-similarity-search",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "imageUrls"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "find-similar",
              "cluster",
              "text-search",
              "embeddings"
            ],
            "type": "string",
            "description": "<b>find-similar</b>: for every query image, the most similar images in the collection (without query images, every image is compared with all others). <b>cluster</b>: group the collection into clusters of visually similar images (near-duplicates, same product, same scene). <b>text-search</b>: rank the collection for each text query, e.g. <code>red sneakers on a white background</code>. <b>embeddings</b>: just return one embedding vector per image.",
            "default": "find-similar"
          },
          "imageUrls": {
            "title": "Image collection (URLs)",
            "type": "array",
            "description": "The images to search, compare or cluster (JPEG, PNG, WebP, AVIF, GIF, TIFF). Up to 5,000 per run.",
            "items": {
              "type": "string"
            }
          },
          "queryImageUrls": {
            "title": "Query images (find-similar)",
            "type": "array",
            "description": "Optional, for <b>find-similar</b>: images to look up in the collection (set A vs set B). Leave empty to compare every collection image with all the others.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "textQueries": {
            "title": "Text queries (text-search)",
            "type": "array",
            "description": "For <b>text-search</b>: describe what you are looking for, one query per line, e.g. <code>a cat sleeping on a sofa</code>. English works best.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "model": {
            "title": "Embedding model",
            "enum": [
              "auto",
              "clip-fast",
              "siglip-accurate"
            ],
            "type": "string",
            "description": "<b>auto</b>: SigLIP for text-search, CLIP for everything else. <b>clip-fast</b>: OpenAI CLIP ViT-B/32, fastest, very good for image-to-image similarity and duplicates. <b>siglip-accurate</b>: Google SigLIP base, much better text-to-image search, ~3x slower per image.",
            "default": "auto"
          },
          "topK": {
            "title": "Matches per query",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many best matches to return per query image or text query.",
            "default": 5
          },
          "minSimilarity": {
            "title": "Minimum similarity",
            "minimum": -1,
            "maximum": 1,
            "type": "number",
            "description": "Drop matches with a cosine similarity below this (-1 to 1). With CLIP, near-duplicates score about 0.95+, the same kind of subject 0.75-0.9 and unrelated images below 0.6. Text-to-image scores are much lower (CLIP ~0.2-0.35, SigLIP ~0.05-0.15), so keep 0 for text-search.",
            "default": 0
          },
          "clusterThreshold": {
            "title": "Cluster similarity threshold",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "For <b>cluster</b>: images join a cluster when their similarity to the cluster's representative is at or above this value. 0 = automatic (0.80 for CLIP, 0.85 for SigLIP). Use ~0.93+ to group only near-duplicates.",
            "default": 0
          },
          "minClusterSize": {
            "title": "Minimum cluster size",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "For <b>cluster</b>: smallest group returned as a cluster (2 = pairs count).",
            "default": 2
          },
          "includeUnclustered": {
            "title": "Include unclustered images",
            "type": "boolean",
            "description": "For <b>cluster</b>: also return images that did not join any cluster, as clusters of size 1.",
            "default": false
          },
          "downloadConcurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 32,
            "type": "integer",
            "description": "How many images are downloaded in parallel while embedding (1-32).",
            "default": 8
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}