For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
DocsAPI ReferenceSDKs
DocsAPI ReferenceSDKs
      • Overview
      • Chat Completions
      • Prompt Templates
      • Files & Batches
      • Embeddings
      • Image Generation
      • Responses (Reasoning)
      • Compare (Multi-model)
      • Models
      • Error Handling
LogoLogo
On this page
  • Batches
  • 1. Create a Batch
  • 2. Monitor and Retrieve
Go SDK

Batches

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Prompt Templates

Next

Embeddings

Built with

Batches

Process thousands of requests asynchronously.

1. Create a Batch

1batch, 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})

2. Monitor and Retrieve

1// Get status
2status, _ := client.Batches.Get(ctx, batch.ID)
3
4// Download results once status is "completed"
5if status.Status == "completed" {
6 results, _ := client.Files.Content(ctx, *status.OutputFileID)
7 // process results
8}