Reference · Tools

OpenAI Batch

Process multiple requests as a batch job via OpenAI Batch API.

Action AI v1

OpenAI Batch processes many chat completion or embedding requests as a single asynchronous job, bundling the inputs into a JSONL file and submitting them together. A typical build is embedding a large document corpus overnight rather than making thousands of individual calls.

Node type
Action
Parameters
8
Outputs
Output, Error
Credentials
OpenAI

OpenAI Batch

Process multiple requests as a batch job via OpenAI Batch API.

Overview

OpenAI Batch uses the OpenAI Batch API to process multiple chat completion or embedding requests asynchronously. Supports three operations: create (build JSONL from input items, upload as file, create batch), check (poll batch status), and cancel (cancel a running batch). For the create operation, all input items are collected into a single batch request. Optionally polls for completion with configurable intervals and timeouts.

Category: AI
Tool Name: openai_batch
Version: 1

Appearance: Icon: openai | Color: #10a37f

Node Type

Action — processes input items and produces output

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires OpenAI credentials. See the Credentials Guide for setup instructions.

Operations

OperationValueDescription
Create BatchcreateCreate a new batch job from input items.
Check StatuscheckCheck the status of an existing batch.
Cancel BatchcancelCancel a running batch.

Parameters

Create Batch (create)

ParameterTypeRequiredDefaultDescription
ModelstringNo(current default)The OpenAI model to use for batch requests. Falls back to the centralized default if empty. Each item can override via item.model.
System PromptstringNoSystem instructions applied to all batch requests. Only applies to create operation. Supports expressions.
EndpointoptionsNo/v1/chat/completionsThe API endpoint for batch requests.
Options: /v1/chat/completions (batch chat completion requests), /v1/embeddings (batch embedding requests)

Check Status (check)

ParameterTypeRequiredDefaultDescription
Batch IDstringNoThe batch ID to check or cancel. Falls back to item.json.batchId if empty. Supports expressions.

Cancel Batch (cancel)

ParameterTypeRequiredDefaultDescription
Batch IDstringNoThe batch ID to check or cancel. Falls back to item.json.batchId if empty. Supports expressions.

All Operations

ParameterTypeRequiredDefaultDescription
OptionscollectionNo{}Optional batch and polling settings — add only the fields you need.
— Completion WindowstringNo24hTime window for batch completion. Currently only “24h” is supported by OpenAI.
— Poll Interval (ms)numberNo30000How often to poll for completion status in milliseconds.
— Max Poll Duration (ms)numberNo600000Maximum total time to spend polling for completion in milliseconds.
— Wait for CompletionbooleanNofalseIf true, poll until the batch completes (or fails/expires) before returning.
— Response Field NamestringNobatchField name in the output JSON where the batch result will be placed.
Include InputbooleanNofalseWhether to include the original input item fields in the output.
Max ConcurrencynumberNo5Maximum number of items to process concurrently (for check/cancel operations).

Output Data

The batch object lands on the field named by Response Field Name (batch by default), with the fields you normally branch on lifted to the top level. The rest of the input item JSON is dropped unless Include Input is on; binary data on the input item is forwarded unchanged.

Create Batch collapses every input item into one batch job, then emits one output item per input item, all carrying the same batch result:

{
  "batch": { "id": "batch_abc123", "status": "validating" },
  "batchId": "batch_abc123",
  "status": "validating",
  "inputFileId": "file-abc123",
  "requestCount": 1000
}

Check Status and Cancel Batch process items independently, one output item per input item:

{
  "batch": { "id": "batch_abc123", "status": "completed" },
  "batchId": "batch_abc123",
  "status": "completed",
  "outputFileId": "file-def456",
  "requestCounts": { "total": 1000, "completed": 1000, "failed": 0 }
}
OperationFields on the output item
createbatchId, status, inputFileId, requestCount — plus outputFileId once results exist. When no input item yielded a usable request, batchId is null and status is empty
checkbatchId, status — plus outputFileId and requestCounts when the API reports them
cancelbatchId, status — plus outputFileId and requestCounts when the API reports them
  • status follows the batch through its life: validating, in progress, completed, failed, expired or cancelled. With Wait for Completion on, the node returns only once it reaches a terminal state.
  • outputFileId points at the results file in your OpenAI account. Retrieve it there once the batch completes.

Reference the result downstream by expression, e.g. {{ $json.batchId }}.

Usage Examples

  • Submit 1000 prompts as a single OpenAI batch for cost savings
  • Check the status of a running OpenAI batch job
  • Cancel a pending OpenAI batch
  • Create a batch of embeddings requests
  • Submit batch with polling to wait for completion

Example Configuration

Submit every incoming item as one chat-completion batch and return immediately:

{
  "type": "openai_batch",
  "parameters": {
    "operation": "create",
    "systemPrompt": "Summarize the text in one sentence.",
    "endpoint": "/v1/chat/completions"
  }
}

Create an embedding batch and wait for it to finish:

{
  "type": "openai_batch",
  "parameters": {
    "operation": "create",
    "endpoint": "/v1/embeddings",
    "options": {
      "waitForCompletion": true,
      "pollIntervalMs": 60000,
      "maxPollDurationMs": 3600000
    }
  }
}

Check the status of a batch created earlier in the workflow:

{
  "type": "openai_batch",
  "parameters": {
    "operation": "check",
    "batchId": "{{ $json.batchId }}"
  }
}

Cancel a runaway batch:

{
  "type": "openai_batch",
  "parameters": {
    "operation": "cancel",
    "batchId": "{{ $json.batchId }}"
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

OpenAI Batch processes multiple chat completion or embedding requests asynchronously by bundling input items into a JSONL file and submitting them as a single batch job. Use it when handling large volumes of requests that do not require immediate responses, such as bulk content generation or dataset embedding runs. It outputs batch status and completed response data for each input item on the main channel, or routes failures to the error channel.

Frequently asked questions

When is batching the right choice?

When the volume is high and nobody is waiting for the answer. Results are asynchronous, so it is wrong for anything interactive but well suited to bulk generation and dataset embedding.

What request types can be batched?

Chat completions and embeddings, which covers the two highest-volume operations most pipelines need.

Do I build the JSONL file myself?

No — the node bundles the input items into the file and submits the job for you.

What comes back?

Batch status and, once complete, the response data for each input item, with failures routed to the Error output.

Build with the OpenAI Batch node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need OpenAI credentials first.

Open BusyBot

Last updated . Spotted something wrong? Tell us.