> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tokenlab.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# 列出檔案

> 列出上傳的檔案以及受支援的檔案後備相容模式。

## 概述

此端點主要服務於 TokenLab 的 OpenAI 相容 Batch API，包括上傳的批次輸入檔案以及生成的輸出或錯誤檔案。

當請求選擇 Anthropic Files 相容模式時，同一路由也可以列出繫結工作區中可用的 Anthropic 風格檔案。

不帶 Anthropic 標頭時，列表可能同時包含批次檔案和 TokenLab 圖像/參考檔案。可用 `purpose=batch`、`purpose=batch_output`、`purpose=user_data` 或 `purpose=vision` 縮小範圍。

## 注意事項

* 批次輸入檔案必須使用 `purpose=batch`。
* 使用 `purpose=batch_output` 以聚焦生成的輸出檔案。
* `completion_window` 目前為 `24h`。
* 輸出順序不保證；始終根據 `custom_id` 匹配。
* 批次項目內不支援串流。

## 範例

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tokenlab.sh/v1/files?purpose=batch&limit=20" \
    -H "Authorization: Bearer sk-your-api-key"
  ```
</RequestExample>

## 請求 / 回應

使用上方的互動式 OpenAPI 面板以獲取確切的架構。

## 操作提示

* 使用 `custom_id` 進行冪等的下游對帳。
* 只有在工作者完成批次後，才預期會有 `output_file_id` 和 `error_file_id`。
* 批次定價可能與同步定價不同，因為適用 `isBatchRequest=true` 的折扣規則。

## 回應範例

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "object": "list",
    "data": [{ "id": "file_abc123", "object": "file", "purpose": "batch" }]
  }
  ```
</ResponseExample>

## 重要欄位

<ResponseField name="object" type="string">回應物件類型。</ResponseField>
<ResponseField name="data" type="array">本次回應返回的列表或載荷。</ResponseField>
