Batches

Batches

A batch lets you submit up to 256 async inference requests in a single API call. All items are validated up front — if any item is malformed, the entire batch is rejected before anything is created. Once accepted, each item becomes an independent async job that runs as providers have capacity — batch jobs share the same per-device capacity budget as everything else, so a 256-image batch on a single-slot GPU runs one image at a time.

POST /v1/batches

curl -X POST https://api.inference.club/v1/batches \
  -H "Authorization: Bearer $INFERENCE_CLUB_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Q2 product shots",
    "requests": [
      {
        "endpoint": "/v1/images/generations",
        "body": { "model": "flux-dev", "prompt": "a minimalist desk lamp" }
      },
      {
        "endpoint": "/v1/images/generations",
        "body": { "model": "flux-dev", "prompt": "a wooden bookshelf with plants" }
      },
      {
        "endpoint": "/v1/chat/completions",
        "body": {
          "model": "qwen3-8b",
          "messages": [{ "role": "user", "content": "Write a product description for a lamp." }]
        }
      }
    ]
  }'

Response: 202 Accepted with the batch object (shape below).

Request body

FieldTypeNotes
requestsarrayRequired. 1–256 items.
requests[].endpointstringRequired. One of the supported endpoints (see below).
requests[].bodyobjectRequired. The inference body for that endpoint (same shape as a direct call; any async field is ignored).
labelstringOptional. A human-readable name for the batch.

Supported endpoints

EndpointInference type
/v1/chat/completionsLLM
/v1/completionsLLM
/v1/images/generationsIMAGE
/v1/videos/generationsVIDEO
/v1/music/generationsMUSIC
/v1/audio/speechTTS

File-upload endpoints, /v1/voice/generations, and /v1/scrape are not batch-submittable.

GET /v1/batches

List your batches, newest first (up to 50).

curl https://api.inference.club/v1/batches \
  -H "Authorization: Bearer $INFERENCE_CLUB_KEY"

GET /v1/batches/<id>

Batch status, per-status job counts, and every job (each in the full job shape, including output_text and media).

curl https://api.inference.club/v1/batches/7 \
  -H "Authorization: Bearer $INFERENCE_CLUB_KEY"
{
  "id": 7,
  "label": "Q2 product shots",
  "status": "RUNNING",
  "counts": { "PROCESSED": 2, "PROCESSING": 1 },
  "created_on": "2026-06-13T12:00:00Z",
  "jobs": [
    { "id": 43, "status": "PROCESSED", "inference_type": "IMAGE", "media": [ … ] },
    { "id": 44, "status": "PROCESSING", "inference_type": "IMAGE", "media": [] },
    { "id": 45, "status": "PROCESSED", "inference_type": "LLM", "output_text": "…" }
  ]
}

Batch status is rolled up from its jobs:

Batch statusMeaning
RUNNINGAt least one job is still QUEUED or PROCESSING.
DONEEvery job PROCESSED.
PARTIALAll jobs finished; some succeeded, some failed or were canceled.
FAILEDAll jobs finished and none succeeded.
EMPTYThe batch has no jobs.

Poll it like a job (3s → 15s backoff) until the status is no longer RUNNING.

Cancel a batch

POST /v1/batches/<id> (the same path, no suffix) cancels every QUEUED or PROCESSING job in the batch and returns the updated batch object.

curl -X POST https://api.inference.club/v1/batches/7 \
  -H "Authorization: Bearer $INFERENCE_CLUB_KEY"

Individual jobs

Each item in a batch is a regular async job accessible via GET /v1/jobs/<id>. Results (including media URLs) are on the individual job objects, not the batch.

Errors

typeWhenHTTP
invalid_requestrequests is missing, empty, or an item is malformed400
too_largeMore than 256 items400
async_disabledAsync processing is not enabled on this server503