n8n

How to Automate Anthropic Batch Content Generation?

Send many prompts to one AI in a single run and get all results back in a clean list. Great for content teams, research groups, and operations that need fast, repeatable output with clear tracking by custom id.

The flow can start from another workflow or by running a sample path. It builds a requests array, sets the required anthropic version header, and posts the batch to the Anthropic messages batches endpoint. A wait loop checks batch status until it ends. When finished, it downloads the results url, reads each line of JSONL, and turns it into structured items. Results are split and can be routed by custom id. Example paths show a single prompt build and a chat history build using simple memory nodes, so you can create batches from prior messages.

You need an Anthropic account and API key. Set the version value to 2023 06 01, pick your model, and adjust the poll interval to balance speed and cost. Expect faster turnaround for large sets and consistent mapping between inputs and outputs. Useful for bulk copy creation, batch Q and A, dataset tagging, and model evaluation runs. Setup is simple, and you can call it from any parent flow that passes an array of requests.

What are the key features?

  • Starts when called by another flow or from a manual test path
  • Posts a full requests array to the Anthropic messages batches endpoint
  • Uses a wait and check loop to poll status until processing ends
  • Downloads results from the provided results url when the batch is done
  • Parses JSONL lines into clean JSON objects with a code node
  • Splits results and filters by custom id so teams can route answers by job
  • Sets the required anthropic version header from a single source of truth
  • Includes example builders for a single prompt and for chat history using simple memory nodes

What are the benefits?

  • Reduce manual work from 3 hours to 10 minutes for 100 prompts
  • Handle up to 10 times more requests in one run
  • Improve result tracking to near 100 percent by using custom id on every item
  • Shorten turnaround time by about 70 percent for large batches
  • Cut API overhead by sending one batch request instead of many single calls

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Anthropic. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create a new Anthropic credential. Choose API Key, name the credential clearly, and paste your API key from your Anthropic account API page.
  4. Open the Submit batch, Check batch status, and Get results nodes. In each, select your Anthropic credential in the Credential to connect with field.
  5. Open the Set desired anthropic version node and set the value to 2023 06 01 or your preferred supported version.
  6. In the One query example and Build batch request for single query nodes, edit the prompt text, custom id, model, and max tokens to match your use case.
  7. For the chat history path, use the Simple Memory Store and Fill Chat Memory nodes to load message examples. Keep Truncate Chat Memory before fill to avoid old data.
  8. Check the Construct requests array or Join two example requests into array node to confirm both request objects are included and fields match the API.
  9. Run the workflow on the Run example trigger. Watch the If ended processing and Batch Status Poll Interval nodes. Adjust the wait time to control how often status is checked.
  10. Verify outputs at Split Out Parsed Results and the filter nodes. Each item should include custom id, message content, and usage data.
  11. To use this in your own system, add an Execute Workflow node in a parent flow, pass anthropic version and the requests array as inputs, and capture the returned results array.
  12. Troubleshoot common issues: if you get 401, recheck the API key and the anthropic version header. If parsing fails, confirm the results url returns JSONL text. If status does not end, increase the poll interval and review batch state in your Anthropic account.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Anthropic

Sign up

Pay-as-you-go: Claude 3 Haiku at $0.25 per 1M input tokens and $1.25 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.