Embeddings
The Embeddings API converts text into vector representations.
Endpoint
POST https://ai-tokenhub.com/v1/embeddingsRequest Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Embedding model identifier |
| input | string/array | Yes | Text to embed |
| encoding_format | string | No | Return format (float/dense) |
Request Example
bash
curl https://ai-tokenhub.com/v1/embeddings \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog"
}'Response Example
json
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [0.123, -0.456, 0.789],
"index": 0
}
],
"usage": {
"prompt_tokens": 10,
"total_tokens": 10
}
}Use Cases
- Semantic Search: Text similarity
- Document Clustering: Classification
- Recommendation Systems: Content-based recommendations