See llms.txt for all machine-readable content.

Back to Templates

Write a fully cited research report with DuckDuckGo and OpenRouter (Gemini)

Quick overview

Workflow canvas

Ask a question in a form; DuckDuckGo searches the web and the workflow returns one HTML report where every claim cites a quoted page. A sub-question that found nothing is searched again once. Self-hosted n8n only.

How it works

  1. A form takes the question and how deep to search. A model splits it into 3 to 5 sub-questions and writes one search query for each; code caps how many run.
  2. For each sub-question the DuckDuckGo node searches the web and reads the top pages. Code grades what came back (readable, thin, empty or blocked) and numbers the sources S1, S2 and so on, at most two per site.
  3. A model extracts findings, each with a quote. Code keeps a finding only if the quote is at least eight words, is found in the text of the source it names, and holds every number of the claim.
  4. A sub-question with no kept finding gets one more round: the model rewrites its query from the question, the failed query and the earlier queries (it never sees page text), code drops repeated queries and queries with search operators or addresses, keeps two at most, and skips the round after DuckDuckGo blocked a search. The new pages are added to the numbered sources; the ids of the first round never change.
  5. A second model writes the report from the kept findings only. Code removes sentences that cite nothing, HTML and links, then adds the sources with their checked passages and a coverage table that shows which sub-questions were searched again.
  6. The form page shows one HTML file in a sandboxed preview with a Download button, or says why there is no report (for example fewer than three sources, or half the searches blocked).

Setup

  1. Self-hosted n8n 2.18 or later: install n8n-nodes-duckduckgo-search 32.19.1 or later under Settings → Community nodes. Searching and reading pages need no API key or account.
  2. Add a credential to the chat-model node, OpenRouter model. It is set to a cheap fast model; any chat-model node can replace it, as long as the model returns JSON reliably.
  3. Activate the workflow, open the form's production URL and ask a question. A run takes one to four minutes and makes 3 to 7 DuckDuckGo searches, so leave a few minutes between runs. Keep the form behind n8n login, as it is set here: it makes the node fetch whatever pages a search returns.

Requirements

  • Self-hosted n8n only: community nodes cannot be installed on n8n Cloud
  • n8n 2.18 or later, so that links in the preview open in a new tab
  • The community node n8n-nodes-duckduckgo-search, version 32.19.1 or later
  • An API key for the AI model: OpenRouter by default, or any provider with an n8n chat-model node
  • No API key or account is needed for DuckDuckGo

Customization

  • Change how many sources one site may give (the limit in Number the sources) or how many sub-questions the form allows
  • Change the number of extra searches in the second round (Plan the second round); keep the waits between searches, because DuckDuckGo limits requests per IP address
  • Choose another region on the search nodes (they are set to wt-wt, no region)
  • Swap the model node for any other chat-model node
  • Send the HTML file by email or save it to Google Drive instead of showing it on the form page

Additional info

Suggested title: "Write a cited research report that searches again for what is missing with DuckDuckGo". The AI model is a swappable part (any chat-model node works), so the title names only the search node. This is a new template, not an update of an earlier one: it adds a second search round for the sub-questions that found nothing, a cap of two sources per site, quotes of at least eight words that must contain every number of the claim, and a preview with a Download button. The canvas preview does not render community nodes, so the full canvas is in the screenshot at the top of the description. The quotes are checked against the pages; the claims in them are not fact-checked, and the report says so. Source and notes: https://github.com/samnodehi/n8n-nodes-duckduckgo/tree/main/docs/examples