Keyword clustering · SERP analysis · Python · Streamlit
SEO Clustering Tool: Keyword Clusters Without the API Bill
A Python and Streamlit tool that clusters keywords by SERP URL overlap instead of by string similarity, with a cache that stops the same SERP being paid for twice.
Results at a glance
- Clustering
- SERP overlap
- Built with
- Python + Streamlit
- Cost control
- Cached SERPs
- Access
- Public repo
Not string similarity
CSV in, clusters out
No repeated API calls
Open source
The problem
Keyword research produces a list, and a list is not a content plan. Two keywords that look different can return almost the same top ten results, which means they want the same page. Two keywords that look similar can return completely different results, which means they need separate pages. Sorting that by hand in a spreadsheet is slow, subjective and impossible to redo when the list grows.
The obvious fix — cluster by keyword similarity, or by asking a model to group them — produces groups that read well and do not match what search engines return.
Why we decided to solve it
A topical map is only as good as its clusters: one owning page per query comes from knowing which queries belong together. Getting that wrong is expensive later, because a merged cluster means one page trying to serve two intents, and a split cluster means two pages competing for one.
The second cost was the API bill. Pulling SERPs for a few thousand keywords, then re-pulling them on every re-run while tuning the threshold, is where these tools usually become too expensive to use.
How we did it
Cluster on what Google returns
Each keyword is resolved to its top results, and clusters are formed by URL overlap: keywords sharing enough of the same results belong to the same page. That is the same signal a search engine uses to decide whether two queries are one topic, so the grouping survives scrutiny.
Cache every SERP
Results are written to a local cache keyed by keyword and market, so re-running a clustering pass costs nothing. The threshold can be tuned as many times as needed without paying for the same SERP twice — on a large set that is the difference between a usable tool and a demo.
Keep the threshold visible
The overlap threshold is a control, not a hidden default. Raising it produces more, smaller clusters; lowering it merges them. Seeing both makes the trade-off explicit instead of accepting whatever grouping the tool produced.
Ship a CSV that fits the next step
The output is a cluster list with keywords, shared URLs and cluster size, ready to be pasted into the topical map with volume and CPC. The tool’s job ends when the map row can be written.
The result
A repeatable clustering step: same input, same clusters, at no extra API cost per run. It has been used on client keyword sets and on my own sites, and it replaced the manual sorting that used to sit between keyword research and the map.
The repository is public, so the method can be read rather than taken on trust: SEO-Clustering-Tool.
Contact
Want to talk through a project like this?
I am open to remote SEO, web design and performance roles. If you need more detail on a specific project, ask — I will share what the client allows.
- fassihfayyaz@gmail.com
- Phone
- +92 322 6189669
- Location
- Multan, Pakistan · Remote
- Status
- Open to remote roles