Tạo embedding
post/v1/embeddings
Chuyển văn bản thành embedding vector.
Xác thực
Gửi khóa API OLETOKEN dưới dạng token Bearer. Khóa được tạo tại trang API Keys trong bảng điều khiển.
Authorization: Bearer $OLETOKEN_API_KEYNội dung yêu cầu
Content-Type:application/json
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| model | string | — | |
| input | string | string[] | Văn bản cần tạo embedding | |
| encoding_format | stringdefault: floatfloatbase64 | — | — |
| dimensions | integer | — | Số chiều của vector đầu ra |
Phản hồi
200Đã tạo embedding
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| object | string | — | — |
| data | object[] | — | — |
| object | string | — | — |
| index | integer | — | — |
| embedding | number[] | — | — |
| model | string | — | — |
| usage | object | — | — |
| prompt_tokens | integer | — | — |
| total_tokens | integer | — | — |
Ví dụ yêu cầu
curl -X POST 'https://api.oletoken.ai/v1/embeddings' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "text-embedding-ada-002",
"input": "string"
}'
