Skip to content

Firecrawl + Google Gemini

Updated Feb 2026

Integrate Firecrawl with Google's Gemini for AI applications powered by web data. Scrape, analyze, and extract structured information using Gemini models.

Source: docs.firecrawl.dev/developer-guides/llm-sdks-and-frameworks/gemini

Installation

bash
npm install @mendable/firecrawl-js @google/genai

Create a .env file:

env
FIRECRAWL_API_KEY=your_firecrawl_key
GEMINI_API_KEY=your_gemini_key

Node < 20

If using Node < 20, install dotenv and add import 'dotenv/config' to your code.

Scrape + Summarize

Scrape a website and summarize the content using Gemini.

js
import FirecrawlApp from '@mendable/firecrawl-js';
import { GoogleGenAI } from '@google/genai';

const firecrawl = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const scrapeResult = await firecrawl.scrape('https://firecrawl.dev', {
    formats: ['markdown']
});

console.log('Scraped content length:', scrapeResult.markdown?.length);

const response = await ai.models.generateContent({
    model: 'gemini-2.5-flash',
    contents: `Summarize: ${scrapeResult.markdown}`,
});

console.log('Summary:', response.text);

Content Analysis

Use Gemini's multi-turn conversation capabilities to analyze website content interactively.

js
import FirecrawlApp from '@mendable/firecrawl-js';
import { GoogleGenAI } from '@google/genai';

const firecrawl = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const scrapeResult = await firecrawl.scrape('https://news.ycombinator.com/', {
    formats: ['markdown']
});

const chat = ai.chats.create({
    model: 'gemini-2.5-flash'
});

// Ask for the top 3 stories
const result1 = await chat.sendMessage({
    message: `Based on this content from Hacker News, what are the top 3 stories?\n\n${scrapeResult.markdown}`
});
console.log('Top 3 Stories:', result1.text);

// Follow-up question in the same conversation
const result2 = await chat.sendMessage({
    message: `Now, what are the 4th and 5th top stories from the same content?`
});
console.log('4th and 5th Stories:', result2.text);

Structured Extraction

Extract structured data using Gemini's JSON mode from scraped website content.

js
import FirecrawlApp from '@mendable/firecrawl-js';
import { GoogleGenAI, Type } from '@google/genai';

const firecrawl = new FirecrawlApp({ apiKey: process.env.FIRECRAWL_API_KEY });
const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });

const scrapeResult = await firecrawl.scrape('https://stripe.com', {
    formats: ['markdown']
});

const response = await ai.models.generateContent({
    model: 'gemini-2.5-flash',
    contents: `Extract company information: ${scrapeResult.markdown}`,
    config: {
        responseMimeType: 'application/json',
        responseSchema: {
            type: Type.OBJECT,
            properties: {
                name: { type: Type.STRING },
                industry: { type: Type.STRING },
                description: { type: Type.STRING },
                products: {
                    type: Type.ARRAY,
                    items: { type: Type.STRING }
                }
            },
            propertyOrdering: ['name', 'industry', 'description', 'products']
        }
    }
});

console.log('Extracted company info:', response?.text);

Further Reading