Auto-Pagination
The SDK automatically fetches additional pages as you iterate:Async Pagination
Async iteration works the same way:Manual Page Control
For more granular control over pagination, use the page helper methods:Checking for More Pages
Fetching the Next Page
Async Page Fetching
Working with Page Data
Access the raw page data directly:Page Types
The SDK uses different pagination types depending on the endpoint:Cursor Pagination (SyncCursorPage)
Most endpoints use cursor-based pagination:Conversation Cursor Pagination
Some endpoints use conversation-style pagination with alast_id:
Pagination Parameters
Common pagination parameters:| Parameter | Description |
|---|---|
limit | Maximum number of items per page |
after | Cursor for fetching the next page |
before | Cursor for fetching the previous page (if supported) |
Collecting All Pages
To collect all items from all pages:Example: Processing in Batches
Process items in batches (one page at a time):Paginated Endpoints
Common endpoints that support pagination:client.fine_tuning.jobs.list()client.files.list()client.beta.vector_stores.list()client.beta.vector_stores.files.list()client.beta.threads.messages.list()client.beta.threads.runs.list()client.beta.threads.runs.steps.list()