TokenLab

檔案與批次

列出檔案

列出已上傳的批次處理 (batch) 與影像參照 (image-reference) 檔案。

GET
/v1/files

列出批次處理與影像參照檔案。可使用 purpose=batch、purpose=batch_output、purpose=user_data 或 purpose=vision 進行篩選。

若使用 Anthropic Files 標頭,相同的 API 將列出目前 Workspace 中 Anthropic 格式的檔案。

範例

請求

cURL
curl -X GET "https://api.tokenlab.sh/v1/files?purpose=batch&limit=20" \
  -H "Authorization: Bearer sk-your-api-key"

篩選器

  • 對於批次處理與影像參照檔案,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 建立的影像參照檔案。

回應範例

回應

200 OK
{
  "object": "list",
  "data": [{ "id": "file_abc123", "object": "file", "purpose": "batch" }],
  "first_id": "file_abc123",
  "last_id": "file_abc123",
  "has_more": false
}

重要欄位

objectstring
固定為 list。
dataarray
檔案列表。
has_moreboolean
當 has_more 為 true 時,表示還有更多結果可供讀取。

授權

BearerAuth
AuthorizationBearer <token>

API Key 驗證。請在 Dashboard > API > API Keys 建立或管理 API 金鑰。

位置: header

查詢參數

limit?integer
範圍1 <= value <= 1000
預設值20
after?string
after_id?string

Anthropic Files 游標。返回此公開檔案 ID 之後的檔案。需要 Anthropic Files beta 標頭,且不能與 before_id 結合使用。

before_id?string

Anthropic Files 游標。返回此公開檔案 ID 之前的檔案。需要 Anthropic Files beta 標頭,且不能與 after_id 結合使用。

scope_id?string

保留的 Anthropic Files 範圍游標。TokenLab 目前會返回明確的不支援錯誤,而不是靜默忽略此值。

purpose?string

選填的檔案用途篩選器。batch 和 batch_output 涵蓋 Batch API 檔案;user_data 和 vision 涵蓋 TokenLab 圖片/參考檔案綁定。Anthropic Files API 模式由 Anthropic 標頭選定,而非此查詢參數。

可選值

  • "batch"
  • "batch_output"
  • "user_data"
  • "vision"

請求標頭

anthropic-beta?string

包含 files-api-2025-04-14 以使用 Anthropic Files API 模式。

回應

application/json

application/json