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 — a cost-effective Tavily and SerpAPI alternative, with one package, one API key, and no custom HTTP code.
Drop-in tools for any AI SDK agent
scavioTools() into generateText or streamText and your model can search seven platforms — a cost-effective Tavily and SerpAPI alternative with typed Zod schemas.Introduction
@scavio/ai-sdk exposes each Scavio endpoint as a standard AI SDK tool() with a typed Zod input schema. Pass scavioTools() for the full set, or import individual factories to expose a lean tool list to the model. You need Node.js 18 or later and a Scavio API key from dashboard.scavio.dev.
The scavio JS SDK is bundled and called under the hood — it handles auth, rate limiting, and request formatting, and returns each result to the model as the raw Scavio JSON response.
Step-by-Step Integration Guide
Step 1: Install
npm install @scavio/ai-sdk ai zodai and zod are peer dependencies; the scavio JS SDK is bundled and called under the hood. Requires Node.js 18 or later.
Step 2: Set your API key
Get a key at dashboard.scavio.dev (free credits, no card), then set it as an environment variable:
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_..." }).
Step 3: Basic usage
import { generateText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";
import { scavioTools } from "@scavio/ai-sdk";
const { text } = await generateText({
model: openai("gpt-5.5"),
tools: scavioTools(),
stopWhen: stepCountIs(3),
prompt: "Find the official GitHub repo of the Agno framework and summarize it",
});
console.log(text);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 |
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-5.5"),
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.
Advanced Example
Stream a multi-step research run: the model chains web and Reddit searches on its own, then narrates its findings token by token.
import { streamText, stepCountIs } from "ai";
import { openai } from "@ai-sdk/openai";
import { scavioTools } from "@scavio/ai-sdk";
const result = streamText({
model: openai("gpt-5.5"),
tools: scavioTools(),
stopWhen: stepCountIs(5),
system: "You are a research assistant. Use Scavio for fresh web data and cite sources.",
prompt: "Research Tavily alternatives: check the web, then see what developers on Reddit say.",
});
for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}The agent picks scavio_search and scavio_reddit_search as it goes, up to the stepCountIs(5) budget — you never wire up that routing yourself.
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, including every Google search. Instagram is priced per endpoint: 10 credits for most calls, 8 for post details and comment replies, and 2 for user posts. See the rate limits reference for plan limits and the errors reference for retry guidance.
Benefits of Scavio + Vercel AI SDK
- Drop-in tools: spread
scavioTools()intogenerateTextorstreamTextand go. - Typed Zod schemas: accurate argument hints for the model and validated calls before they run.
- Seven platforms, one key: Google, YouTube, Reddit, Amazon, Walmart, TikTok, and Instagram behind a single API key.
- Cost-effective: most calls cost a single credit — a Tavily and SerpAPI alternative with broader platform coverage.
Next Steps
- Scavio API quickstart — keys, credits, and your first request
- Google Search API reference — the endpoint behind
scavio_search - MCP Integration — every Scavio endpoint as a tool
- @scavio/ai-sdk on npm
- Vercel AI SDK documentation
- scavio JS SDK on npm