壓縮對話(OpenAI Responses API)
post/v1/responses/compact
透過 OpenAI Responses API 壓縮冗長的對話。
驗證
把 OLETOKEN 的 API Key 作為 Bearer Token 放進 Authorization 請求標頭。金鑰在控制台的「API 金鑰」頁建立。
Authorization: Bearer $OLETOKEN_API_KEY請求主體
Content-Type:application/json
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| model | string | — | |
| input | string | object[] | — | 輸入內容,可為字串或訊息陣列 |
| instructions | string | — | — |
| previous_response_id | string | — | — |
回應
200已壓縮對話
| 欄位 | 類型 | 必填 | 說明 |
|---|---|---|---|
| id | string | — | — |
| object | string | — | — |
| created_at | integer | — | — |
| output | object[] | — | — |
| 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 | — | — |
| error | object | — | — |
請求範例
curl -X POST 'https://api.oletoken.ai/v1/responses/compact' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "string"
}'
