| name | perplexity-migration-deep-dive |
| description | Migrate to Perplexity Sonar from other search/LLM APIs using the strangler fig pattern.
Use when switching from Google Custom Search, Bing API, or other LLMs to Perplexity,
or migrating from legacy pplx-api models.
Trigger with phrases like "migrate to perplexity", "switch to perplexity",
"replace search API with perplexity", "perplexity replatform".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(node:*), Bash(kubectl:*) |
| version | 1.12.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","perplexity","migration"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Perplexity Migration Deep Dive
Current State
!npm list openai 2>/dev/null | grep openai || echo 'N/A'
!grep -rn "google.*search\|bing.*api\|serpapi\|pplx-7b\|pplx-70b" --include="*.ts" --include="*.py" . 2>/dev/null | head -5 || echo 'No legacy search APIs found'
Overview
Migrate from traditional search APIs (Google Custom Search, Bing, SerpAPI) or legacy LLMs to Perplexity Sonar. Key advantage: Perplexity combines search + LLM summarization in a single API call, replacing a multi-step pipeline.
Migration Comparison
| Feature | Google CSE / Bing | Perplexity Sonar |
|---|
| Returns | Raw search results (links + snippets) | Synthesized answer + citations |
| Answer generation | Requires separate LLM call | Built-in |
| Citation handling | Manual extraction | Automatic citations array |
| Cost structure | Per-search ($5/1K queries) | Per-token + per-request |
| Recency filter | Date range parameters | search_recency_filter |
| Domain filter | Site restriction | search_domain_filter |
Instructions
Step 1: Assess Current Integration
set -euo pipefail
grep -rn "googleapis.*customsearch\|bing.*search\|serpapi\|serper\|tavily" \
--include="*.ts" --include="*.py" --include="*.js" \
. 2>/dev/null || echo "No search APIs found"
grep -rln "search.*api\|customsearch\|bing.*web" \
--include="*.ts" --include="*.py" --include="*.js" \
. 2>/dev/null | wc -l
Step 2: Build Adapter Layer
{
: ;
: [];
?: <{ : ; : ; : }>;
}
{
(: , ?: { ?: ; ?: [] }): <>;
}
{
(: ): <> {
results = (query);
{
: ,
: results..( i.),
: results..( ({
: i.,
: i.,
: i.,
})),
};
}
}
{
: ;
() {
. = ({
: process..!,
: ,
});
}
(: , ?: { ?: ; ?: [] }): <> {
response = ....({
: ,
: [{ : , : query }],
...(opts?. && { : opts. }),
...(opts?. && { : opts. }),
} );
{
: response.[].. || ,
: (response ). || [],
: (response ). || [],
};
}
}