文件与批处理
获取文件信息
获取一个已上传文件的信息。
返回文件名、大小、用途和创建时间。不带 Anthropic 请求头时,可查询批处理文件和图片参考文件;携带对应请求头时,可查询 Anthropic 格式文件。
请求
curl -X GET "https://api.tokenlab.sh/v1/files/file_abc123" \
-H "Authorization: Bearer sk-your-api-key"图像参考文件
此端点也可以返回 TokenLab 创建的图像参考文件元数据。status 字段是可选的;某些文件类型可能不会提供该字段。
响应
{
"id": "file_abc123",
"object": "file",
"bytes": 32768,
"created_at": 1706000000,
"filename": "batch-input.jsonl",
"purpose": "batch"
}重要字段
idstring
文件 ID。
filenamestring
文件名。
purposestring
文件用途,例如
batch、batch_output、user_data 或 vision。授权
BearerAuth AuthorizationBearer <token>
API Key 身份验证。在 Dashboard > API > API Keys 中创建或管理 API Key。
位置: header
路径参数
file_id*string
请求头
anthropic-beta?string
包含 files-api-2025-04-14 以使用 Anthropic Files API 模式。
响应
application/json
application/json