Skip to content

Embeddings

POST https://api.bve.me/v1/embeddings

Requires Authorization: Bearer sk-bve-YOUR_KEY.

This endpoint proxies directly to Fuelix /embeddings. The request body and response shape follow the OpenAI Embeddings API.

{
"model": "text-embedding-3-small",
"input": "The quick brown fox"
}
FieldTypeRequiredDescription
modelstringYesEmbedding model ID
inputstring | arrayYesText to embed — string or array of strings
encoding_formatstringNofloat or base64 (default: float)
dimensionsintegerNoOutput dimensions; only supported by OpenAI text-embedding-3-* models
input_typestringNoCohere embed model task type — "search_query", "search_document", "classification", or "clustering". Required by Cohere embed-*-v3 models; silently ignored by other providers.
truncatestringNoGroq overflow behaviour — "NONE" (error on overflow), "START" (trim from start), or "END" (trim from end, default). Case-sensitive. Silently ignored by non-Groq providers.
userstringNoEnd-user identifier (≤ 256 chars)
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0023, -0.0089, 0.0141, "..."]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 6,
"total_tokens": 6
}
}
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-bve-YOUR_KEY',
baseURL: 'https://api.bve.me/v1',
});
const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: 'The quick brown fox',
});
console.log(response.data[0].embedding);

Pass an array of strings to embed multiple texts in a single request:

const response = await client.embeddings.create({
model: 'text-embedding-3-small',
input: ['The quick brown fox', 'jumped over', 'the lazy dog'],
});
for (const item of response.data) {
console.log(`index=${item.index}, vector_length=${item.embedding.length}`);
}

BVE Gateway adds the following headers to every authenticated response:

HeaderExampleDescription
X-Request-Id550e8400-…UUID for this request (generated per request)
X-BVE-Client-Idmy-trace-123Echo of the client-supplied X-Request-Id (when present and valid: alphanumeric + -_., ≤ 128 chars). Absent when not supplied or value failed validation.
X-BVE-Latency143Total gateway latency in milliseconds
X-BVE-Modeltext-embedding-3-smallModel ID resolved for this request
X-BVE-Key-Nameprod-keyName of the API key used for this request (redacted if it matches a provider credential pattern)

The full X-RateLimit-* header set (RPM, RPD, monthly) is also included. See Rate Limits & Quotas for details and example output.

The gateway validates required and optional fields before forwarding to Fuelix. Invalid inputs return 400 with an OpenAI-compatible error body instead of a Fuelix Pydantic error.

Required fields:

Missing / invalidCodeparam
model absentmissing_required_parameter"model"
model not a stringinvalid_type"model"
input absentmissing_required_parameter"input"
input not a string or arrayinvalid_type"input"

Optional field constraints:

FieldConstraintCodeparam
encoding_formatNot a stringinvalid_type"encoding_format"
encoding_formatNot "float" or "base64"invalid_value"encoding_format"
dimensionsNot a numberinvalid_type"dimensions"
dimensionsNot a positive integerinvalid_value"dimensions"
input_typeNot a stringinvalid_type"input_type"
input_typeNot one of "search_query", "search_document", "classification", "clustering"invalid_value"input_type"
truncateNot a stringinvalid_type"truncate"
truncateNot one of "NONE", "START", "END" (case-sensitive)invalid_value"truncate"
userNot a stringinvalid_type"user"
userMore than 256 charactersinvalid_value"user"

Cohere v3 embed models (embed-english-v3.0, embed-multilingual-v3.0, and dated variants) require an input_type hint to optimise the embedding for its intended use:

ValueUse case
"search_query"Embed a user’s search query for retrieval against indexed documents
"search_document"Embed a passage to be stored in a retrieval index
"classification"Embed text for classification tasks
"clustering"Embed text for clustering or similarity tasks
Terminal window
curl https://api.bve.me/v1/embeddings \
-H "Authorization: Bearer sk-bve-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "embed-english-v3.0",
"input": "What is the capital of France?",
"input_type": "search_query"
}'

Other providers (OpenAI, Groq) ignore input_type silently.

Groq embedding models (nomic-embed-text-v1.5 and similar) accept a truncate parameter that controls behaviour when the input exceeds the model’s context window:

ValueBehaviour
"END"Remove tokens from the end of the input (Groq default)
"START"Remove tokens from the beginning of the input
"NONE"Return an error if the input is too long

Values are case-sensitive"end" or "End" are rejected with 400 invalid_value.

Terminal window
curl https://api.bve.me/v1/embeddings \
-H "Authorization: Bearer sk-bve-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nomic-embed-text-v1.5",
"input": "...(long document)...",
"truncate": "END"
}'