Embeddings
API Reference
Embeddings
Create vector embeddings for text input. Use for search, clustering, and RAG applications.
POST
Embeddings
Request
Body parameters
Embedding model ID. Options:
text-embedding-3-small, togethercomputer/m2-bert-80M-32k-retrieval, gemini-embedding-001, gemini-embedding-2-preview.Text to embed. Can be a single string or an array of strings.
Number of dimensions for the output vector. Supported by models trained with Matryoshka Representation Learning (MRL):
text-embedding-3-small (up to 1536), gemini-embedding-001 and gemini-embedding-2-preview (128–3072, recommended: 768, 1536, 3072). If omitted, the model’s default is used.Format of the embedding. Options:
"float" (default), "base64".A unique identifier for the end-user, used for abuse monitoring.
Examples
Gemini Embedding 2 with custom dimensions
gemini-embedding-2-preview is a premium model. It requires wallet balance. It is Google’s first multimodal embedding model with 8K token input and 3072-dimensional vectors with Matryoshka support.Batch embeddings
Model comparison
| Model | Provider | Premium | Max input | Default dims | Custom dims | Price ($/M tokens) |
|---|---|---|---|---|---|---|
text-embedding-3-small | OpenAI | No | 8,191 | 1,536 | Up to 1,536 | $0.02 |
togethercomputer/m2-bert-80M-32k-retrieval | Together | No | 32,768 | 768 | Fixed (768) | $0.008 |
gemini-embedding-001 | No | 2,048 | 3,072 | 128–3,072 | $0.15 | |
gemini-embedding-2-preview | Yes | 8,192 | 3,072 | 128–3,072 | $0.20 |