Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Batches

Create large batches of API requests to run asynchronously.

Cancel batch
client.Batches.Cancel(ctx, batchID) (*Batch, error)
POST/batches/{batch_id}/cancel
Create batch
client.Batches.New(ctx, body) (*Batch, error)
POST/batches
List batches
client.Batches.List(ctx, query) (*CursorPage[Batch], error)
GET/batches
Retrieve batch
client.Batches.Get(ctx, batchID) (*Batch, error)
GET/batches/{batch_id}
ModelsExpand Collapse
type Batch struct{…}
type BatchError struct{…}
type BatchRequestCounts struct{…}

The request counts for different statuses within the batch.

type BatchUsage struct{…}

Represents token usage details including input tokens, output tokens, a breakdown of output tokens, and the total tokens used. Only populated on batches created after September 7, 2025.