Skip to main content

Endpoint

Generate vector embeddings for one or more text inputs. Compatible with the OpenAI Embeddings API.
Embeddings support varies by provider. Gemini and Ollama provide the best embedding model availability.

Request Body

string | array
required
Input text or array of texts to generate embeddings for.
string
required
The embedding model to use. Examples:
  • gemini:text-embedding-004
  • ollama:nomic-embed-text
  • switchai:text-embedding-3-small
string
Format for the embeddings: float or base64 (default: float)
integer
Number of dimensions for the embedding (model-dependent)

Response Format

string
Always list
array
Array of embedding objects
string
The model used to generate embeddings
object
Token usage statistics

Examples

Basic Request

Batch Embeddings

Generate embeddings for multiple texts:
Use embeddings for semantic similarity:

Supported Models

Gemini Embeddings

Ollama Embeddings

Ollama provides various open-source embedding models:

switchAI Embeddings

switchAI provides access to multiple embedding providers:

Response Example

Use Cases

Find similar documents:

Clustering

Group similar texts:

Recommendation Systems

Recommend similar items:

Error Handling

Performance Tips

Process multiple texts in a single request for better throughput:
Cache embeddings for frequently used texts:
Choose appropriate model for your use case:
  • Gemini: Best for multilingual and semantic search
  • Ollama: Best for privacy and offline usage
  • switchAI: Best for unified access to multiple providers

Limitations

Next Steps

Models

Discover available embedding models

Chat Completions

Use embeddings for RAG systems