Skip to main content
AI SDK tools for Valyu search API, built for Vercel AI SDK v5.
Best for: building Valyu into your product / agents. Wire Valyu search tools into a Vercel AI SDK app.

Paste into your AI assistant to wire Valyu tools into a Vercel AI SDK project.

Open in Cursor
Want to try without writing any code? Test our search tools and see results in our AI SDK Playground.
1

Installation

Installation

Install the Valyu AI SDK package:
Get your free API key from Valyu Platform - $10 free credits ($20 with a work email) when you sign up!Add it to your .env file:
The package reads it automatically.
2

Quick Start

Quick Start

Get started with web search in seconds:
Your AI agent now has access to real-time web search.
3

Available Search Tools

Available search tools

Each tool is called the same way - tools: { name: toolName() }. Route each query to the most specific tool:Discovery tools (datasources, datasourcesCategories) let an agent list the available sources and categories before searching.
companyResearch auto-detects whether a company is public or private and pulls from filings, financials, news, and funding accordingly. It supports section filtering (summary, leadership, products, funding, competitors, filings, financials, news, insiders).
4

Combine multiple tools

Combine multiple tools

Register several tools so the agent chooses per query:
For streaming, swap generateText for streamText and iterate result.textStream.
5

Configuration and best practices

Configuration and best practices

Lower maxPrice/maxNumResults and raise relevanceThreshold to control cost. Valyu prices on CPM (cost per thousand retrievals).
Guide the model to route to the right tool, cite sources as Markdown links [Title](URL), combine tools for complex topics, and use natural-language queries (not operators). See the Prompting Guide.
Call the Search API directly with the AI SDK tool() helper:
Full types ship with the package: ValyuBaseConfig, ValyuWebSearchConfig, and per-tool config types (ValyuFinanceSearchConfig, ValyuPaperSearchConfig, etc.), plus ValyuSearchResult and ValyuApiResponse.

Next Steps