Guide · GEO

Query fan-out: see the searches AI runs behind a prompt

When a buyer asks ChatGPT, Claude or Gemini a question, the assistant doesn't search for the question. It breaks it into smaller searches, reads what comes back, and cites a few pages. If your pages don't turn up for those searches, you're not in the answer. This guide shows how to capture them with the Claude API, find the ones you're missing, and fix them. Seven steps and a script you can run today.

What you can measure

Which engines show their searches

Claude, ChatGPT and Gemini return the searches they ran through their APIs. Perplexity and Google's AI search don't. The Claude API is the simplest place to start: one tool setting, and every search comes back in the response.
EngineCan you see its searches?Typical searches per prompt
Claude (API) (recommended)Yes. Every search is a server_tool_use block with the query in input.queryUsually 1 search per answer, worded close to the prompt
ChatGPT (OpenAI API)Yes. The Responses API returns web_search_call items with the queries2.1 per prompt on average, often adding "best", "reviews" and brand names
Gemini (API with Google Search grounding)Yes. The grounding metadata lists the queries it ran10.7 per prompt on average with grounding forced (3 to 28)
Perplexity (API)No. It returns sources and citations, not the queries1.4 per prompt, mostly a trimmed copy of the prompt
Google AI Mode and AI OverviewsNo. Google doesn't expose them anywhere, Search Console included"A multitude" for AI Mode, hundreds for Deep Search
Counts come from different studies with different methods (Peec AI, Seer Interactive, Linkeddit, Google). Compare the order of magnitude, not the decimals.

The process

From buyer questions to pages AI cites

The first run takes about a day. After that it's a monthly job: the script does the capturing, and people decide what to write.

About a day the first month · an hour or two a month after that

  1. 1: Prompt set

    30–50 real buyer questions

    Step 1
  2. 2: Capture

    Claude API with web search, 3 runs

    Steps 2–3
  3. 3: Compare

    A second engine on the same prompts

    Step 4
  4. 4: Themes

    Group searches, count repeats

    Step 5
  5. 5: Coverage

    Cited, retrieved, ranks or missing

    Step 6
  6. 6: Fix and re-run

    Sections, rewrites, listings

    Step 7

The 7 steps

How to capture fan-out and act on it

Every step says who does it, how much is automated, and how you know it's done.

Day 1

Capture the searches

A short script sends your buyers' questions to Claude with web search switched on, and logs every search it runs, every page it reads and every page it cites.

Human, 1 hourMarketing lead

Step 1: Write down the questions buyers ask assistants

Why it matters

Fan-out starts from a prompt, so the prompts decide what you learn. People type full questions into ChatGPT and Claude, with their situation in them: team size, budget, city, what they tried. Short keywords give you short, generic searches back.

What to do

  • Collect 30 to 50 questions from sales calls, support tickets, Search Console queries of six words or more, and what prospects tell you they asked an AI.
  • Write them the way a buyer would say them out loud, including the details that change the answer.
  • Mix the stages: "what is", "how do I", "best X for Y", "X vs Y", "is X worth it", and questions that name you or a competitor.
  • Keep the list in a file. You'll run the same set every month so the results compare.

Done when

Every prompt is something a real buyer has asked, in their words. No prompt is a bare keyword.

AutomatedDeveloper or technical marketer

Step 2: Run each prompt through the Claude API with web search on

Why it matters

Claude's web search tool runs on Anthropic's side, and the response shows each search Claude ran, the pages that came back and the pages it cited. That's the fan-out, measured rather than guessed. Searches cost $10 per 1,000 plus normal token costs, so a 50-prompt set run three times costs a few dollars.

Source: Anthropic: web search tool documentation

What to do

  • Create an API key in the Claude Console and install the SDK (Python and TypeScript both work).
  • Use the basic web search tool (web_search_20250305). Newer versions run searches from inside code execution, so the searches are nested and harder to read.
  • Set max_uses to 5 so one prompt can't run up a large bill.
  • Run each prompt three times. Claude decides each time whether and what to search, and one run isn't a pattern.

