Batch process prompts with Anthropic Claude API
Ready for 3.0What this workflow does
This AI workflow has 27 nodes and runs when another workflow calls it (plus 1 other trigger). It uses only n8n's built-in nodes. It also calls api.anthropic.com over HTTP.
How it runs
Trigger: When another workflow calls it (plus 1 other trigger).
- Submit batch (HTTP Request): calls api.anthropic.com (POST)
- One query example (Edit Fields (Set)): sets 1 field: query
- Truncate Chat Memory (Chat Memory Manager): uses Chat Memory Manager, with memory: Simple Memory
- If: checks a condition and branches into true / false
- Append execution data for single query example (Edit Fields (Set)): sets 3 fields: custom_id, model, max_tokens
- Fill Chat Memory with example data (Chat Memory Manager): uses Chat Memory Manager, with memory: Simple Memory
- Get results (HTTP Request): calls an HTTP API
- Batch Status Poll Interval (Wait): waits 10 seconds
- Build batch 'request' object for single query (Code): runs custom JavaScript code
- Load Chat Memory Data (Chat Memory Manager): uses Chat Memory Manager, with memory: Simple Memory
…plus 14 more steps. See the full node list below.
HTTP calls to: api.anthropic.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (15)
- HTTP Request
n8n-nodes-base.httpRequest - Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Wait
n8n-nodes-base.wait - Manual Trigger
n8n-nodes-base.manualTrigger - Edit Fields (Set)
n8n-nodes-base.set - Aggregate
n8n-nodes-base.aggregate - Execute Sub-workflow
n8n-nodes-base.executeWorkflow - Simple Memory
@n8n/n8n-nodes-langchain.memoryBufferWindow - Chat Memory Manager
@n8n/n8n-nodes-langchain.memoryManager - Execution Data
n8n-nodes-base.executionData - Split Out
n8n-nodes-base.splitOut - Filter
n8n-nodes-base.filter - Merge
n8n-nodes-base.merge
From the author
This workflow template provides a robust solution for efficiently sending multiple prompts to Anthropic's Claude models in a single batch request and retrieving the results. It leverages the Anthropic Batch API endpoint (/v1/messages/batches) for optimized…