/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
string
required
Embedding model ID. Example:
"gemini-embedding-001", "text-embedding-3-small".string | array
required
Text to embed. Can be a single string or an array of strings for batch embedding.
string
"float" (default) returns a float array. "base64" returns a base64-encoded string.integer
Number of dimensions for the output embedding. Not supported by all models.
Example requests
Response
Response fields
array
Array of embedding objects, one per input string.
integer
Number of tokens processed.
Cosine similarity example
python