PDF Data Extraction Comparison using Claude 3.5 and Gemini 2.0 - n8n Workflow

Use this powerful n8n workflow to extract complex data directly from PDF files using Anthropic Claude 3.5 Sonnet and Google Gemini 2.0 Flash simultaneously. A great n8n template for comparison.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • AI/ML Engineers: Seeking to benchmark performance, latency, and cost of different multimodal LLMs on complex document analysis tasks.

  • Automation Specialists: Needing a sophisticated n8n template to handle file operations and external API calls.

  • Data Processors: Required to extract structured information (like VAT numbers, invoice details, etc.) from numerous PDF documents automatically using an n8n workflow.

Overview

Extracting information from PDFs traditionally requires a complex, multi-step process involving OCR (Optical Character Recognition) before sending text to an LLM. This advanced n8n workflow bypasses that by leveraging the native PDF processing capabilities of modern models like Claude 3.5 Sonnet and Gemini 2.0 Flash.

This specific n8n template is designed for comparison: it downloads a specific PDF from Google Drive, defines a single extraction prompt, and sends the document simultaneously to both Anthropic and Google APIs. This allows users of this n8n workflow to quickly evaluate which service delivers the best results, latency, and cost efficiency for their specific data extraction needs. Every step, starting from the n8n trigger, is optimized for binary file handling and LLM communication.

How it Works

The operation of this n8n workflow begins with the 'When clicking 'Test workflow'' manual n8n trigger.


  1. Define Prompt: The first active n8n node, 'Define Prompt' (a Set node), establishes the exact instruction for the LLMs (e.g., 'Extract the VAT numbers for each country').

  2. Download File: The 'Google Drive' n8n node securely retrieves the target PDF file using a predefined file ID.

  3. Prepare Binary Data: The crucial 'Extract from File' n8n node takes the binary data from the Google Drive download and converts it into a base64 encoded string, stored in the data property. This base64 string is essential for both the Anthropic and Google APIs to process the document as a native PDF.

  4. Parallel LLM Calls: The prepared data is routed in parallel to two subsequent n8n nodes:

'Call Claude 3.5 Sonnet with PDF Capabilities' sends the base64 PDF and the defined prompt to the Anthropic API.
'Call Gemini 2.0 Flash with PDF Capabilities' sends the same data to the Google Gemini API.

This entire n8n workflow ensures a direct, efficient path from PDF acquisition to LLM extraction, providing comparative results instantly.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON and import it into your n8n instance via the 'Workflows' menu, selecting 'New' and then 'Import from JSON'.

  2. Google Drive Setup: Configure the 'Google Drive' n8n node. You will need a Google Drive credential and must update the File ID parameter to point to the specific PDF document you wish to analyze.

  3. API Credentials: Set up the required credentials for the LLM calls:

For the Claude n8n node, create an 'Anthropic Api' credential using your Claude API key.
For the Gemini n8n node, create a 'Google Gemini(PaLM) Api' credential using your Gemini API key.

  1. Customize Prompt: Review the 'Define Prompt' n8n node and adjust the extraction query ('Extract the VAT numbers...') to match your specific data requirements.

  2. Test the n8n template: Click the 'Test workflow' button on the manual n8n trigger to execute the flow and review the simultaneous outputs from both AI services.

Node Details

When clicking 'Test workflow' (Manual Trigger):
Function: Serves as the starting n8n trigger for manual execution. Perfect for testing and development of this n8n workflow.
Key Configuration: Standard manual trigger setup.
Define Prompt (Set n8n node):
Function: Defines the exact textual prompt ('Extract the VAT numbers for each country') that guides both LLMs during the extraction process.
Key Configuration: Creates a property named prompt.
Google Drive (n8n node):
Function: Downloads the specified PDF file from Google Drive using its unique File ID, providing binary data to the next step.
Key Configuration: Operation set to download; requires configuration of the googleDriveOAuth2Api credential.
Extract from File (n8n node):
Function: Converts the binary PDF file output from the previous n8n node into a base64 encoded string, a format required for multimodal API requests.
Key Configuration: Operation set to binaryToPropery.
Call Claude 3.5 Sonnet with PDF Capabilities (HTTP Request n8n node):
Function: Sends the base64 encoded PDF and the prompt to the Anthropic v1/messages endpoint for processing by Claude 3.5 Sonnet.
Key Configuration: Uses a complex JSON body containing the document type content array; configured with the anthropicApi credential. This is a crucial n8n node for advanced file interaction.
Call Gemini 2.0 Flash with PDF Capabilities (HTTP Request n8n node):
Function: Sends the base64 encoded PDF and the prompt to the Google Generative Language API, utilizing the gemini-2.0-flash-exp model for extraction.
Key Configuration: Uses a structured JSON body with inline_data for PDF handling; configured with the googlePalmApi credential.

Related n8n Workflows

Free

Nodes: 6 Nodes
Updated: December 26 2025
View all
Created by

We are a product studio that helps organizations leverage no-code and generative AI to automate internal processes and launch new digital products.

Featured*