Skip to content

The batch object

Represents a batch submitted to the Batch API.


id string A unique identifier for the batch.


object string The object type, which is always batch.


endpoint string The endpoint to be used for all requests in the batch.


model string The model ID used for all requests in the batch.


input_file_id string The ID of the input file for the batch.


output_file_id string or null The ID of the file containing the successful outputs for the batch.


error_file_id string or null The ID of the file containing error outputs for the batch.


completion_window string The time window for batch processing (for example: 24h).


status string The current status of the batch.


request_counts object Aggregate request counts for the batch.


usage object or null Usage information for the batch, which includes total tokens used. This field is only present for batches created on or after September 7, 2025.


created_at integer Unix timestamp (seconds) for when the batch was created.


in_progress_at integer or null Unix timestamp (seconds) for when the batch started processing.


finalizing_at integer or null Unix timestamp (seconds) for when the batch started finalizing.


completed_at integer or null Unix timestamp (seconds) for when the batch completed.


failed_at integer or null Unix timestamp (seconds) for when the batch failed.


expired_at integer or null Unix timestamp (seconds) for when the batch expired.


cancelling_at integer or null Unix timestamp (seconds) for when the batch started cancelling.


cancelled_at integer or null Unix timestamp (seconds) for when the batch was cancelled.


expires_at integer or null Unix timestamp (seconds) for when the batch will expire.


errors object or null Top-level error information for the batch, if any.


metadata map Developer-defined metadata.


OBJECT The batch object
bash
{
  "id": "batch_abc123",
  "object": "batch",
  "endpoint": "/v1/completions",
  "model": "gpt-5-2025-08-07",
  "errors": null,
  "input_file_id": "file-abc123",
  "completion_window": "24h",
  "status": "completed",
  "output_file_id": "file-cvaTdG",
  "error_file_id": "file-HOWS94",
  "created_at": 1711471533,
  "in_progress_at": 1711471538,
  "expires_at": 1711557933,
  "finalizing_at": 1711493133,
  "completed_at": 1711493163,
  "failed_at": null,
  "expired_at": null,
  "cancelling_at": null,
  "cancelled_at": null,
  "request_counts": {
    "total": 100,
    "completed": 95,
    "failed": 5
  },
  "usage": {
    "input_tokens": 1500,
    "output_tokens": 500,
    "total_tokens": 2000,
    "input_tokens_details": {
      "cached_tokens": 1024
    },
    "output_tokens_details": {
      "reasoning_tokens": 300
    }
  },
  "metadata": {
    "customer_id": "user_123456789",
    "batch_description": "Nightly eval job"
  }
}

那年我双手插兜, 让bug稳如老狗