Skip to main content
New to Exa? Try the Coding Agent Quickstart to get started in under a minute.
Use the @exalabs/ai-sdk package to add Exa web search to applications built with the AI SDK by Vercel. You provide an Exa API key, and the webSearch() tool handles search requests for your model.

Install

install.sh

Quick start

quickstart.ts
Create an Exa API key and set it as EXA_API_KEY before you run the example. The package reads this environment variable automatically.

Defaults

webSearch() uses these defaults:
  • type: auto
  • numResults: 10
  • contents.text: 3000 characters per result
  • maxAgeHours: the default cache fallback; set this option when you need stricter freshness
Use the options below to tune search and content extraction:
configuration.ts

Search options

Content options

TypeScript support

The package includes TypeScript types:
types.ts

Use Vercel AI Gateway

Use Exa web search without an Exa API key through Vercel’s AI Gateway.

Explore the AI SDK package

View the source code and package details on GitHub.
You can also find the package on npm and read the Vercel AI SDK web search guide.
Last modified on July 30, 2026