Endpoints
Embeddings Endpoint
Last updated March 3, 2026
Generate vector embeddings for semantic search and RAG.
Generate vector embeddings from text for semantic search, similarity matching, and RAG applications.
Basic Request
const response = await cencori.ai.embeddings({
model: 'text-embedding-3-small',
input: 'Hello world'
});
console.log(response.embeddings[0]); // [0.1, 0.2, ...]Batch Request
const response = await cencori.ai.embeddings({
model: 'text-embedding-3-small',
input: [
'First text to embed',
'Second text to embed',
'Third text to embed'
]
});
// response.embeddings is an array of vectors
console.log(response.embeddings.length); // 3Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model identifier |
input | string | string[] | Yes | Text to embed |
dimensions | number | No | Output dimensions |
encodingFormat | string | No | 'float' or 'base64' |
Response
{
embeddings: [
[0.1, 0.2, -0.3, ...],
[0.4, -0.1, 0.2, ...]
],
model: 'text-embedding-3-small',
usage: {
promptTokens: 15,
totalTokens: 15
}
}Model Comparison
| Model | Provider | Dimensions | Best For |
|---|---|---|---|
| text-embedding-3-small | OpenAI | 1536 | General purpose |
| text-embedding-3-large | OpenAI | 3072 | High accuracy |
| text-embedding-004 | 768 | Multilingual | |
| embed-english-v3.0 | Cohere | 1024 | English text |
HTTP API
curl -X POST https://cencori.com/api/ai/embeddings \
-H "CENCORI_API_KEY: csk_..." \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "Hello world"
}'Use with Memory
Embeddings are automatically generated when storing memories:
await cencori.memory.store({
namespace: 'docs',
content: 'Refund policy allows returns within 30 days'
// Embedding generated automatically
});