檔案與批次
列出檔案
列出已上傳的 batch 與圖片參照檔案。
列出 batch 與圖片參照檔案。可使用 purpose=batch、purpose=batch_output、purpose=user_data 或 purpose=vision 進行篩選。
搭配 Anthropic Files 標頭時,相同的 API 會列出目前 Workspace 中 Anthropic 格式的檔案。
請求
curl -X GET "https://api.tokenlab.sh/v1/files?purpose=batch&limit=20" \
-H "Authorization: Bearer sk-your-api-key"篩選條件
- 對於 batch 與圖片參照檔案,
limit為 1–10000(預設為 10000),並使用after進行分頁。在 Anthropic Files 模式下,limit為 1–1000(預設為 20);請使用after_id或before_id其中之一,不可兩者同時使用。 purpose可為batch、batch_output、user_data或vision。user_data與vision會在可用時傳回 TokenLab 建立的圖片參照檔案。
回應
{
"object": "list",
"data": [{ "id": "file_abc123", "object": "file", "purpose": "batch" }],
"first_id": "file_abc123",
"last_id": "file_abc123",
"has_more": false
}重要欄位
list。has_more 為 true 時,表示還有更多結果可供取得。授權
BearerAuth API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。
位置: header
查詢參數
要回傳的檔案數量。批次與圖片檔案為 1 至 10,000(預設 10,000);Anthropic Files 模式下為 1 至 1,000(預設 20)。
1 <= value <= 10000Anthropic Files 游標。返回此公開檔案 ID 之後的檔案。需要 Anthropic Files beta 標頭,且不能與 before_id 結合使用。
Anthropic Files 游標。返回此公開檔案 ID 之前的檔案。需要 Anthropic Files beta 標頭,且不能與 after_id 結合使用。
保留的 Anthropic Files 範圍游標。TokenLab 目前會返回明確的不支援錯誤,而不是靜默忽略此值。
選填的檔案用途篩選器。batch 和 batch_output 涵蓋 Batch API 檔案;user_data 和 vision 涵蓋 TokenLab 圖片/參考檔案綁定。Anthropic Files API 模式由 Anthropic 標頭選定,而非此查詢參數。
可選值
- "batch"
- "batch_output"
- "user_data"
- "vision"
請求標頭
包含 files-api-2025-04-14 以使用 Anthropic Files API 模式。
回應
application/json
application/json