Embeddings API
Embeddings are numerical representations of text that capture semantic meaning. They are essential for tasks like document search, recommendation systems, and clustering. Siraya Model Router provides a unified API to access state-of-the-art embedding models from multiple providers (OpenAI, Jina, Voyage AI, etc.).
Base URL
How to Generate Embeddings
Basic Request (Python)
import requests
url = "https://llm.siraya.ai/v1/embeddings"
headers = {
"Authorization": "Bearer <API_KEY>",
"Content-Type": "application/json"
}
data = {
"model": "skylark-embedding-vision-251215",
"input": "Hello world"
}
response = requests.post(url, headers=headers, json=data)
embeddings = response.json()["data"][0]["embedding"]
Best Practices
- Normalization: Most models return normalized embeddings. Use cosine similarity for comparing vectors.
- Caching: Since embeddings are deterministic for a given model and input, caching results can save significant costs.