Skip to main content
Methods: client.createBatch(), client.getBatch().

Example

const batch = await client.createBatch({
  endpoint: "responses",
  input_file_id: "file_123",
  completion_window: "24h",
});
const status = await client.getBatch(batch.id);

Key parameters

  • endpoint (required): Target endpoint for batch items (e.g., responses).
  • input_file_id (required): File id uploaded via /files.
  • completion_window: e.g., 24h.
  • metadata: Optional object stored with the batch.

Returns

BatchResponse
{
  "id": "batch_123",
  "object": "batch",
  "endpoint": "responses",
  "status": "completed",
  "created_at": 1677610602,
  "completed_at": 1677610602,
  "input_file_id": "file_123",
  "output_file_id": "file_456",
  "error_file_id": null
}