Overview
This interface is used to generate vector representations (Embeddings) of text or multi-modal content. It is suitable for scenarios where natural language or other modal data needs to be converted into numerical vectors for downstream tasks such as similarity calculation, retrieval, and classification.
API details
Constraints
- The caller must have an API Key. For more information, see Manage AI API Keys.
Request path
POST {BASE_URL}/api/v1/embeddings
Request header
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information |
| Content-Type | No | application/json | Request body format |
Request parameters
Path
None
Query
None
Body
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| model | string | Yes | text-embedding-3-small | The name of the model to use for generating the embedding vector |
| input | unknown | Yes | "The quick brown fox jumps over the lazy dog" | The input content to generate a vector for, which can be a string, string array, or other format |
| encoding_format | string | No | float | The vector encoding format, such as "float" or "base64" |
| dimensions | integer | No | 512 | The dimension of the generated vector |
| parameters | object | No | {} | Additional model-specific parameters |
Response
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Return code |
| message | string | Return information |
| data | object | Business return data |
data
Name |
Type |
Description |
|---|---|---|
| id | string | Resource unique ID |
| name | string | Resource name |
| status | string | Resource status |
| createTime | string | Creation time |
Request example
curl --request POST '{BASE_URL}/api/v1/embeddings' \
--header 'Authorization: Bearer {token}' \
--header 'Content-Type: application/json' \
--data '{
"model": "text-embedding-3-small",
"input": "The quick brown fox jumps over the lazy dog",
"encoding_format": "float",
"dimensions": 512
}'
Response example
{
"success": true,
"code": "200",
"message": "successful",
"data": {
"id": "emb_abc123",
"name": "embedding-result",
"status": "COMPLETED",
"createTime": "2026-04-10T10:00:00Z"
}
}
