Skip to main content

Overview

Submit, list, poll, cancel, and delete asynchronous batches of inference requests. See https://openrouter.ai/docs/batch-quickstart.

Available Operations

list

Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page’s last_id as after. List items omit results. Use GET /batches/{id} to get them. See the Batch API Quickstart.

Example Usage

Parameters

Response

operations.ListBatchesResponse

Errors

create_batches

Creates a batch of requests that run asynchronously against a single endpoint (/v1/chat/completions, /v1/responses, /v1/messages, /v1/embeddings, /v1/audio/speech, /v1/images/generations). Returns 202 with status: "validating". Poll GET /batches/{id} for progress and results. See the Batch API Quickstart.

Example Usage: chatCompletions

Example Usage: messages

Example Usage: providerPinned

Example Usage: responses

Parameters

Response

components.BatchObject

Errors

delete

Deletes a batch in a terminal status (completed, failed, expired, or cancelled) and its stored requests and results. Batches still in progress return 409. Billing and usage records are kept. See the Batch API Quickstart.

Example Usage

Parameters

Response

components.BatchDeletedObject

Errors

get_batches

Returns a batch with its status and request counts. Batches in a terminal status include results. Failed batches report the reason in error.message. See the Batch API Quickstart.

Example Usage

Parameters

Response

components.BatchObject

Errors

cancel

Asks the provider to stop a batch that is still running. Cancellation is enabled per organization; other organizations get 403. The response is the batch in its current status: it stays in_progress until the provider confirms, then becomes cancelled, or completed, failed, or expired when the provider job ended first. Poll until the batch has any final status. Repeating the call is safe while the batch is still in_progress; once it has a final status the call returns 409. OpenRouter returns no result rows for a cancelled batch, and the provider still charges for the requests that finished before the cancellation. When the batch wrote its output to your own storage, retrieving the batch can still return that location, and the rows the provider wrote there stay yours to read. See the Batch API Quickstart.

Example Usage

Parameters

Response

components.BatchObject

Errors

get_results

Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page’s next_cursor as cursor to read the next page. Pages are stable across retries for the 30-day artifact retention window. See the Batch API Quickstart.

Example Usage

Parameters

Response

operations.GetBatchResultsResponse

Errors