建立補全
post/v1/completions
根據指定的 Prompt 建立文字補全。
驗證
把 OLETOKEN 的 API Key 作為 Bearer Token 放進 Authorization 請求標頭。金鑰在控制台的「API 金鑰」頁建立。
Authorization: Bearer $OLETOKEN_API_KEY請求主體
Content-Type:application/json
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| model | string | — | |
| prompt | string | string[] | — | |
| max_tokens | integer | — | — |
| temperature | number | — | — |
| top_p | number | — | — |
| n | integer | — | — |
| stream | boolean | — | — |
| stop | string | string[] | — | — |
| suffix | string | — | — |
| echo | boolean | — | — |
回應
200已建立回應
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| id | string | — | — |
| object | string | — | — |
| created | integer | — | — |
| model | string | — | — |
| choices | object[] | — | — |
| text | string | — | — |
| index | integer | — | — |
| finish_reason | string | — | — |
| usage | Usage | — | — |
| prompt_tokens | integer | — | Prompt Token 數量 |
| completion_tokens | integer | — | 補全 Token 數量 |
| total_tokens | integer | — | 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 | — | — |
請求範例
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"
}'
