Skip to main content

Process multiple prompts in parallel with Azure OpenAI Batch API

Workflow preview

Workflow preview
100%
Process multiple prompts in parallel with Azure OpenAI Batch API preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Process Multiple Prompts in Parallel with Azure OpenAI Batch API Who is this for? This workflow is designed for developers and data scientists who want to efficiently send multiple prompts to the A...

Best for

  • Engineering automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.stickynote, n8n-nodes-base.wait, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.aggregate

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Greg Evseev.

Original n8n.io source

1.1 Workflow description

Title
Process multiple prompts in parallel with Azure OpenAI Batch API
Workflow name
Process multiple prompts in parallel with Azure OpenAI Batch API

Process Multiple Prompts in Parallel with Azure OpenAI Batch API

Who is this for?

This workflow is designed for developers and data scientists who want to efficiently send multiple prompts to the Azure OpenAI Batch API and retrieve responses in a single batch process. It is particularly useful for applications that require processing large volumes of text data, such as chatbots, content generation, or data analysis.

What problem is this workflow solving?

Sending multiple prompts to the Azure OpenAI API can be time-consuming and inefficient if done sequentially. This workflow automates the process of batching requests, allowing users to submit multiple prompts at once and retrieve the results in a streamlined manner. This not only saves time but also optimizes resource usage.

What this workflow does

This workflow:

  1. Accepts an array of requests, each containing a prompt and associated parameters.
  2. Converts the requests into a JSONL format suitable for batch processing.
  3. Uploads the batch file to the Azure OpenAI API.
  4. Creates a batch job to process the prompts.
  5. Polls for the job status and retrieves the output once processing is complete.
  6. Parses the output and returns the results.

Key Features of Azure OpenAI Batch API

The Azure OpenAI Batch API is designed to handle large-scale and high-volume processing tasks efficiently. Key features include:

  • Asynchronous Processing: Handle groups of requests with separate quotas, targeting a 24-hour turnaround at 50% less cost than global standards.
  • Batch Requests: Send a large number of requests in a single file, avoiding disruption to online workloads.

Key Use Cases

  • Large-Scale Data Processing: Quickly analyze extensive datasets in parallel.
  • Content Generation: Create large volumes of text, such as product descriptions or articles.
  • Document Review and Summarization: Automate the review and summarization of lengthy documents.
  • Customer Support Automation: Handle numerous queries simultaneously for faster responses.
  • Data Extraction and Analysis: Extract and analyze information from vast amounts of unstructured data.
  • Natural Language Processing (NLP) Tasks: Perform tasks like sentiment analysis or translation on large datasets.
  • Marketing and Personalization: Generate personalized content and recommendations at scale.

Setup

  1. Azure OpenAI Credentials: Ensure you have your Azure OpenAI API credentials set up in n8n.
  2. Configure the Workflow:
    • Set the az_openai_endpoint in the "Setup defaults" node to your Azure OpenAI endpoint.
    • Adjust the api-version in the "Set desired 'api-version'" node if necessary.
  3. Run the Workflow: Trigger the workflow using the "Run example" node to see it in action.

How to customize this workflow to your needs

  • Modify Prompts: Change the prompts in the "One query example" node to suit your application.
  • Adjust Parameters: Update the parameters in the requests to customize the behavior of the OpenAI model.
  • Add More Requests: You can add more requests in the input array to process additional prompts.

Example Input

[
  {
    "api-version": "2025-03-01-preview",
    "requests": [
      {
        "custom_id": "first-prompt-in-my-batch",
        "params": {
          "messages": [
            {
              "content": "Hey ChatGPT, tell me a short fun fact about cats!",
              "role": "user"
            }
          ]
        }
      },
      {
        "custom_id": "second-prompt-in-my-batch",
        "params": {
          "messages": [
            {
              "content": "Hey ChatGPT, tell me a short fun fact about bees!",
              "role": "user"
            }
          ]
        }
      }
    ]
  }
]

Example Output

[
  {
    "custom_id": "first-prompt-in-my-batch",
    "response": {
      "body": {
        "choices": [
          {
            "message": {
              "content": "Did you know that cats can make over 100 different sounds?"
            }
          }
        ]
      }
    }
  },
  {
    "custom_id": "second-prompt-in-my-batch",
    "response": {
      "body": {
        "choices": [
          {
            "message": {
              "content": "Bees communicate through a unique dance called the 'waggle dance'."
            }
          }
        ]
      }
    }
  }
]

Additional Notes

  • Job Management: You can cancel a job at any time, and any remaining work will be canceled while already completed work is returned. You will be charged for any completed work.
  • Data Residency: Data stored at rest remains in the designated Azure geography, while data may be processed for inferencing in any Azure OpenAI location.
  • Exponential Backoff: If your batch jobs are large and hitting the enqueued token limit, certain regions support queuing multiple batch jobs with exponential backoff.

This template provides a comprehensive solution for efficiently processing multiple prompts using the Azure OpenAI Batch API, making it a valuable tool for developers and data scientists alike.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - When Executed by Another Workflow

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 2 - Parse response

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 3 - If ended processing

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Batch Status Poll Interval

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 7 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Run example

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 9 - One query example

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 10 - Delete original properties

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 11 - Construct 'requests' array

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 12 - Build batch 'request' object for single query

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Simple Memory Store

Type / Role
@n8n/n8n-nodes-langchain.memoryBufferWindow - memoryBufferWindow
Config choices
Version 1.3

Block 14 - Fill Chat Memory with example data

Type / Role
@n8n/n8n-nodes-langchain.memoryManager - memoryManager
Config choices
Version 1.1

Block 15 - Build batch 'request' object from Chat Memory and execution data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - Load Chat Memory Data

Type / Role
@n8n/n8n-nodes-langchain.memoryManager - memoryManager
Config choices
Version 1.1

Block 17 - First Prompt Result

Type / Role
n8n-nodes-base.executionData - executionData
Config choices
Version 1

Block 18 - Second Prompt Result

Type / Role
n8n-nodes-base.executionData - executionData
Config choices
Version 1

Block 19 - Split Out Parsed Results

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 20 - Filter Second Prompt Results

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 21 - Filter First Prompt Results

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 22 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note7

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note8

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 53 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Process multiple prompts in parallel with Azure OpenAI Batch API
Complexity advanced
Nodes 53
Categories Engineering, Multimodal AI
Author Greg Evseev
Published 13 Apr 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3537/3537.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Process multiple prompts in parallel with Azure OpenAI Batch API do?

Process Multiple Prompts in Parallel with Azure OpenAI Batch API Who is this for? This workflow is designed for developers and data scientists who want to efficiently send multiple prompts to the A...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, Multimodal AI use case.