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