/serpapi-pack:serpapi-cost-tuningfrom serpapi-pack
Reduces SerpApi credit consumption via caching strategies, free archive retrieval, and plan selection. Use when analyzing search usage or implementing cost-saving measures.
Ships in serpapi-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
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.
# 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
# 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
# Same 1 credit but faster response (~1s vs 3-5s)
# Good for: organic results only, no knowledge graph needed
result = client.search(engine="google_light", q="query")
# Default num=10 (10 results). If you only need top 3:
result = client.search(engine="google", q="query", num=3)
# Still 1 credit, but faster response
def estimate_monthly_cost(
daily_searches: int,
cache_hit_rate: float = 0.7, # 70% cache hits typical
) -> dict:
actual_api_calls = daily_searches * 30 * (1 - cache_hit_rate)
plans = [
("Free", 100, 0), ("Developer", 5000, 75),
("Business", 15000, 200), ("Enterprise", 50000, 500),
]
for name, limit, price in plans:
if actual_api_calls <= limit:
return {"plan": name, "price": f"${price}/mo",
"api_calls": int(actual_api_calls), "raw_searches": daily_searches * 30}
return {"plan": "Enterprise+", "price": "Custom", "api_calls": int(actual_api_calls)}
# Examples:
# 100 searches/day, 70% cache = 900 API calls/mo = Developer ($75)
# 500 searches/day, 80% cache = 3000 API calls/mo = Developer ($75)
# 1000 searches/day, 50% cache = 15000 API calls/mo = Business ($200)
# Daily credit check
curl -s "https://serpapi.com/account.json?api_key=$SERPAPI_API_KEY" | jq '{
plan: .plan_name,
used: .this_month_usage,
remaining: .plan_searches_left,
daily_avg: (.this_month_usage / ([1, (now | strftime("%d") | tonumber)] | max))
}'
| Issue | Cause | Solution |
|---|---|---|
| Unexpected costs | No caching | Implement Redis/LRU cache |
| Credits exhausted mid-month | Underestimated volume | Upgrade plan or increase cache TTL |
| Cache miss rate high | Short TTL | Increase cache TTL to 1-4 hours |
For architecture patterns, see serpapi-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
serpapi, cost-optimization, caching, search-api, saas-costs, credit-savings
18 skills in this plugin
/serpapi-ci-integrationSet up CI/CD for SerpApi integrations with fixture-based testing.
Use when automating SerpApi tests without consuming credits,
or validating search result parsing in CI.
Trigger: "serpapi CI", "serpapi GitHub Actions", "serpapi automated tests".
/serpapi-common-errorsDiagnose and fix SerpApi errors: invalid keys, exhausted credits, blocked searches.
Use when SerpApi returns errors, empty results, or unexpected status codes.
Trigger: "serpapi error", "fix serpapi", "serpapi not working", "serpapi empty results".
/serpapi-core-workflow-aGoogle Search scraping with SerpApi -- organic results, knowledge graph, answer boxes.
Use when building search-powered features, SEO monitoring,
or extracting structured data from Google results.
Trigger: "serpapi google search", "scrape google", "serpapi organic results".
/serpapi-core-workflow-bSearch Bing, YouTube, Google Shopping, Google News, and Google Maps with SerpApi.
Use when scraping non-Google engines, building multi-engine search,
or extracting video/news/shopping/maps data.
Trigger: "serpapi youtube", "serpapi bing", "serpapi news", "serpapi shopping".
/serpapi-debug-bundleCollect SerpApi debug diagnostics: account status, recent searches, and error logs.
Use when troubleshooting SerpApi issues, checking credit usage,
or preparing support tickets.
Trigger: "serpapi debug", "serpapi diagnostic", "serpapi support".
/serpapi-deploy-integrationDeploy SerpApi-powered search features to production platforms.
Use when deploying search APIs, configuring backend proxies,
or setting up SerpApi in serverless environments.
Trigger: "deploy serpapi", "serpapi Vercel", "serpapi production deploy".
npx claudepluginhub flight505/skill-forge --plugin serpapi-packOther plugins' skills for the same job