Models
Embedding Model
Learn about the embedding model API and how to use it
Embedding Model
Overview
The embedding model converts text into high-dimensional vector representations, enabling semantic search, similarity comparisons, and other natural language processing tasks.
API Endpoint
POST /api/v1/embeddingsRequest Format
{
"text": "Your text to embed",
"model": "embedding-v1"
}Response Format
{
"embedding": [0.123, -0.456, ...],
"dimensions": 768,
"model": "embedding-v1"
}Usage Example
const response = await fetch('https://api.example.com/v1/embeddings', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
text: 'Hello, world!',
model: 'embedding-v1'
})
});
const data = await response.json();
console.log(data.embedding);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The text to generate embeddings for |
model | string | No | The embedding model to use (default: embedding-v1) |
Use Cases
- Semantic search
- Document similarity
- Content recommendations
- Clustering and classification