← Back to index Logout

title: CLIP API version: 1.0 date: 2026-10-25 author: Core Team status: Active


CLIP Vision Model

POST /api/v1/clip/classify

Auth: Required Scope: system-level

Classify an image against a list of text labels using CLIP (Contrastive Language-Image Pre-training). Returns top-k predictions with confidence scores.

Request Parameters

Field Type Required Default Description
image_path string Yes - Absolute path to the image file
labels string Yes - Comma-separated text labels (e.g., "dog,cat,car,person")
top_k integer No 5 Number of top predictions to return
model string No default CLIP model variant to use

Example

curl -s -X POST "$API/api/v1/clip/classify" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_path": "/path/to/image.jpg",
    "labels": "dog,cat,car,person,building",
    "top_k": 3
  }'

Response (200)

{
  "success": true,
  "predictions": [
    {
      "label": "dog",
      "confidence": 0.892
    },
    {
      "label": "person",
      "confidence": 0.073
    },
    {
      "label": "cat",
      "confidence": 0.021
    }
  ]
}
Field Type Description
success boolean Operation success status
predictions array Array of label-confidence pairs, sorted by confidence (descending)
label string Text label
confidence float Confidence score (0.0-1.0)

Error Responses

HTTP When
400 Invalid image path or labels
401 Missing or invalid API key
500 CLIP model inference error

POST /api/v1/clip/detect

Auth: Required Scope: system-level

Detect specific objects in an image using zero-shot object detection. Returns detected objects with confidence scores above the threshold.

Request Parameters

Field Type Required Default Description
image_path string Yes - Absolute path to the image file
objects string Yes - Comma-separated object names to detect
threshold float No 0.15 Confidence threshold (0.0-1.0)
model string No default CLIP model variant to use

Example

curl -s -X POST "$API/api/v1/clip/detect" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_path": "/path/to/scene.jpg",
    "objects": "person,car,bicycle",
    "threshold": 0.3
  }'

Response (200)

{
  "success": true,
  "detected": [
    {
      "label": "person",
      "confidence": 0.921
    },
    {
      "label": "car",
      "confidence": 0.876
    }
  ]
}

Note: Only objects with confidence >= threshold are returned. If no objects are detected, detected will be an empty array.


POST /api/v1/clip/batch

Auth: Required Scope: system-level

Batch classify multiple images against the same set of labels. Efficient for processing large image sets.

Request Parameters

Field Type Required Default Description
image_paths string Yes - Comma-separated absolute paths to image files
labels string Yes - Comma-separated text labels
top_k integer No 5 Number of top predictions per image
model string No default CLIP model variant to use

Example

curl -s -X POST "$API/api/v1/clip/batch" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_paths": "/path/to/img1.jpg,/path/to/img2.jpg,/path/to/img3.jpg",
    "labels": "indoor,outdoor,nature,urban",
    "top_k": 2
  }'

Response (200)

{
  "success": true,
  "results": {
    "/path/to/img1.jpg": [
      {"label": "indoor", "confidence": 0.945},
      {"label": "urban", "confidence": 0.032}
    ],
    "/path/to/img2.jpg": [
      {"label": "outdoor", "confidence": 0.876},
      {"label": "nature", "confidence": 0.089}
    ],
    "/path/to/img3.jpg": [
      {"label": "nature", "confidence": 0.923},
      {"label": "outdoor", "confidence": 0.054}
    ]
  }
}

Use Cases

1. Scene Classification

# Classify scene type
curl -X POST "$API/api/v1/clip/classify" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_path": "/output/video_frame.jpg",
    "labels": "indoor,outdoor,day,night",
    "top_k": 2
  }'

2. Object Detection

# Detect people and vehicles
curl -X POST "$API/api/v1/clip/detect" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_path": "/output/frame_001.jpg",
    "objects": "person,car,bicycle,motorcycle",
    "threshold": 0.3
  }'

3. Batch Frame Analysis

# Analyze multiple video frames
curl -X POST "$API/api/v1/clip/batch" \
  -H "X-API-Key: $KEY" \
  -d '{
    "image_paths": "/output/frame_001.jpg,/output/frame_002.jpg,/output/frame_003.jpg",
    "labels": "action,dialogue,scenery",
    "top_k": 1
  }'

Implementation Notes


Version History

Version Date Changes
1.0 2026-10-25 Initial documentation