Embeddings
POST /v1/embeddings is used to create text embeddings, commonly for knowledge bases, retrieval, similarity calculations, and clustering.
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Name of the embedding model |
input | string/array | Yes | Input text or array of texts |
dimensions | number | No | Output embedding dimensions; support depends on the model |
encoding_format | string | No | float or base64, depending on the upstream provider |
Response Fields
| Field | Description |
|---|---|
data[].embedding | Embedding array or encoded embedding |
data[].index | Corresponding input index |
model | Actual model |
usage | Token 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.
