Skip to content

Embeddings ​

POST /v1/embeddings is used to create text embeddings, commonly for knowledge bases, retrieval, similarity calculations, and clustering.

Request Parameters ​

FieldTypeRequiredDescription
modelstringYesName of the embedding model
inputstring/arrayYesInput text or array of texts
dimensionsnumberNoOutput embedding dimensions; support depends on the model
encoding_formatstringNofloat or base64, depending on the upstream provider

Response Fields ​

FieldDescription
data[].embeddingEmbedding array or encoded embedding
data[].indexCorresponding input index
modelActual model
usageToken usage

Request Example ​

bash
curl https://api.cloudaikit.com/v1/embeddings \
  -H "Authorization: Bearer sk-your-token" \
  -H "Content-Type: application/json" \
  -d '{"model":"text-embedding-3-small","input":"用于知识库检索的文本"}'

Notes ​

The knowledge base platform must use an embedding model; a chat model cannot be specified. The embedding dimensions may vary between models, and a single knowledge base generally cannot mix different dimensions.