Skip to main content

Overview

This endpoint primarily serves TokenLab’s OpenAI-compatible Batch API file objects. When the request opts into Anthropic Files compatibility mode, the same route can also return Anthropic-style file metadata for the bound workspace. Without Anthropic headers, this route can return either a batch file object or a TokenLab image/reference file object.

Notes

  • Batch input files must use purpose=batch.
  • completion_window is currently 24h.
  • Output ordering is not guaranteed; always match by custom_id.
  • Streaming is not supported inside batch items.

Example

curl -X GET "https://api.tokenlab.sh/v1/files/file_abc123" \
  -H "Authorization: Bearer sk-your-api-key"

Request / Response

Use the interactive OpenAPI panel above for the exact schema.

Operational Tips

  • Use custom_id for idempotent downstream reconciliation.
  • Expect output_file_id and error_file_id only after the worker finalizes the batch.
  • Batch pricing may differ from synchronous pricing because isBatchRequest=true discount rules apply.

Response example

{
  "id": "file_abc123",
  "object": "file",
  "bytes": 32768,
  "created_at": 1706000000,
  "filename": "batch-input.jsonl",
  "purpose": "batch"
}

Important fields

id
string
File identifier used by related APIs.
filename
string
Original or generated file name.
purpose
string
File purpose used by the owning workflow, such as batch, batch_output, user_data, or vision.