> 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 full documentation content, see https://developers.meshapi.ai/llms-full.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 Node.js SDK.

# Batches

Submit a list of requests inline, kick off a batch, poll until done. Batch jobs run at discounted pricing.

```ts
// 1. Create the batch
const batch = await client.batches.create({
  requests: [
    {
      custom_id: "req-1",
      body: {
        model: "openai/gpt-4o-mini",
        messages: [{ role: "user", content: "Say hi." }],
      },
    },
    {
      custom_id: "req-2",
      body: {
        model: "openai/gpt-4o-mini",
        messages: [{ role: "user", content: "Say bye." }],
      },
    },
  ],
  completion_window: "24h",
});

// 2. Poll later
const status = await client.batches.get(batch.id);
if (status.status === "completed" && status.output_file_id) {
  // Returns raw JSONL content as Uint8Array
  const outputBytes = await client.files.content(status.output_file_id);
}
```