Claude-code-plugins serpapi-rate-limits

install
source · Clone the upstream repo
git clone https://github.com/jeremylongshore/claude-code-plugins-plus-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/jeremylongshore/claude-code-plugins-plus-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/saas-packs/serpapi-pack/skills/serpapi-rate-limits" ~/.claude/skills/jeremylongshore-claude-code-plugins-serpapi-rate-limits && rm -rf "$T"
manifest: plugins/saas-packs/serpapi-pack/skills/serpapi-rate-limits/SKILL.md
source content

SerpApi Rate Limits

Overview

SerpApi uses credit-based pricing (each search = 1 credit) plus per-second rate limits. Retrieving cached/archived searches does not consume credits. Plans range from 100 searches/month (free) to unlimited (enterprise).

Plan Limits

PlanSearches/MonthRate LimitPrice
Free1001/second$0
Developer5,0005/second$75/mo
Business15,00010/second$200/mo
Enterprise50,000+15/secondCustom

Instructions

Step 1: Monitor Credit Usage

import serpapi, os

client = serpapi.Client(api_key=os.environ["SERPAPI_API_KEY"])

# Check remaining credits before batch operations
account = client.account()
remaining = account["plan_searches_left"]
used = account["this_month_usage"]
total = account["total_searches_left"]

print(f"Used: {used}, Remaining: {remaining}")
if remaining < 100:
    print("WARNING: Low credits remaining")

Step 2: Request Throttling

import time
from threading import Semaphore

class ThrottledSerpApi:
    def __init__(self, api_key: str, max_per_second: int = 5):
        self.client = serpapi.Client(api_key=api_key)
        self.semaphore = Semaphore(max_per_second)
        self.last_request = 0

    def search(self, **params) -> dict:
        with self.semaphore:
            # Enforce minimum interval
            elapsed = time.time() - self.last_request
            if elapsed < 0.2:  # 5/sec max
                time.sleep(0.2 - elapsed)
            self.last_request = time.time()
            return self.client.search(**params)

Step 3: Use Archive to Avoid Credit Waste

# Retrieve a previous search result by ID (FREE, no credit charge)
archived = client.search(engine="google", search_id="previous_search_id")

# Check if a query was recently searched before spending a credit
# Store search IDs in your database keyed by query+params hash

Step 4: Node.js Rate Limiter

import PQueue from 'p-queue';
import { getJson } from 'serpapi';

const queue = new PQueue({
  concurrency: 3,       // Max parallel requests
  interval: 1000,       // Per second
  intervalCap: 5,       // Max 5 per second
});

async function throttledSearch(params: Record<string, any>) {
  return queue.add(() => getJson({
    ...params,
    api_key: process.env.SERPAPI_API_KEY,
  }));
}

// Batch search with automatic throttling
const queries = ['query1', 'query2', 'query3'];
const results = await Promise.all(
  queries.map(q => throttledSearch({ engine: 'google', q }))
);

Error Handling

ErrorCauseSolution
429 Too Many Requests
Rate limit exceededSlow down, check plan tier
Searches exhausted
Monthly credits used upCache results, upgrade plan
Account disabled
Payment issue or abuseContact SerpApi support

Resources

Next Steps

For security configuration, see

serpapi-security-basics
.