> ## 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 请求头时，此路由下载批量文件内容；如果提供商支持文件内容读取，也会代理已绑定图像/参考文件的内容。

## 注意事项

* 批处理输入文件必须使用 `purpose=batch`。
* 使用 `purpose=batch_output` 以聚焦生成的输出文件。
* `completion_window` 当前为 `24h`。
* 输出顺序不保证；始终通过 `custom_id` 匹配。
* 批处理项内不支持流式传输。

## 示例

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.tokenlab.sh/v1/files/file_abc123/content" \
    -H "Authorization: Bearer sk-your-api-key" \
    --output batch-output.jsonl
  ```
</RequestExample>

## 请求 / 响应

使用上面的交互式 OpenAPI 面板获取确切的模式。

## 操作提示

* 使用 `custom_id` 进行幂等的下游对账。
* 仅在工作者完成批处理后，期待 `output_file_id` 和 `error_file_id`。
* 批处理定价可能与同步定价不同，因为适用 `isBatchRequest=true` 的折扣规则。

## 响应示例

<ResponseExample>
  ```jsonl 200 OK theme={null}
  {"custom_id":"request-1","response":{"status_code":200,"body":{"id":"chatcmpl_abc123"}}}
  {"custom_id":"request-2","error":{"code":"invalid_request_error","message":"Invalid model"}}
  ```
</ResponseExample>

## 重要字段

<ResponseField name="body" type="binary|string">原始响应体。应直接保存，不要按 JSON 解析。</ResponseField>
<ResponseField name="custom_id" type="string">用于后续调用和支持排障的标识符。</ResponseField>
