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
  • Introduction
    • Product Overview
    • Pricing
    • Model Explanation
    • Available Models
  • Guides
    • Quickstart
    • Authentication
    • BYOK
    • Dashboard Guide
    • Prompt Templates
    • Embeddings
    • RAG (Files & Search)
    • Audio
    • Images & Vision
    • Image Generation
    • Compare
    • Batch API
    • Auto Routing
    • Realtime Audio
  • SDKs
    • Node.js (TypeScript)
    • Python
    • Go
  • Infrastructure
    • Architecture
LogoLogo
On this page
  • Workflow
  • 1 & 2. Create the batch
  • 3. Poll for status
  • 4. Download results
  • Notes
Guides

Batch API

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

Compare

Next

Auto Routing

Built with

The Batch API is for asynchronous, high-volume inference jobs where you do not need an answer immediately.

Workflow

  1. Prepare a request bundle
  2. Create a batch with POST /v1/batches
  3. Poll GET /v1/batches/{batch_id}
  4. Download results from GET /v1/files/{file_id}/content

1 & 2. Create the batch

Pass your requests inline — no separate file upload required.

curl
Node.js SDK
Python SDK
Go SDK
Java SDK
$curl https://api.meshapi.ai/v1/batches \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -H "Content-Type: application/json" \
> -d '{
> "requests": [
> {
> "custom_id": "doc-001",
> "body": {
> "model": "openai/gpt-4o-mini",
> "messages": [{ "role": "user", "content": "Summarize this note." }]
> }
> }
> ],
> "completion_window": "24h"
> }'

3. Poll for status

$curl https://api.meshapi.ai/v1/batches/batch_xyz789 \
> -H "Authorization: Bearer <YOUR_RSK_KEY>"

Common statuses:

  • validating
  • in_progress
  • completed
  • failed
  • cancelled
  • expired

4. Download results

When status is completed, the response includes output_file_id. Download the results via the Files API:

$curl https://api.meshapi.ai/v1/files/<OUTPUT_FILE_ID>/content \
> -H "Authorization: Bearer <YOUR_RSK_KEY>" \
> -o results.jsonl

Notes

  • All requests in a batch must use the same model.
  • Batch jobs are best for throughput, not low-latency interactive use.
  • Use GET /v1/batches to list recent batches and POST /v1/batches/{batch_id}/cancel to cancel one.