Skip to main content
Methods: client.create_batch(), client.get_batch().

Example

uploaded = client.upload_file(purpose="batch", file=open("batchinput.jsonl", "rb"))
batch = client.create_batch({"endpoint": "responses", "input_file_id": uploaded.id, "completion_window": "24h"})
status = client.get_batch(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