Skip to main content
Portkey exposes OpenAI’s Batch API through one consistent endpoint, so you can run large, asynchronous evaluation jobs at 50 % lower cost. Use batches when you need to run large jobs offline — e.g. nightly evals, A/B tests, or bulk embeddings.

Create Batch Job

Upload your .jsonl file first — see Files API for more details and then use the following code to create a batch job.

List Batch Jobs

Get Batch Job Details

The status of a given Batch object can be any of the following:
StatusDescription
validatingthe input file is being validated before the batch can begin
failedthe input file has failed the validation process
file_upload_failedthe batch job failed to upload the file to the provider after validation
batch_start_failedthe file upload succeeded but the batch job submission to the provider failed
in_progressthe input file was successfully validated and the batch is currently being run
finalizingthe batch has completed and the results are being prepared
completedthe batch has been completed and the results are ready
expiredthe batch was not able to be completed within the 24-hour time window
cancellingthe batch is being cancelled (may take up to 10 minutes)
cancelledthe batch was cancelled

Get Batch Output

Cancel Batch Job

Last modified on April 8, 2026