firecrawl-aisdk
Search the web and optionally scrape content from search results. Best for: Finding information across multiple websites when you don't know the exact URL. Supports search operators: site:, inurl:, intitle:, related:, etc. Example use cases: - Find the latest news about a topic - Search for specific information across multiple sources - Discover content related to a query
by firecrawl
Test firecrawl-aisdk (searchTool) with AI-powered execution
0/2000 characters
Install this tool and use it with the AI SDK
npm install firecrawl-aisdkpnpm add firecrawl-aisdkimport { searchTool } from 'firecrawl-aisdk';import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { searchTool } from 'firecrawl-aisdk';
const result = await generateText({
model: openai('gpt-4o'),
tools: { searchTool },
prompt: 'Your prompt here...',
});
console.log(result.text);Available configuration options
querystringThe search query. Supports operators like site:, inurl:, intitle:, etc.
limitintegerMaximum number of search results to return. Default: 5
sourcesarraySources to search: web, images, news
categoriesarrayFilter by categories: github (repositories), research (academic), pdf (PDFs)
tbsstringTime-based search: qdr:h (hour), qdr:d (day), qdr:w (week), qdr:m (month), qdr:y (year)
locationstringLocation for search results (e.g., "San Francisco,California,United States")
countrystringISO country code for geo-targeting (e.g., "US", "DE"). Default: "US"
timeoutnumberTimeout in milliseconds. Default: 60000
ignoreInvalidURLsbooleanExclude invalid URLs from results. Default: false
scrapeOptionsobjectOptions for scraping the search results
Schema extracted: 12/29/2025, 3:52:27 AM
Firecrawl tools for Vercel AI SDK v5. Web scraping, search, crawling, and data extraction for AI applications.
npm install firecrawl-aisdk ai @ai-sdk/openai
Set environment variables:
FIRECRAWL_API_KEY=fc-your-key OPENAI_API_KEY=sk-your-key
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { scrapeTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Scrape https://firecrawl.dev and summarize what it does', tools: { scrape: scrapeTool }, });
import { scrapeTool, // Scrape single URL searchTool, // Search the web mapTool, // Discover URLs on a site crawlTool, // Crawl multiple pages batchScrapeTool, // Scrape multiple URLs extractTool, // Extract structured data pollTool, // Poll async jobs statusTool, // Check job status cancelTool, // Cancel jobs } from 'firecrawl-aisdk';
Scrape
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { scrapeTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Scrape https://firecrawl.dev and summarize what it does', tools: { scrape: scrapeTool }, }); console.log(text);
Search
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { searchTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Search for Firecrawl and summarize what you find', tools: { search: searchTool }, }); console.log(text);
Map
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { mapTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Map https://docs.firecrawl.dev and list the main sections', tools: { map: mapTool }, }); console.log(text);
Crawl (async - requires polling)
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { crawlTool, pollTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Crawl https://docs.firecrawl.dev (limit 3 pages) and summarize', tools: { crawl: crawlTool, poll: pollTool }, }); console.log(text);
Batch (async - requires polling)
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { batchScrapeTool, pollTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Scrape https://firecrawl.dev and https://docs.firecrawl.dev, then compare', tools: { batchScrape: batchScrapeTool, poll: pollTool }, }); console.log(text);
Extract (async - requires polling)
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { extractTool, pollTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Extract the main features from https://firecrawl.dev', tools: { extract: extractTool, poll: pollTool }, }); console.log(text);
Search + Scrape
import { generateText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { searchTool, scrapeTool } from 'firecrawl-aisdk'; const { text } = await generateText({ model: openai('gpt-5-mini'), prompt: 'Search for Firecrawl, scrape the top result, and explain what it does', tools: { search: searchTool, scrape: scrapeTool }, }); console.log(text);
Stream
import { streamText } from 'ai'; import { openai } from '@ai-sdk/openai'; import { scrapeTool } from 'firecrawl-aisdk'; const result = streamText({ model: openai('gpt-5-mini'), prompt: 'Scrape https://firecrawl.dev and explain what it does', tools: { scrape: scrapeTool }, }); for await (const chunk of result.textStream) { process.stdout.write(chunk); }
Run tests:
pnpm test # Run all tests pnpm test:watch # Watch mode
MIT
Downloads/month
2,435
GitHub Stars
0
Quality Score