TsgcHTTP_API_OpenAI › Methods › ListBatches
Returns a paginated list of Batch jobs for the current organization
function ListBatches(const aLimit: Integer = 20; const aAfter: string = '') : TsgcOpenAIClass_Response_List_Batches;
| Name | Type | Description |
|---|---|---|
aLimit | const Integer | Maximum number of Batch jobs to return (1-100, defaults to 20). |
aAfter | const string | Cursor for forward pagination; pass the last Batch id from the previous page. |
Paginated list of Batch jobs with the HasMore flag for further iteration (TsgcOpenAIClass_Response_List_Batches)
Calls GET /v1/batches to enumerate Batch jobs created under the current API key. Useful to build dashboards or to locate the id of a Batch previously submitted with CreateBatch.
var oList: TsgcOpenAIClass_Response_List_Batches;
i: Integer;
begin
oList := oAPI.ListBatches(20);
for i := 0 to oList.Data.Count - 1 do
Memo1.Lines.Add(oList.Data[i].Id + ' - ' + oList.Data[i].Status);
end;