Skip to main content
Embeddings convert text into vectors that capture semantic meaning. Use them for search, retrieval-augmented generation (RAG), clustering, recommendations, deduplication, and similarity scoring. The Venice embeddings endpoint is OpenAI-compatible. Send one string or an array of strings to /embeddings, then store the returned vectors in your database or vector index.

Basic Usage

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["VENICE_API_KEY"],
    base_url="https://api.venice.ai/api/v1",
)

response = client.embeddings.create(
    model="text-embedding-bge-m3",
    input="Privacy-first AI infrastructure for semantic search",
)

vector = response.data[0].embedding
print(len(vector), vector[:5])
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.VENICE_API_KEY,
  baseURL: "https://api.venice.ai/api/v1",
});

const response = await client.embeddings.create({
  model: "text-embedding-bge-m3",
  input: "Privacy-first AI infrastructure for semantic search",
});

const vector = response.data[0].embedding;
console.log(vector.length, vector.slice(0, 5));
curl https://api.venice.ai/api/v1/embeddings \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-bge-m3",
    "input": "Privacy-first AI infrastructure for semantic search",
    "encoding_format": "float"
  }'

Batch Inputs

Pass an array of strings to embed multiple texts in one request:
{
  "model": "text-embedding-bge-m3",
  "input": [
    "Venice supports private chat completions.",
    "Embeddings help retrieve relevant documents.",
    "Vector search powers RAG applications."
  ]
}
The response preserves input order. Store each vector with the source text ID, metadata, and embedding model ID.

Common Workflow

  1. Split source documents into chunks.
  2. Generate embeddings for each chunk.
  3. Store vectors and metadata in a vector database.
  4. Embed the user’s query.
  5. Retrieve nearby chunks.
  6. Send the retrieved context to a chat model.
For a complete implementation, see Building a Private RAG Bot.

Model Selection

Use the Embedding Models page to compare current embedding models, dimensions, and pricing.
Use the same embedding model for indexing and querying. Mixing models can make similarity scores unreliable because vector spaces are not interchangeable.