Skip to main content

Embeddings

OpenAI-compatible embeddings endpoint.

POST https://api.ecohash.com/v1/embeddings

Headers

HeaderValue
AuthorizationBearer eco_YOUR_KEY
Content-Typeapplication/json

Request body

FieldTypeRequiredNotes
modelstringyesEmbedding model ID
inputstring or array of stringsyesOne or many texts to embed. Batch with an array for efficiency
encoding_formatstringno"float" (default) or "base64"

Example request

curl https://api.ecohash.com/v1/embeddings \
-H "Authorization: Bearer eco_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-large-en-v1.5",
"input": ["EcoLink makes GPU compute simple.", "Another sentence to embed."]
}'

Response body

{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.012, -0.004, ...] },
{ "object": "embedding", "index": 1, "embedding": [0.019, -0.007, ...] }
],
"model": "bge-large-en-v1.5",
"usage": {
"prompt_tokens": 12,
"total_tokens": 12
}
}

Embedding dimension depends on the model — typically 768, 1024, or 1536 floats.

Batch efficiency

Embedding 100 strings in one call is several times cheaper (per-token) than 100 separate calls, because overhead dominates small requests. For typical RAG pipelines, batch 32–256 strings per call.

Errors

See Errors. Common: 401, 402, 404, 429.