> 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

> Run async bulk inference jobs with the Python SDK.

# Batches

Submit a list of requests inline, kick off a batch, poll until done. Batch jobs run at discounted pricing. Results are returned inline in the poll response — no separate file download required.

```python
from meshapi import (
    BatchRequestItem,
    CreateBatchParams,
)

# 1. Create the batch
batch = client.batches.create(
    CreateBatchParams(
        requests=[
            BatchRequestItem(
                custom_id="req-1",
                body={
                    "model": "openai/gpt-5.4",
                    "messages": [{"role": "user", "content": "Say hi."}],
                },
            ),
            BatchRequestItem(
                custom_id="req-2",
                body={
                    "model": "openai/gpt-5.4",
                    "messages": [{"role": "user", "content": "Say bye."}],
                },
            ),
        ],
        completion_window="24h",
    )
)

# 2. Poll later — results are included once status is "completed"
status = client.batches.get(batch.id)
if status.status == "completed":
    for result in status.results or []:
        print(result["custom_id"], result["response"]["body"]["choices"][0]["message"]["content"])
```