Tạo completion
post/v1/completions
Tạo văn bản hoàn thành từ một prompt cho trước.
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 | — | |
| prompt | string | string[] | — | |
| max_tokens | integer | — | — |
| temperature | number | — | — |
| top_p | number | — | — |
| n | integer | — | — |
| stream | boolean | — | — |
| stop | string | string[] | — | — |
| suffix | string | — | — |
| echo | boolean | — | — |
Phản hồi
200Đã tạo phản hồi
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
| id | string | — | — |
| object | string | — | — |
| created | integer | — | — |
| model | string | — | — |
| choices | object[] | — | — |
| text | string | — | — |
| index | integer | — | — |
| finish_reason | string | — | — |
| usage | Usage | — | — |
| prompt_tokens | integer | — | Số token prompt |
| completion_tokens | integer | — | Số token completion |
| total_tokens | integer | — | Tổng số token |
| prompt_tokens_details | object | — | — |
| cached_tokens | integer | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| image_tokens | integer | — | — |
| completion_tokens_details | object | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| reasoning_tokens | integer | — | — |
Ví dụ yêu cầu
curl -X POST 'https://api.oletoken.ai/v1/completions' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "string",
"prompt": "string"
}'
