> ## Documentation Index
> Fetch the complete documentation index at: https://docs.venice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The Venice API is OpenAI-compatible: use any OpenAI SDK with the base URL `https://api.venice.ai/api/v1` and a Venice API key, or pay per request from a USDC wallet through x402 with no account.
> Read model IDs from `GET /models` or `GET /models/traits` at runtime instead of hardcoding them from memory or from these pages. Models are added and retired often.
> Every model's price is in https://docs.venice.ai/pricing.md. Quote video and audio jobs with `POST /video/quote` or `POST /audio/quote` before you queue them.
> Search these docs from an MCP client at https://docs.venice.ai/mcp. The full agent guide is https://docs.venice.ai/agents.md.

# Embeddings

> Generate vector embeddings with the OpenAI-compatible Venice /embeddings endpoint for semantic search, RAG retrieval, clustering, and similarity.

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.

> [!WARNING]
>
> Venice accepts text only. Send a string or an array of strings. Token ID arrays are rejected with HTTP 400. LangChain `OpenAIEmbeddings` must set `check_embedding_ctx_length=False`, or it tokenizes locally with tiktoken and sends integer arrays.

## Basic Usage

```python Python theme={"system"}
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])
```

```javascript Node.js theme={"system"}
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));
```

```bash cURL theme={"system"}
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. Each item must be text, not a token ID array.

Two limits apply, and both are enforced before the request reaches a model:

| Limit | Value | Error when exceeded |
| - | - | - |
| Items per request | 2,048 | `400` — *"Array must contain at most 2048 element(s)"* |
| Tokens per item | 8,192 | `400` — token count is checked per array entry, not across the batch |

Size your ingest batches against the 2,048 cap and chunk long documents below 8,192 tokens per entry. The request body is also strict, so an unrecognized field returns a `400` rather than being ignored.

```json theme={"system"}
{
  "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](https://docs.venice.ai/learn/private-rag-bot.md).

## Model Selection

Use the [Embedding Models](https://docs.venice.ai/models/embeddings.md) page to compare current embedding models, dimensions, and pricing.

> [!NOTE]
>
> Use the same embedding model for indexing and querying. Mixing models can make similarity scores unreliable because vector spaces are not interchangeable.

## Related Resources

* [Embeddings API](https://docs.venice.ai/api-reference/endpoint/embeddings/generate.md)
* [Embedding Models](https://docs.venice.ai/models/embeddings.md)
* [LangChain](https://docs.venice.ai/guides/integrations/langchain.md#embeddings)
* [Private RAG Bot Guide](https://docs.venice.ai/learn/private-rag-bot.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.