Done when

The script writes one row per search, result and citation, with the prompt and run number on each.

fan-out.ts
// npm i @anthropic-ai/sdk   then   ANTHROPIC_API_KEY=... npx tsx fan-out.ts
import Anthropic from "@anthropic-ai/sdk";
import { writeFileSync } from "node:fs";

const client = new Anthropic();
const PROMPTS = [
  "Which accounting firm in Manchester is best for a small agency?",
  // ...30 to 50 real buyer questions
];
const RUNS = 3;
const rows = ["prompt,run,type,value"];

for (const prompt of PROMPTS) {
  for (let run = 1; run <= RUNS; run++) {
    const res = await client.messages.create({
      model: "claude-sonnet-5-5",
      max_tokens: 2048,
      messages: [{ role: "user", content: prompt }],
      tools: [{ type: "web_search_20250305", name: "web_search", max_uses: 5 }],
    });
    for (const block of res.content) {
      // 1. What Claude searched for
      if (block.type === "server_tool_use" && block.name === "web_search") {
        rows.push(csv(prompt, run, "search", (block.input as { query: string }).query));
      }
      // 2. What came back
      if (block.type === "web_search_tool_result" && Array.isArray(block.content)) {
        for (const result of block.content) rows.push(csv(prompt, run, "retrieved", result.url));
      }
      // 3. What it actually cited in the answer
      if (block.type === "text") {
        for (const c of block.citations ?? []) {
          if (c.type === "web_search_result_location") rows.push(csv(prompt, run, "cited", c.url));
        }
      }
    }
  }
}
writeFileSync("fan-out.csv", rows.join("\n"));

