Skip to main content
POST
https://api.redpill.ai/v1
/
embeddings
Embeddings
curl --request POST \
  --url https://api.redpill.ai/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "input": "<string>",
  "encoding_format": "<string>",
  "dimensions": 123
}
'

Create Embeddings

Generate vector embeddings for text, images, and videos for semantic search, similarity, and retrieval tasks. All embedding requests flow through RedPill’s privacy-protected gateway.
POST https://api.redpill.ai/v1/embeddings
Multi-Modal Support: RedPill supports text embeddings, image embeddings (URL or base64), and video embeddings for advanced use cases.
Try it now! Click the “Try it” button above to test the API in the playground. You’ll need:
  1. Your API key (add it when prompted)
  2. The model field is pre-filled with text-embedding-3-small
  3. The input field is pre-filled with example text

Request Body

model
string
default:"text-embedding-3-small"
required
Model ID to use for embeddingsExamples: text-embedding-3-large, text-embedding-3-small, text-embedding-ada-002
input
string
default:"RedPill democratizes AI access"
required
Text to generate embeddings for. Can be a string or array of strings.Example: "What is RedPill AI?"
encoding_format
string
Format for embeddings: float (default) or base64
dimensions
integer
Number of dimensions for the output (only supported by some models)

Example

curl https://api.redpill.ai/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "RedPill democratizes AI access"
  }'

Response

{
  "object": "list",
  "data": [{
    "object": "embedding",
    "index": 0,
    "embedding": [0.0023, -0.0015, 0.0042, ...]
  }],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}

Supported Models

ModelDimensionsMax TokensPrice
text-embedding-3-large30728191$0.00013/1K
text-embedding-3-small15368191$0.00002/1K
text-embedding-ada-00215368191$0.0001/1K

Embedding Models

View all embedding models →

Multi-Modal Embeddings

RedPill supports generating embeddings for images and videos in addition to text.

Image Embeddings

Generate embeddings for images using multi-modal models like Jina CLIP.
curl https://api.redpill.ai/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jina/jina-clip-v2",
    "input": [
      {
        "type": "image_url",
        "image_url": "https://example.com/product.jpg"
      }
    ]
  }'

Video Embeddings

Generate embeddings for video content using specialized models.
curl https://api.redpill.ai/v1/embeddings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nomic/nomic-embed-video-v1.5",
    "input": [
      {
        "type": "video_url",
        "video_url": "https://example.com/demo.mp4"
      }
    ]
  }'

Mixed Input Types

Generate embeddings for multiple inputs of different types in a single request.
response = client.embeddings.create(
    model="jina/jina-clip-v2",
    input=[
        "Product description text",
        {
            "type": "image_url",
            "image_url": "https://example.com/product1.jpg"
        },
        "Another text input",
        {
            "type": "image_url",
            "image_url": "https://example.com/product2.jpg"
        }
    ]
)

# Access embeddings for each input
for i, embedding_obj in enumerate(response.data):
    print(f"Input {i}: {len(embedding_obj.embedding)} dimensions")

Multi-Modal Use Cases

Search for images using text queries or text using image queries.
# Generate embeddings for product images
image_embeddings = []
for product_image in product_images:
    response = client.embeddings.create(
        model="jina/jina-clip-v2",
        input=[{"type": "image_url", "image_url": product_image}]
    )
    image_embeddings.append(response.data[0].embedding)

# Search using text query
query_response = client.embeddings.create(
    model="jina/jina-clip-v2",
    input=["red leather jacket"]
)
query_embedding = query_response.data[0].embedding

# Find similar images using cosine similarity
from numpy import dot
from numpy.linalg import norm

def cosine_similarity(a, b):
    return dot(a, b) / (norm(a) * norm(b))

similarities = [
    cosine_similarity(query_embedding, img_emb)
    for img_emb in image_embeddings
]

# Get top 5 matches
top_5 = sorted(enumerate(similarities), key=lambda x: x[1], reverse=True)[:5]
print("Top 5 matching products:", top_5)

Visual Question Answering

Combine image and text embeddings for Q&A.
# Embed the image
image_response = client.embeddings.create(
    model="jina/jina-clip-v2",
    input=[{
        "type": "image_url",
        "image_url": "https://example.com/scene.jpg"
    }]
)

# Embed possible answers
answers = [
    "A person is standing",
    "A car is parked",
    "A dog is running"
]

