1
Get API Key & Install
Get API Key & Install
- Get your Valyu API Key: Head to Valyu Platform to grab your key (you get $10 free credits!).
- Store it as an environment variable:
VALYU_API_KEY="your_actual_api_key"
. - Install Packages:
2
The Valyu DeepSearch Tool (Copy & Paste)
The Valyu DeepSearch Tool
Here’s the complete tool definition for DeepSearch. This allows your Vercel AI app to call Valyu and retrieve real-time results.valyuDeepSearchTool
accepts a detailed query plus an optionalfastMode
flag.fastMode
defaults tofalse
—flip it on for lower latency when you can tolerate shallower recall.- It securely uses
VALYU_API_KEY
. - Returns a JSON string for the Vercel AI SDK.
3
Additional Tools (Contents API)
Transform URLs with the Contents API
Allow your users to provide context by providng links. The Contents API delivers cleaned markdown (or structured JSON) for a single URL and passes it to your agents.- DeepSearch: “Find me sources about…”
- Contents: “Here’s a URL, give me cleaned content and a summary.”
4
Plug Tools In & Configure
Plug Tools In
Add one or both tools to your Vercel AI SDK’sstreamText
or generateText
call:Basic Prompting
Instruct your LLM to use the appropriate tool:Important Notes
- API Key Security: Always use environment variables for
VALYU_API_KEY
. - Fast Mode Trade-off: Fast mode reduces latency and spend but may skip deeper sources—leave it
false
for comprehensive research.