serpapi-cost-tuning

Featured

Optimize SerpApi costs by reducing credit consumption and choosing the right plan. Use when analyzing search usage, reducing monthly costs, or implementing credit-saving strategies. Trigger: "serpapi cost", "serpapi pricing", "reduce serpapi costs", "serpapi credits".

AI & Automation 2,940 stars 439 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# SerpApi Cost Tuning ## Overview SerpApi charges per search (1 credit each). Plans: Free (100/mo), Developer ($75, 5K/mo), Business ($200, 15K/mo), Enterprise (custom). Key savings: caching, archive retrieval (free), and Google Light API. ## Cost Strategies ### Strategy 1: Aggressive Caching (Biggest Savings) ```python # Search results rarely change within an hour # Cache for 1 hour = up to 24x credit reduction for hourly queries # Cache for 1 day = up to 720x for queries checked every 2 minutes import hashlib, json, redis, serpapi, os r = redis.Redis.from_url(os.environ["REDIS_URL"]) client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"]) def cached_search(ttl_seconds=3600, **params): key = f"serpapi:{hashlib.md5(json.dumps(params, sort_keys=True).encode()).hexdigest()}" cached = r.get(key) if cached: return json.loads(cached) # FREE: no credit consumed result = client.search(**params) # 1 credit r.setex(key, ttl_seconds, json.dumps(dict(result))) return result ``` ### Strategy 2: Archive API (Free Retrieval) ```python # Every search result is stored in the archive # Retrieve by search_id at no cost archived = client.search(engine="google", search_id="previous_id") # 0 credits -- use for re-processing or delayed access ``` ### Strategy 3: Google Light API (Same Cost, Faster) ```python # Same 1 credit but faster response (~1s vs 3-5s) # Good for: organic results only, no knowledge graph needed result = client.search(engin...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category