Skip to content
Request
Response

Embeddings

The Embeddings API converts text into vector representations.

Endpoint

POST https://ai-tokenhub.com/v1/embeddings

Request Body

ParameterTypeRequiredDescription
modelstringYesEmbedding model identifier
inputstring/arrayYesText to embed
encoding_formatstringNoReturn 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