Embedding Series
Text Embeddings
Convert text to vector embeddings
POST
Text Embeddings
The Embeddings API converts text into high-dimensional vector representations, useful for semantic search, clustering, and RAG applications.Endpoint
Authentication
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Embedding model ID |
input | string/array | Yes | Text(s) to embed |
encoding_format | string | No | Output format: float or base64 |
dimensions | integer | No | Output dimensions (model-dependent) |
Example Request
Single Text
Batch Texts
Custom Dimensions
Reduce embedding dimensions for efficiency:Supported Models
| Model | Dimensions | Description |
|---|---|---|
text-embedding-3-small | 1536 | Fast, cost-effective |
text-embedding-3-large | 3072 | Higher accuracy |
text-embedding-ada-002 | 1536 | Legacy model |
Use Cases
Semantic Search
Document Clustering
Best Practices
- Batch requests: Send multiple texts in one request for efficiency
- Normalize vectors: Normalize embeddings for consistent similarity scores
- Choose dimensions: Use smaller dimensions when storage/speed matters
- Chunk long texts: Split long documents into meaningful chunks before embedding