function csv(...cells: (string | number)[]) {
  return cells.map((c) => '"' + String(c).replace(/"/g, '""') + '"').join(",");
}
AutomatedWhoever reads the results

Step 3: Keep searched, retrieved and cited apart

Why it matters

The three lists answer different questions. A page that never appears in the retrieved results has a discovery problem: it doesn't rank for what the assistant searched. A page that's retrieved but never cited has an extraction problem: the answer isn't easy to lift from it. The fixes are opposite, so don't merge the columns.

What to do

  • Open the CSV in a sheet and pivot by type: searches, retrieved URLs, cited URLs.
  • Mark the rows where your domain appears, and the domains that appear most in the cited column.
  • Note prompts where Claude ran no search at all. It answered from what it already knows, and the fix there is being mentioned more widely, not a new page.

Done when

For each prompt you can say: did it search, did it find us, and did it cite us.

Day 2

Find the patterns and the gaps

One run of one prompt tells you little. Repeat the runs, group the searches into themes, and check which themes you show up for.

AutomatedDeveloper or technical marketer

Step 4: Compare with a second engine

Why it matters

Engines search differently. In one 15-prompt test, Claude ran about one search per answer close to the prompt, ChatGPT about five that named vendors and review sites, and Gemini about two that added a year. Claude alone undercounts the angles. Pooling every engine into one list overcounts them: it gives you a list nobody ran.

Source: Linkeddit: four engines' fan-out on the same 15 prompts

What to do

  • Run the same prompts through the OpenAI Responses API with web search, or Gemini with Google Search grounding. Both return their queries.
  • Keep a column for the engine and analyse each engine on its own first.
  • Flag searches that show up on two or more engines. Those are the strongest signals you'll get.

Done when

Every theme you act on is backed by at least two runs, and you know which engines ran it.

AI groups, human checksMarketing lead

Step 5: Group the searches into themes

Why it matters

Fan-out searches change wording from run to run. Seer Interactive pulled the same 100 prompts 13 times: 11,029 different searches, and only 8 came back every time. The theme behind them is what repeats, such as pricing, alternatives, reviews or a specific use case. Plan around the theme and the exact wording stops mattering.

Source: Seer Interactive: signal from noise in query fan-outs

What to do

  • Paste the searches for one prompt (or one topic) into Claude with the prompt below.
  • Check the groups by hand. Merge the ones that would be answered by the same paragraph.
  • Note the words engines add that buyers didn't type. Peec AI found ChatGPT adds "best" to 24.3% of advice-style questions, and often adds "reviews".

Done when

Each theme has a count of how many prompts and runs it showed up in. Themes seen once are parked, not planned.

Prompt
Below are web searches an AI assistant ran while answering buyer
questions, as CSV (prompt, run, search). Group them by the underlying
sub-question each search is trying to answer. For each group give:
- the sub-question in plain words
- how many distinct prompts and runs it appeared in
- 2-3 example searches, copied exactly
- the words the engine added that weren't in the prompt
Do not invent searches that aren't in the data.
Mostly automatedSEO or content lead

Step 6: Check which themes you show up for

Why it matters

In Surfer's study of 10,000 keywords, pages ranking for the main query and at least one fan-out search were 161% more likely to be cited in AI Overviews than pages ranking for the main query alone. Ranking isn't the whole story, though: most cited pages don't rank on page one for anything the engine searched. Check both where you rank and whether you were cited.

Source: Surfer: fan-out rankings and AI Overview citations, 173,902 URLs

What to do

  • For each theme, take its most common search and check where your site ranks (a rank tracker, or Search Console if you already get impressions for it).
  • Mark each theme: cited, retrieved but not cited, ranks but not retrieved, or missing.
  • List the domains cited for the themes you're missing. They're who you're up against, and often they're review sites or directories, not competitors.

Done when

Every theme has one status and a list of who's cited instead of you.

Retrieved but never cited?

Check that assistants can actually read your pages

A page can rank for a fan-out search and still be skipped if a firewall blocks the assistant or the text only appears after JavaScript runs. The free checker tests it in about ten seconds.

Check my website

Then monthly

Fix the gaps and re-run

Each theme you're missing becomes a section, a page or a listing to fix. A monthly re-run tells you whether it worked and what changed.

Human writes, script measuresContent team + subject expert

Step 7: Answer the missing themes, then re-run monthly

Why it matters

Semrush updated four articles to answer the fan-out searches around them and saw citations in tracked prompts rise from two to five in a month. It's a small test, but it fits the mechanism: a page that answers more of the sub-questions gets retrieved for more of the searches. The monthly re-run tells you if it worked, and shows new themes as models change.

Source: Semrush: query fan-out optimisation experiment

What to do

  • Missing themes that matter to buyers: add a section with a question-style heading and the answer in its first two sentences, on the page that should own the topic.
  • Retrieved but not cited: rewrite the passage so the answer stands on its own, with the number, the price or the comparison table right there.
  • Themes where review sites or directories get cited: fix your listings on those sites. Your own page won't replace them.
  • Re-run the script on the 1st of each month with the same prompts, and compare statuses with last month.

Done when

Each change is mapped to the theme it answers, so next month's run shows whether it moved.

Monthly schedule
1st of mo  fan-out.ts on the fixed prompt set (Claude + one more engine)
           -> fan-out-YYYY-MM.csv
1st of mo  Group searches into themes, compare statuses with last month
Sprint     Missing themes -> sections or pages; retrieved-not-cited -> rewrites
Quarterly  Refresh the prompt set from new sales and support questions

What it costs

A few dollars a month in API fees

Prices from Anthropic's pricing page. Your token costs depend on how long the answers are and how many results each search returns.
ItemPriceFor a 50-prompt set, 3 runs
Web searches$10 per 1,00050 prompts × 3 runs × up to 5 searches = at most 750 searches, so $7.50 at most
Claude Sonnet 5.5 tokens (recommended)$2 in, $10 out per millionSearch results count as input tokens, typically a few cents per run
Claude Haiku 5.5 tokensFrom $0.10 in, $0.50 out per millionCheaper per run; same search price
Your timeAbout a day the first monthThen an hour or two a month to read the comparison
Errored searches aren't billed. Set max_uses on the tool to cap searches per prompt.

What to skip

Ways fan-out data gets misread

Fan-out is useful evidence and easy to over-read. These are the mistakes we see most often.

The monthly run

Eight checks for a fan-out report you can trust

The script does the capturing. These checks are what make one month comparable with the next, so a change in the report means something changed in the engines or on your site, not in how you ran it.

Fan-out tells you what to write. How to write it at a steady pace without tripping spam policies is in our SEO and GEO automation guide, and making sure assistants can read the result is in the agent-ready website guide.

Monthly fan-out run

  • Same prompt set as last month (done)Change it quarterly, not every run, or months won't compare.
  • Each prompt run at least three times (done)
  • At least two engines captured (done)Claude plus ChatGPT or Gemini.
  • Searched, retrieved and cited kept in separate columns (done)
  • Searches grouped into themes, with counts (done)
  • Each theme marked cited, retrieved, ranks or missing (done)
  • Every content change mapped to a theme (done)
  • Prompts with no search at all reviewed (needs attention)The assistant answered from memory. Mentions on other sites help here, not a new page.

FAQ

Questions about query fan-out

What is query fan-out?

Query fan-out is how AI assistants answer a question with web search: they break the prompt into several smaller searches, run them, read the results, and write one answer citing some of the pages. Google uses the term for AI Mode and AI Overviews, and ChatGPT, Claude, Gemini and Perplexity all work in a similar way. The pages an assistant can cite are the ones those searches find.

Why use the Claude API rather than just asking Claude?

The Claude app shows its searches too, but by hand you can't run 50 prompts three times a month and compare. The API returns every search, result and citation as data you can save and diff. Bear in mind the API is a close stand-in for the app, not a copy: the app has its own system prompt and settings, so treat the results as evidence of how Claude searches, not a record of every user's session.

How much does it cost to track fan-out with the Claude API?

Web search costs $10 per 1,000 searches plus normal token costs, and search results count as input tokens. A 50-prompt set run three times, capped at five searches a prompt, is at most 750 searches ($7.50), plus a few cents of tokens per run on Claude Sonnet 5.5. In practice Claude usually runs one or two searches per prompt, so it's often less.

Can I see the fan-out queries behind Google AI Mode or AI Overviews?

No. Google doesn't expose them in the results page, the API or Search Console. Tools that show AI Mode fan-out reconstruct it, usually with Gemini through the API, which is a different system. Gemini's API with Google Search grounding is the closest measurable stand-in.

Are fan-out queries the same as keywords?

No. Seer Interactive found 95% of Gemini 3's fan-out searches had no measurable search volume, and the wording changes between runs. They're the sub-questions an assistant needs answered, so plan content around the themes they share rather than the exact strings.

How often should we re-run the analysis?

Monthly is enough for most teams, with the same prompt set so results compare. Fan-out changes when models change: Seer measured 78% more searches per prompt from Gemini 2.5 to Gemini 3. Refresh the prompt set itself every quarter from new sales and support questions.

Does answering fan-out searches actually increase AI citations?

The evidence points that way but is still early. Surfer found a strong correlation between the number of fan-out searches a page ranks for and AI Overview citations, and Semrush's small test raised citations from two to five after updating four articles. Correlation isn't proof, which is why the monthly re-run matters: it shows whether your own changes moved anything.

Last reviewed . Sources are linked under each step. API details from Anthropic: web search tool documentation.

Next step

Want fan-out tracking set up for you?

We'll build your prompt set from your sales and support questions, run it across Claude, ChatGPT and Gemini every month, and hand your team a short list of themes to write for, with who's cited instead of you.