← Back to models

clip-vit-base-patch32

embedderMultimodal
v1.0.00 B
antfly inference pull openai/clip-vit-base-patch32
By openaiHuggingFaceCreated: 9/17/2026

About CLIP#

CLIP (Contrastive Language-Image Pre-training) is a multimodal model developed by OpenAI that learns visual concepts from natural language supervision. It creates a joint embedding space where both text and images can be represented as vectors, enabling powerful cross-modal search and retrieval.

This model uses the ViT-B/32 architecture (Vision Transformer base with 32x32 patches).

Capabilities#

  • Text Embeddings: Convert text descriptions into vectors
  • Image Embeddings: Convert images into vectors in the same space as text
  • Cross-Modal Retrieval: Search images with text queries, or text with images
  • Zero-Shot Classification: Classify images into categories without training

Use Cases#

Use CaseDescription
Image SearchFind images using natural language queries like "a sunset over mountains"
Visual SimilarityFind images that look similar to a reference image
Content ModerationDetect inappropriate content by comparing against text descriptions
Multi-modal RAGBuild retrieval-augmented generation systems with both text and images

Antfly Inference API Usage#

Text Embedding#

Generate embeddings for text descriptions:

curl -X POST "http://localhost:8080/ai/v1/embed" \
-H "Content-Type: application/json" \
-d '{
"model": "clip-vit-base-patch32",
"input": [
  {"type": "text", "text": "a photo of a cat"},
  {"type": "text", "text": "a dog playing in the park"}
]
}'

Image Embedding (Remote URL)#

Generate embeddings for images from URLs:

curl -X POST "http://localhost:8080/ai/v1/embed" \
-H "Content-Type: application/json" \
-d '{
"model": "clip-vit-base-patch32",
"input": [
  {"type": "image_url", "image_url": {"url": "https://example.com/cat.jpg"}}
]
}'

Image Embedding (Base64)#

Generate embeddings for images using base64 data URIs:

import requests
import base64

# Read and encode an image
with open("cat.jpg", "rb") as f:
  image_data = base64.b64encode(f.read()).decode()

response = requests.post(
  "http://localhost:8080/ai/v1/embed",
  json={
      "model": "clip-vit-base-patch32",
      "input": [
          {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_data}"}}
      ]
  }
)

embeddings = response.json()["embeddings"]

Mixed Text and Images#

Embed both text and images in a single request - useful for building cross-modal search indexes:

import requests

response = requests.post(
  "http://localhost:8080/ai/v1/embed",
  json={
      "model": "clip-vit-base-patch32",
      "input": [
          {"type": "text", "text": "a photo of a cat"},
          {"type": "image_url", "image_url": {"url": "https://example.com/cat.jpg"}},
          {"type": "text", "text": "a dog playing fetch"},
          {"type": "image_url", "image_url": {"url": "https://example.com/dog.jpg"}}
      ]
  }
)

# Returns 4 embeddings in the same order as input
embeddings = response.json()["embeddings"]

Supported Input Formats#

CLIP in Antfly Inference supports multiple ways to provide images:

FormatExampleDescription
HTTP/HTTPShttps://example.com/image.jpgRemote images from the web
Data URIdata:image/png;base64,...Base64-encoded images
Local filefile:///path/to/image.jpgLocal filesystem paths
S3s3://endpoint/bucket/keyImages stored in S3-compatible storage

Limitations#

Based on OpenAI's model card:

  • Fine-grained classification: Struggles with subtle distinctions (e.g., car models, bird species)
  • Object counting: Limited ability to count objects in images
  • Abstract concepts: May not handle novel or abstract visual concepts well
  • Language bias: Primarily trained on English text - limited multilingual support
  • Data bias: Training data skews toward developed nations and younger demographics
  • Not for surveillance: Should not be used for facial recognition or surveillance applications

Antfly Configuration#

To use CLIP as the default embedder in your Antfly configuration:

embedder:
  provider: antfly
  model: clip-vit-base-patch32

For multimodal tables that store images:

tables:
  images:
    indexes:
      embedding:
        type: embedding
        embedder:
          provider: antfly
          model: clip-vit-base-patch32
        fields:
          - image_url
          - description

Versions

TagStatus
latestAvailable
v1.0.0Latest

Usage

Pull the model

antfly inference pull openai/clip-vit-base-patch32

Start Antfly Inference

# With Antfly standalone (Antfly Inference enabled by default)
antfly standalone

# Or run Antfly Inference on its own
antfly inference

Use in configuration

# config.yaml
embedder:
  provider: antfly
  model: openai/clip-vit-base-patch32

Available variants (smaller/faster)

FP16:
# config.yaml
embedder:
  provider: antfly
  model: openai/clip-vit-base-patch32-f16
INT8:
# config.yaml
embedder:
  provider: antfly
  model: openai/clip-vit-base-patch32-i8