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:
Your API key (add it when prompted)
The model field is pre-filled with text-embedding-3-small
The input field is pre-filled with example text
Request Body
model
string
default: "text-embedding-3-small"
required
Model ID to use for embeddings Examples : 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?"
Format for embeddings: float (default) or base64
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
Model Dimensions Max Tokens Price text-embedding-3-large 3072 8191 $0.00013/1K text-embedding-3-small 1536 8191 $0.00002/1K text-embedding-ada-002 1536 8191 $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 - Image URL
cURL - Base64 Image
Python - Image URL
Python - Base64 Image
JavaScript - Image URL
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 - Video URL
Python - Video URL
JavaScript - Video URL
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"
}
]
}'
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
Cross-Modal Search
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
Model Modalities Dimensions Use Cases jina/jina-clip-v2Text, Images 1024 Cross-modal search, image classification jina/jina-embeddings-v3Text, Images 1024 Semantic search, RAG nomic/nomic-embed-video-v1.5Text, Video 768 Video understanding, scene detection nomic/nomic-embed-text-v1.5Text 768 General text embeddings openai/text-embedding-3-largeText only 3072 High-quality text embeddings voyage/voyage-3Text only 1024 Retrieval-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" )
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
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
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
Batch When Possible
Process multiple inputs in single requests (up to 2048 inputs)
Cache Embeddings
Store generated embeddings to avoid recomputation
Next Steps