Batch Processing

Batch processing (batching) allows you to send multiple message requests in a single batch and retrieve the results later (within up to 1 hour). The main goals are to reduce costs by up to 50% and increase throughput for analytical or offline workloads.

To use batch processing, several endpoints are available:

Create a message batch

https://api.aimlapi.com/batches

Get status or results of a batch

https://api.aimlapi.com/batches?batch_id={batch_id}

Cancel a batch

https://api.aimlapi.com/batches/cancel/{batch_id}


Create a batch

post
Body
Responses
200Success
Code Example (Python)
Response

Get status or results of a batch

get
Query parameters
batch_idstringRequired

The ID of the batch to retrieve its status and results.

Example: <REPLACE_WITH_YOUR_BATCH_ID>
Responses
200Success
Code Example (Python)
Response #1 (status: generating)
Response #2 (status: if already cancelled)
Response #3 (if already finished)

Cancel a batch

post
Path parameters
batch_idstringRequired

The ID of the batch to cancel.

Example: <REPLACE_WITH_YOUR_BATCH_ID>
Responses
200Success
Code Example (Python)
Response #1 (successfully cancelled)
Response #2 (if already finished)

Last updated

Was this helpful?