Vercel AI SDK Integration
Scavio ships as a set of ready-made tools for the Vercel AI SDK. Import the tools from @scavio/ai-sdk and pass them to generateText or streamText to give any AI SDK agent real-time search across Google, YouTube, Reddit, Amazon, Walmart, TikTok, and Instagram — one package, one API key, no custom HTTP code.
Prerequisites
- Node.js 18 or later.
- A Scavio API key from dashboard.scavio.dev.
Install
npm install @scavio/ai-sdk aiai and zod are peer dependencies; the scavio JS SDK is bundled and called under the hood.
Set your API key
export SCAVIO_API_KEY=sk_live_your_keyEach tool factory reads SCAVIO_API_KEY from the environment. You can also pass it explicitly: scavioSearch({ apiKey: "sk_live_..." }).
Quickstart
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";
import { scavioTools } from "@scavio/ai-sdk";
const { text } = await generateText({
model: openai("gpt-4o-mini"),
tools: scavioTools(),
stopWhen: stepCountIs(3),
prompt: "Find the official GitHub repo of the Agno framework and summarize it",
});
console.log(text);Use a single tool
Every provider is also exported as its own factory, so you can expose a lean tool list to the model:
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";
import { scavioSearch, scavioAmazonSearch } from "@scavio/ai-sdk";
const { text } = await generateText({
model: openai("gpt-4o-mini"),
tools: {
scavio_search: scavioSearch({ maxResults: 5 }),
scavio_amazon_search: scavioAmazonSearch(),
},
stopWhen: stepCountIs(3),
prompt: "Compare prices for a mechanical keyboard on Amazon",
});Each factory accepts { apiKey?, maxResults?, ...ScavioConfig }. maxResults trims long results arrays before they reach the model (defaults to 10), keeping token usage down.
Available tools
scavioTools() returns every tool keyed by name, ready to spread into the tools option. Or import factories individually.
| Factory | Tool name | Provider |
|---|---|---|
scavioSearch | scavio_search | Google web search |
scavioYoutubeSearch | scavio_youtube_search | YouTube video search |
scavioRedditSearch | scavio_reddit_search | Reddit (2 credits) |
scavioAmazonSearch | scavio_amazon_search | Amazon products |
scavioWalmartSearch | scavio_walmart_search | Walmart products |
scavioTiktokSearch | scavio_tiktok_search | TikTok videos |
scavioInstagramSearch | scavio_instagram_search | Instagram users |
How it works
Each tool is a standard AI SDK tool() with a typed Zod input schema, so the model gets accurate argument hints and the SDK validates calls before they run. Calls go through the scavio JS SDK, which handles auth, rate limiting, and request formatting. Tool results are returned to the model as the raw Scavio JSON response.
Credit costs
Most calls cost 1 credit. Reddit costs 2 credits, and Google costs 2 when light_request=false. See the rate limits reference for plan limits and the errors reference for retry guidance.