Embeddings
POST
/api/v1/embeddingsGenerate vector embeddings for text input. Useful for semantic search, clustering, and retrieval-augmented generation (RAG) pipelines.
Authentication
Pass your Meridian proxy key as a Bearer token:
Header
Authorization: Bearer sk-mrd-your-proxy-keyRequest body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | text-embedding-3-small or text-embedding-3-large |
input | string | string[] | Yes | Text to embed. Can be a single string or an array of strings for batch processing. |
Response
200 OK
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023064255, -0.009327292, 0.015797347, ...]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}Examples
curl
curl
curl -X POST https://your-meridian.vercel.app/api/v1/embeddings \
-H "Authorization: Bearer sk-mrd-your-proxy-key" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "Meridian is an open-source LLM gateway."
}'JavaScript
JavaScript (fetch)
const response = await fetch(
"https://your-meridian.vercel.app/api/v1/embeddings",
{
method: "POST",
headers: {
"Authorization": "Bearer sk-mrd-your-proxy-key",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "text-embedding-3-small",
input: "Meridian is an open-source LLM gateway.",
}),
}
);
const data = await response.json();
const embedding = data.data[0].embedding;
console.log(`Dimensions: ${embedding.length}`);Python
Python (requests)
import requests
response = requests.post(
"https://your-meridian.vercel.app/api/v1/embeddings",
headers={
"Authorization": "Bearer sk-mrd-your-proxy-key",
"Content-Type": "application/json",
},
json={
"model": "text-embedding-3-small",
"input": "Meridian is an open-source LLM gateway.",
},
)
data = response.json()
embedding = data["data"][0]["embedding"]
print(f"Dimensions: {len(embedding)}")Batch embedding
curl (batch)
curl -X POST https://your-meridian.vercel.app/api/v1/embeddings \
-H "Authorization: Bearer sk-mrd-your-proxy-key" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-large",
"input": [
"First document to embed",
"Second document to embed",
"Third document to embed"
]
}'Supported models
| Model | Provider | Dimensions | Max tokens |
|---|---|---|---|
text-embedding-3-small | OpenAI | 1,536 | 8,191 |
text-embedding-3-large | OpenAI | 3,072 | 8,191 |