> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.meshapi.ai/_mcp/server.

# Batches

> Process large workloads with the Go SDK.

# Batches

Process thousands of requests asynchronously. Results are returned inline in the poll response — no separate file download required.

## 1. Create a Batch

```go
batch, err := client.Batches.Create(ctx, meshapi.CreateBatchParams{
    Requests: []meshapi.BatchRequestItem{
        {
            CustomID: "req-1",
            Body: map[string]interface{}{
                "model": "openai/gpt-5.4",
                "messages": []map[string]string{
                    {"role": "user", "content": "Say hi."},
                },
            },
        },
    },
    CompletionWindow: "24h",
})
```

## 2. Monitor and Retrieve

```go
// Poll until completed
status, _ := client.Batches.Get(ctx, batch.ID)

// Results are included inline once status is "completed"
if status.Status == "completed" {
    for _, result := range status.Results {
        fmt.Println(result.CustomID, result.Response.Body.Choices[0].Message.Content)
    }
}
```