Exa is a web search API that adds web search capabilities to your LLMs. Exa can search the web for code docs, current information, news, articles, and a lot more. Exa performs real-time web searches and can get page content from specific URLs. Add Exa web search tool to your LLMs in just a few lines of code.
pnpm install @exalabs/ai-sdk# Add to your .env fileEXA_API_KEY=your_api_key_hereimport { generateText, gateway, stepCountIs } from 'ai';import { webSearch } from '@exalabs/ai-sdk';
const { text } = await generateText({ model: gateway('google/gemini-3-pro-preview'), prompt: 'Tell me the latest developments in AI', tools: { webSearch: webSearch(), }, stopWhen: stepCountIs(3),});
console.log(text);