Process thousands of requests asynchronously.
1 batch, err := client.Batches.Create(ctx, meshapi.CreateBatchParams{ 2 Requests: []meshapi.BatchRequestItem{ 3 { 4 CustomID: "req-1", 5 Body: map[string]interface{}{ 6 "model": "openai/gpt-4o-mini", 7 "messages": []map[string]string{ 8 {"role": "user", "content": "Say hi."}, 9 }, 10 }, 11 }, 12 }, 13 CompletionWindow: "24h", 14 })
1 // Get status 2 status, _ := client.Batches.Get(ctx, batch.ID) 3 4 // Download results once status is "completed" 5 if status.Status == "completed" { 6 results, _ := client.Files.Content(ctx, *status.OutputFileID) 7 // process results 8 }