answer_response = client.embeddings.create(
    model="jina/jina-clip-v2",
    input=answers
)

# Find best matching answer
image_emb = image_response.data[0].embedding
best_match_idx = max(
    range(len(answers)),
    key=lambda i: cosine_similarity(
        image_emb,
        answer_response.data[i].embedding
    )
)

print(f"Best answer: {answers[best_match_idx]}")

Video Scene Detection

Detect and classify scenes in videos.
response = client.embeddings.create(
    model="nomic/nomic-embed-video-v1.5",
    input=[{
        "type": "video_url",
        "video_url": "https://example.com/video.mp4"
    }]
)

video_embedding = response.data[0].embedding

# Compare against scene embeddings
scene_labels = ["indoor", "outdoor", "urban", "nature"]
scene_response = client.embeddings.create(
    model="nomic/nomic-embed-video-v1.5",
    input=scene_labels
)

# Find closest scene
similarities = [
    cosine_similarity(video_embedding, scene_response.data[i].embedding)
    for i in range(len(scene_labels))
]

detected_scene = scene_labels[similarities.index(max(similarities))]
print(f"Detected scene: {detected_scene}")

Supported Multi-Modal Models

ModelModalitiesDimensionsUse Cases
jina/jina-clip-v2Text, Images1024Cross-modal search, image classification
jina/jina-embeddings-v3Text, Images1024Semantic search, RAG
nomic/nomic-embed-video-v1.5Text, Video768Video understanding, scene detection
nomic/nomic-embed-text-v1.5Text768General text embeddings
openai/text-embedding-3-largeText only3072High-quality text embeddings
voyage/voyage-3Text only1024Retrieval-optimized

All Embedding Models

View complete list with pricing →

Advanced Features

Custom Dimensions

Some models support custom output dimensions for reduced storage and faster similarity search.
# text-embedding-3-large supports 256 to 3072 dimensions
response = client.embeddings.create(
    model="openai/text-embedding-3-large",
    input="RedPill protects your AI queries",
    dimensions=512  # Reduce from default 3072
)

print(f"Dimensions: {len(response.data[0].embedding)}")  # 512
Benefits:
  • Reduced storage costs (6x reduction: 3072 → 512)
  • Faster similarity search
  • Lower memory usage
  • Minimal quality loss for many use cases

Batch Processing

Process multiple inputs efficiently in a single request.
texts = [
    "First document about AI",
    "Second document about privacy",
    "Third document about security",
    # ... up to 2048 inputs
]

response = client.embeddings.create(
    model="text-embedding-3-small",
    input=texts
)

embeddings = [item.embedding for item in response.data]
print(f"Generated {len(embeddings)} embeddings")

Encoding Format

Choose between float or base64 encoding.
# Float encoding (default)
response = client.embeddings.create(
    model="text-embedding-3-small",
    input="Hello world",
    encoding_format="float"
)

# Base64 encoding (more compact for transmission)
response_b64 = client.embeddings.create(
    model="text-embedding-3-small",
    input="Hello world",
    encoding_format="base64"
)

# Decode base64
import base64
import struct

b64_string = response_b64.data[0].embedding
decoded_bytes = base64.b64decode(b64_string)
floats = struct.unpack(f'{len(decoded_bytes)//4}f', decoded_bytes)

Privacy & Security

TEE-Protected Processing

All embeddings generated in hardware-protected enclaves

Confidential Inputs

Text, images, and videos processed in isolated secure environments

No Storage

Embeddings not retained after generation

No Training Use

Your data never used for model training

Best Practices

Optimize for Your Use Case

1

Choose the Right Model

  • General text: openai/text-embedding-3-large
  • Budget-friendly: openai/text-embedding-3-small
  • Semantic search: voyage/voyage-3
  • Multi-modal: jina/jina-clip-v2
  • Video: nomic/nomic-embed-video-v1.5
2

Use Appropriate Dimensions

Start with default dimensions, reduce if needed for performance
  • 3072: Highest quality (text-embedding-3-large)
  • 1536: Good balance (text-embedding-3-small)
  • 768: Fast & efficient (Nomic models)
  • 512: Custom reduced dimensions
3

Batch When Possible

Process multiple inputs in single requests (up to 2048 inputs)
4

Cache Embeddings

Store generated embeddings to avoid recomputation

Next Steps