migrationserpapitutorial

Migrating from SerpAPI to Scavio

How to migrate from SerpAPI to Scavio -- reducing costs by 5-10x while gaining YouTube transcripts and Amazon product data.

8 min read

SerpAPI has been a popular choice for structured Google search data, but its per-search pricing adds up fast and its multi-platform coverage requires separate endpoints with different response formats. Scavio provides a single unified API across Google, Amazon, YouTube, Walmart, and Reddit at a lower per-request cost. Here is how to migrate.

API Endpoint and Authentication

SerpAPI uses query parameters for both the search query and API key. Scavio uses a POST request with a JSON body and an API key header:

Python
# SerpAPI
response = requests.get(
    "https://serpapi.com/search",
    params={
        "api_key": "SERPAPI_KEY",
        "engine": "google",
        "q": "cloud hosting providers",
        "location": "United States"
    }
)

# Scavio equivalent
response = requests.post(
    "https://api.scavio.dev/api/v1/search",
    headers={"x-api-key": "YOUR_SCAVIO_KEY"},
    json={
        "platform": "google",
        "query": "cloud hosting providers",
        "country": "us"
    }
)

The engine parameter maps to platform. Theq parameter becomes query. Location is handled via country and language codes instead of free-text location strings.

Response Structure Changes

SerpAPI returns a flat JSON object with top-level keys likeorganic_results, knowledge_graph, andrelated_questions. Scavio nests everything under adata object:

Python
# SerpAPI response parsing
for result in serpapi_response["organic_results"]:
    print(result["title"], result["link"])

kg = serpapi_response.get("knowledge_graph", {})

# Scavio response parsing
for result in scavio_response["data"]["organic"]:
    print(result["title"], result["link"])

kg = scavio_response["data"].get("knowledgeGraph", {})

Field names are largely the same -- title andlink are identical. The main difference is the nesting under data and camelCase for compound field names (knowledgeGraph instead of knowledge_graph).

Reducing Costs

SerpAPI charges per search with pricing that scales based on the engine and features used. Google searches with location cost more than basic searches. Amazon and YouTube require separate subscription tiers.

Scavio uses a credit-based system where every platform costs the same. A light-mode search costs 1 credit, and a full-mode search with knowledge graph and extended data costs 2 credits. There is no premium for specific platforms or geographic targeting.

  • No per-platform pricing tiers -- Amazon, YouTube, and Reddit cost the same as Google
  • No extra charges for geographic targeting or language settings
  • Free tier includes 500 credits per month for testing and small projects
  • Credit costs decrease at higher volume tiers

Multi-Platform Consolidation

With SerpAPI, searching Amazon requires the amazon engine with a different parameter set, and YouTube requires theyoutube engine. Each has its own response format. Scavio uses the same endpoint and request structure for all platforms:

Python
# Search Google
google = search("google", "wireless headphones")

# Search Amazon -- same function, same response structure
amazon = search("amazon", "wireless headphones")

# Search YouTube
youtube = search("youtube", "wireless headphones review")

def search(platform, query):
    return requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"platform": platform, "query": query}
    ).json()

One function, one response parser, five platforms. This simplifies both your codebase and your agent's tool definitions.

Updating Agent Tool Definitions

If you are using SerpAPI as a tool in an AI agent, update the tool function to use Scavio's API. The tool signature can stay the same -- just change the HTTP call inside. If you use MCP-compatible AI clients like Claude or Cursor, you can connect Scavio's MCP server directly and skip the tool wrapper entirely. See the MCP docs for details.

Migration Checklist

  • Switch from GET to POST requests
  • Move API key from query parameter to x-api-key header
  • Replace engine with platform and q with query
  • Update response parsing to read from data.organic instead of organic_results
  • Replace knowledge_graph with data.knowledgeGraph
  • Remove platform-specific parsing code -- all platforms share the same response shape
  • Test with representative queries from each platform you use