Skip to main content

Embeddings with /v1/embeddings

This page explains how to use the OpenAI-compatible /v1/embeddings route exposed by the Clovis gateway to generate vector representations (embeddings) from textual content.

Embeddings are used for use cases such as semantic search, similarity, clustering, and vector indexing for a RAG pipeline (retrieval).

Endpoint

Embeddings

POST/v1/embeddings

Full URL (Clovis Gateway)

Clovis Gateway
{
POST https://llm-gateway.clovis-ai.fr/v1/embeddings
Authorization: Bearer <CLOVIS_API_KEY>
Content-Type: application/json
}

Structure

Each request must include a JSON similar to:

Request body
{
"model": "ClovisEmbedding",
"input": "Explain what an embedding is.",
"encoding_format": "float"
}

Multiple input (batch)

{
"model": "ClovisEmbeddings",
"input": [
"Document 1: text to vectorize",
"Document 2: text to vectorize",
"Document 3: text to vectorize"
],
"encoding_format": "float"
}

Field description

FieldTypeRequiredDescription
modelstring✔️Embedding model name
inputstringarray✔️Text (or list of texts) to convert into embeddings
encoding_formatstring✔️Embedding output format (e.g. float, base64)
userstringUser identifier (useful for traceability / logs)

API Response

Main response object

Response example
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [0.0123, -0.9821, 0.4421, 0.1182]
}
],
"model": "ClovisEmbeddings",
"usage": {
"prompt_tokens": 12,
"total_tokens": 12
}
}

Details of the data field

FieldTypeDescription
objectstringReturned object type ("embedding")
indexintIndex corresponding to the input provided in input
embeddingarrayNumerical vector (dimension depends on the model)
Info

If input contains multiple texts, data will contain multiple embedding objects, each with a corresponding index.

Details of the usage field

FieldTypeDescription
prompt_tokensintNumber of tokens used for the input
total_tokensintTotal billed (no generation, so no completion_tokens)

Usage examples

Request
curl https://llm-gateway.clovis-ai.fr/v1/embeddings -H "Content-Type: application/json" -H "Authorization: Bearer sk-xxxxxxxx" -d '{
"model": "ClovisEmbeddings",
"input": "RAG combines vector search and text generation.",
"encoding_format": "float"
}'
Request
curl https://llm-gateway.clovis-ai.fr/v1/embeddings -H "Content-Type: application/json" -H "Authorization: Bearer sk-xxxxxxxx" -d '{
"model": "ClovisEmbeddings",
"input": [
"Chunk 1: introduction...",
"Chunk 2: details...",
"Chunk 3: conclusion..."
],
"encoding_format": "float"
}'