Skip to main content
The /v1/embeddings endpoint generates vector embeddings for text input. Embeddings represent the semantic meaning of text as a high-dimensional float array, enabling similarity search, clustering, and retrieval-augmented generation (RAG). The endpoint is compatible with the OpenAI Embeddings API.

Endpoint

Supported embedding models

See the Model Directory for current availability and pricing.

Request

Headers

Body parameters

model
string
required
Embedding model ID. Example: "gemini-embedding-001", "text-embedding-3-small".
input
string | array
required
Text to embed. Can be a single string or an array of strings for batch embedding.
encoding_format
string
"float" (default) returns a float array. "base64" returns a base64-encoded string.
dimensions
integer
Number of dimensions for the output embedding. Not supported by all models.

Example requests

Response

Response fields

data
array
Array of embedding objects, one per input string.
usage.prompt_tokens
integer
Number of tokens processed.

Cosine similarity example

python