Tutorial

How to Replace Semrush API Credit Drain with a Lightweight Alternative

Cut SERP data costs by 90%+ by switching from Semrush API units to a lightweight search API. Side-by-side migration guide with Python examples.

Semrush API access requires a Business plan at $499.95+/month, and each API call consumes units that expire monthly. For teams that only need organic SERP data -- rankings, snippets, People Also Ask -- this is a significant overspend. The Scavio API returns the same structured SERP data at $0.005 per query with no minimum commitment beyond the free 250 credits/month. This tutorial shows how to migrate your existing Semrush API calls to a lightweight alternative, with a cost comparison and a drop-in replacement function.

Prerequisites

  • Python 3.9+ installed
  • requests library installed
  • Current Semrush API integration to migrate
  • A Scavio API key from scavio.dev

Walkthrough

Step 1: Audit your current Semrush API usage

Before migrating, identify which Semrush endpoints you actually use. Most teams only use organic SERP data, keyword overview, and domain analytics. This step helps you know what needs replacing.

Python
# Common Semrush API endpoints and their replacements:
endpoint_map = {
    'domain_organic': 'Replace with SERP query for site:domain.com',
    'phrase_organic': 'Replace with direct SERP query',
    'keyword_difficulty': 'Not available via SERP API (keep Semrush for this)',
    'backlinks_overview': 'Not available via SERP API (keep Semrush for this)',
    'url_organic': 'Replace with SERP query for exact URL',
}

for endpoint, action in endpoint_map.items():
    print(f'{endpoint}: {action}')

Step 2: Build the drop-in replacement function

Create a function with the same interface as your Semrush organic search call. It accepts a keyword and returns structured results in a normalized format.

Python
import requests, os

API_KEY = os.environ['SCAVIO_API_KEY']

def serp_search(keyword: str, country: str = 'us', num_results: int = 10) -> list:
    """Drop-in replacement for Semrush phrase_organic endpoint."""
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': keyword, 'country_code': country})
    resp.raise_for_status()
    results = resp.json().get('organic_results', [])[:num_results]
    return [{
        'position': r['position'],
        'url': r['link'],
        'title': r['title'],
        'snippet': r.get('snippet', ''),
    } for r in results]

Step 3: Compare output format side by side

Verify the replacement function returns equivalent data. The key fields -- position, URL, title, snippet -- map directly.

Python
results = serp_search('best project management software 2026')
for r in results[:3]:
    print(f"#{r['position']} {r['title']}")
    print(f"  {r['url']}")
    print(f"  {r['snippet'][:80]}...")
    print()

Step 4: Calculate your cost savings

Compare monthly costs between Semrush API and the lightweight alternative. Factor in the Semrush Business plan base cost plus per-unit charges.

Python
def compare_costs(monthly_queries: int) -> dict:
    semrush_base = 499.95  # Business plan minimum
    semrush_unit_cost = 0.01  # approximate per API unit
    semrush_total = semrush_base + (monthly_queries * semrush_unit_cost)
    scavio_cost = monthly_queries * 0.005
    savings = semrush_total - scavio_cost
    savings_pct = (savings / semrush_total) * 100
    return {
        'queries': monthly_queries,
        'semrush_monthly': f'${semrush_total:,.2f}',
        'scavio_monthly': f'${scavio_cost:,.2f}',
        'savings': f'${savings:,.2f}',
        'savings_pct': f'{savings_pct:.0f}%'
    }

for vol in [5000, 20000, 50000]:
    c = compare_costs(vol)
    print(f"{c['queries']:,} queries: Semrush {c['semrush_monthly']} vs Scavio {c['scavio_monthly']} (save {c['savings']}, {c['savings_pct']})")

Step 5: Migrate your existing codebase

Find-and-replace your Semrush API calls with the new function. Keep Semrush for features that require their proprietary database (keyword difficulty, backlink index). Use the lightweight API for all SERP data fetching.

Python
# Before (Semrush):
# from semrush_client import SemrushClient
# client = SemrushClient(api_key=SEMRUSH_KEY)
# results = client.phrase_organic(keyword='best crm', database='us')

# After (lightweight API):
results = serp_search('best crm', country='us')

# The rest of your pipeline stays the same:
for r in results:
    print(f"#{r['position']} {r['url']}")

Python Example

Python
import os, requests

API_KEY = os.environ['SCAVIO_API_KEY']

def serp_search(keyword: str, country: str = 'us') -> list:
    resp = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY, 'Content-Type': 'application/json'},
        json={'query': keyword, 'country_code': country})
    resp.raise_for_status()
    return [{'position': r['position'], 'url': r['link'],
             'title': r['title'], 'snippet': r.get('snippet', '')}
            for r in resp.json().get('organic_results', [])]

def main():
    keywords = ['best crm software', 'crm pricing 2026', 'hubspot alternatives']
    for kw in keywords:
        results = serp_search(kw)
        print(f'{kw}: {len(results)} results')
        if results:
            print(f'  #1: {results[0]["title"]}')
    monthly = len(keywords) * 30
    print(f'Projected monthly cost: ${monthly * 0.005:.2f} vs $499.95+ Semrush')

if __name__ == '__main__':
    main()

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;

async function serpSearch(keyword, country = 'us') {
  const resp = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query: keyword, country_code: country })
  });
  const data = await resp.json();
  return (data.organic_results || []).map(r => ({
    position: r.position, url: r.link,
    title: r.title, snippet: r.snippet || ''
  }));
}

async function main() {
  const keywords = ['best crm software', 'crm pricing 2026', 'hubspot alternatives'];
  for (const kw of keywords) {
    const results = await serpSearch(kw);
    console.log(`${kw}: ${results.length} results`);
    if (results.length) console.log(`  #1: ${results[0].title}`);
  }
  console.log(`Projected: $${(keywords.length * 30 * 0.005).toFixed(2)}/mo vs $499.95+ Semrush`);
}

main().catch(console.error);

Expected Output

JSON
best crm software: 10 results
  #1: Best CRM Software for 2026 - Forbes Advisor
crm pricing 2026: 10 results
  #1: CRM Pricing Comparison Guide (Updated May 2026)
hubspot alternatives: 10 results
  #1: 12 HubSpot Alternatives Worth Considering
Projected monthly cost: $0.45 vs $499.95+ Semrush

5,000 queries: Semrush $549.95 vs Scavio $25.00 (save $524.95, 95%)
20,000 queries: Semrush $699.95 vs Scavio $100.00 (save $599.95, 86%)
50,000 queries: Semrush $999.95 vs Scavio $250.00 (save $749.95, 75%)

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.9+ installed. requests library installed. Current Semrush API integration to migrate. A Scavio API key from scavio.dev. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Cut SERP data costs by 90%+ by switching from Semrush API units to a lightweight search API. Side-by-side migration guide with Python examples.