batch

List batches

Page through the key's batches, newest first.

get/v1/batches

Query parameters

limitinteger

Batches per page. Default 20, max 100.

Example:20

How many batches to return in this page.

afterinteger

Offset cursor: how many batches to skip. Add limit to it for each next page.

Example:20

Pagination offset into your batches. An integer count, not an object id, so page manually rather than with the SDK auto-paginator.

Response

The requested page of batches.

objectstring required

Object type of a batch page, always list.

first_idstring nullable required

Id of the first batch in this page, or null when the page is empty.

last_idstring nullable required

Id of the last batch in this page, or null when the page is empty.

has_moreboolean required

Whether more batches exist after this page.

Example response

{
  "object": "list",
  "data": [
    {
      "id": "batch_5f4e3d2c-1b0a-4f9e-8d7c-6b5a4f3e2d1c",
      "object": "batch",
      "endpoint": "/v1/chat/completions",
      "input_file_id": "file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f",
      "completion_window": "24h",
      "metadata": {
        "job": "nightly-summaries"
      },
      "created_at": 1780000000,
      "status": "completed",
      "model": "morph-glm53flash",
      "output_file_id": "file_0e7d6c5b-4a39-4281-9f7e-6d5c4b3a2918",
      "error_file_id": "file_7f6e5d4c-3b2a-4190-8e7d-6c5b4a392817",
      "in_progress_at": 1780000012,
      "finalizing_at": 1780005460,
      "completed_at": 1780005470,
      "failed_at": null,
      "expired_at": null,
      "expires_at": 1780086400,
      "cancelling_at": null,
      "cancelled_at": null,
      "request_counts": {
        "total": 2,
        "completed": 2,
        "failed": 0
      },
      "errors": null,
      "usage": {
        "input_tokens": 824,
        "input_tokens_details": {
          "cached_tokens": 0
        },
        "output_tokens": 36,
        "output_tokens_details": {
          "reasoning_tokens": 0
        },
        "total_tokens": 860
      }
    }
  ],
  "first_id": "batch_5f4e3d2c-1b0a-4f9e-8d7c-6b5a4f3e2d1c",
  "last_id": "batch_5f4e3d2c-1b0a-4f9e-8d7c-6b5a4f3e2d1c",
  "has_more": false
}

Changes

Changed in 1 of the 3 revisions of this API.1