Overview
Submit, list, poll, cancel, and delete asynchronous batches of inference requests. See https://openrouter.ai/docs/batch-quickstart.Available Operations
- list - List batches
- createBatches - Create a batch
- delete - Delete a batch
- getBatches - Get a batch
- cancel - Cancel a batch
- getResults - Get batch results
list
Lists batches in the workspace of the authenticating API key, newest first. To fetch the next page, pass the previous page’slast_id as after. List items omit results. Use GET /batches/{id} to get them. See the Batch API Quickstart.
Example Usage
Standalone function
The standalone function version of this method:Parameters
Response
Promise<operations.ListBatchesResponse>Errors
createBatches
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
Standalone function
The standalone function version of this method:Example Usage: messages
Standalone function
The standalone function version of this method:Example Usage: providerPinned
Standalone function
The standalone function version of this method:Example Usage: responses
Standalone function
The standalone function version of this method:Parameters
Response
Promise<models.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
Standalone function
The standalone function version of this method:Parameters
Response
Promise<models.BatchDeletedObject>Errors
getBatches
Returns a batch with its status and request counts. Batches in a terminal status includeresults. Failed batches report the reason in error.message. See the Batch API Quickstart.
Example Usage
Standalone function
The standalone function version of this method:Parameters
Response
Promise<models.BatchObject>Errors
cancel
Asks the provider to stop a batch that is still running. Cancellation is enabled per organization; other organizations get403. 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
Standalone function
The standalone function version of this method:Parameters
Response
Promise<models.BatchObject>Errors
getResults
Returns a cursor-paginated page of normalized OpenRouter-format results for a finished batch. Pass the previous page’snext_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.