The Problem
AI agents burn through search credits unpredictably. A research agent might run 500 searches in a session while a simple Q&A agent uses 5. Teams set blanket budgets that either starve research agents or waste money on cheap queries. No routing logic exists to match query complexity to provider cost.
The Scavio Solution
Implement a cost-aware routing layer. Simple factual queries use Scavio at $0.005/credit. Complex multi-step research uses Tavily Researcher at $0.03/query. The router classifies query intent and routes to the cheapest provider that can handle it. Most agent queries are simple lookups that Scavio handles at 6x lower cost than Tavily.
Before
All agent queries go to Tavily at $0.03/query. Monthly bill: $900 for 30K queries. 80% of queries are simple lookups that could be served cheaper.
After
Router sends 80% of queries to Scavio at $0.005. 20% complex queries to Tavily at $0.03. Monthly bill: $300. Same result quality. $600/month saved.
Who It Is For
Teams running AI agents with variable search volume who want to minimize search API costs without sacrificing result quality.
Key Benefits
- 60-70% cost reduction on search spend
- Automatic routing based on query complexity
- Simple queries at $0.005 via Scavio
- Complex research queries routed to appropriate provider
- Budget tracking and alerting built in
Python Example
import requests, os
SCAVIO_KEY = os.environ["SCAVIO_API_KEY"]
def classify_query(query: str) -> str:
"""Classify query complexity: simple or complex."""
complex_signals = ["compare", "analyze", "research", "step by step", "in depth"]
if any(s in query.lower() for s in complex_signals):
return "complex"
return "simple"
def scavio_search(query: str) -> dict:
"""$0.005/credit search for simple queries."""
resp = requests.post(
"https://api.scavio.dev/api/v1/search",
headers={"x-api-key": SCAVIO_KEY, "Content-Type": "application/json"},
json={"query": query, "country_code": "us"},
timeout=10,
)
return {"provider": "scavio", "cost": 0.005, "data": resp.json()}
def route_search(query: str) -> dict:
"""Route to cheapest provider that can handle the query."""
complexity = classify_query(query)
if complexity == "simple":
return scavio_search(query)
# For complex queries, still try Scavio first
result = scavio_search(query)
if len(result["data"].get("organic_results", [])) >= 5:
return result
# Only escalate if Scavio returns thin results
return scavio_search(query) # Replace with expensive provider if needed
result = route_search("what is kubernetes")
print(f"Provider: {result['provider']}, Cost: ${result['cost']}, Results: {len(result['data'].get('organic_results', []))}")JavaScript Example
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
function classifyQuery(query) {
const complex = ['compare','analyze','research','step by step','in depth'];
return complex.some(s=>query.toLowerCase().includes(s)) ? 'complex' : 'simple';
}
async function scavioSearch(query) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {method:'POST', headers:H, body:JSON.stringify({query, country_code:'us'})});
return {provider:'scavio', cost:0.005, data:await r.json()};
}
async function routeSearch(query) {
const complexity = classifyQuery(query);
if (complexity === 'simple') return scavioSearch(query);
const result = await scavioSearch(query);
if ((result.data.organic_results||[]).length >= 5) return result;
return result;
}
const r = await routeSearch('what is kubernetes');
console.log('Provider: '+r.provider+', Cost: $'+r.cost+', Results: '+(r.data.organic_results||[]).length);Platforms Used
Web search with knowledge graph, PAA, and AI overviews
YouTube
Video search with transcripts and metadata
Community, posts & threaded comments from any subreddit