v2026.5.2
All Bundles

Batch

Batch API for asynchronous bulk request processing.

Inherits: EndPoint
# 1. build a .jsonl file of requests and upload it
data := FileReader->ReadFile("requests.jsonl")->ToByteArray();
file := File->Create("requests.jsonl", "batch", data, token);

# 2. create a batch job
job := Batch->Create(file->GetId(), "/v1/chat/completions", token);
job->ToString()->PrintLine();

# 3. poll until done
job = Batch->Get(job->GetId(), token);
"Status: {$job->GetStatus()}"->PrintLine();

Operations

Cancel

Cancel a running batch job

function : Cancel(batch_id:String, token:String) ~ BatchJob

Parameters

NameTypeDescription
batch_idStringbatch ID
tokenStringAPI key

Return

TypeDescription
BatchJobupdated batch job, Nil on error

Create

Create a batch job with the 24-hour completion window

function : Create(file_id:String, endpoint:String, token:String) ~ BatchJob

Parameters

NameTypeDescription
file_idStringuploaded .jsonl file ID
endpointStringtarget API endpoint (e.g. '/v1/chat/completions')
tokenStringAPI key

Return

TypeDescription
BatchJobcreated batch job, Nil on error

Create

Create a batch job with a custom completion window

function : Create(file_id:String, endpoint:String, completion_window:String, token:String) ~ BatchJob

Parameters

NameTypeDescription
file_idStringuploaded .jsonl file ID
endpointStringtarget API endpoint
completion_windowStringtime allowed for completion (only '24h' is currently supported)
tokenStringAPI key

Return

TypeDescription
BatchJobcreated batch job, Nil on error

Get

Retrieve a batch job by ID

function : Get(batch_id:String, token:String) ~ BatchJob

Parameters

NameTypeDescription
batch_idStringbatch ID
tokenStringAPI key

Return

TypeDescription
BatchJobbatch job, Nil on error

List

List recent batch jobs (up to 20)

function : List(token:String) ~ Vector<BatchJob>

Parameters

NameTypeDescription
tokenStringAPI key

Return

TypeDescription
Vector<BatchJob>list of batch jobs, Nil on error

List

List batch jobs with a result limit

function : List(limit:Int, token:String) ~ Vector<BatchJob>

Parameters

NameTypeDescription
limitIntmaximum number of results
tokenStringAPI key

Return

TypeDescription
Vector<BatchJob>list of batch jobs, Nil on error