This AI fact checker is a small web app for anyone who wants to see the sources behind a claim before repeating it. Paste one claim and get related web sources, each with a link, and a short summary that keeps only sentences tied to a returned source. Summary sentences that judge the claim are hidden. X search is optional and off by default. It helps you find sources; you still read them and decide.
The problem
A claim shows up in a chat, a post or an AI answer, and checking it means opening a search engine, reading several pages and looking for who said what. A summary without links is hard to trust, and a list of links without context takes time to read. Most people want the few sources that matter, with the sentence that backs each point.
What the app does
- Takes one claim, 8 to 200 characters, with at least two words that carry meaning.
- Returns deduplicated web sources shown neutrally, with a rank, title link, domain and snippet.
- Hides summary sentences with judgment or verdict phrasing, then keeps remaining sentences only if every link they cite is a returned source. Verdict sentences and uncited or mis-cited sentences are counted separately. This checks citation destinations, not whether a source establishes a sentence's accuracy.
- Shows the number of sources returned. With fewer than two displayed sources, it also says "Few sources returned. Read them before you share anything."
- When X search is enabled, adds posts containing at least two distinct meaningful claim terms, or all terms if the claim has fewer than two. Posts with account mentions or text matching the built-in profanity filter are dropped; authors are shown as "a user".
- Can also search Wikipedia, and serves the same result as JSON from
GET /api/check.
How it works
- Check the input. Blank, too short or junk claims get a 400 before any paid call.
- Find web sources.
POST /desearch/ai/searchwithtools: ["web"],result_type: "LINKS_WITH_FINAL_SUMMARY"andcount: 10returns sources plus a summary. The request asks for a neutral summary with citations and without a verdict. - Optionally search X. X search is off by default. When enabled,
GET /twitteruses the claim's first 4 key terms,sort: "Top"andcount: 10, running in parallel with the web search. - Clean and filter. Sources are deduplicated and shown neutrally. Summary sentences that judge the claim are hidden; remaining sentences are kept only when every link they cite is a returned source. Optional X posts pass the claim-term, profanity and account-mention filters.
- Serve. The page and the JSON endpoint share the same code, with a 6-hour cache header so repeat claims are answered from a CDN.
The code
The core call, copied from the example's README. The key is read from the DESEARCH_API_KEY env var:
curl -s https://api.desearch.ai/desearch/ai/search \
-H "Authorization: $DESEARCH_API_KEY" -H "Content-Type: application/json" \
-d '{"prompt": "Octopuses have three hearts and blue blood", "tools": ["web"], "streaming": false, "result_type": "LINKS_WITH_FINAL_SUMMARY", "count": 10}'The response holds search (each source's title, link, snippet and highlights) and completion, a summary that cites sources as [n](url).
The folder layout:
factcheck/core.py: input checks, request bodies, source and text cleanup, verdict sentence filtering, citation checks, X post filters, rate limiter, spend cap, cache and report rendering. No network.factcheck/client.py: the plain-HTTP Desearch client.factcheck/service.py: the/api/checklogic shared by the local server and the hosted function.api/check.py,public/index.html,vercel.json: the hosted version.app.py: local server and CLI.test_core.py: offline tests.
Endpoints
POST /desearch/ai/searchGET /twitter
Example output
Example output for the claim "The Great Wall of China is visible from space with the naked eye":
Claim: The Great Wall of China is visible from space with the naked eye
10 sources returned.
- While some structures like cities and large dams are visible from low Earth orbit, the Wall's size and coloration make it indistinguishable to the naked eye from space.
(1 uncited summary sentence(s) hidden)
2 summary sentence(s) that judged the claim were hidden.
1. Can you see the Great Wall of China from space? | BBC Sky at Night Magazine
www.skyatnightmagazine.com
https://www.skyatnightmagazine.com/space-science/can-you-see-great-wall-china-from-space
One of the biggest is the idea that the Great Wall of China is the only human-made structure that can be seen from space. Is this true?The made-up claim in samples/made-up-claim.json returned general science pages. The page says "10 sources returned." A source count does not establish source quality or the claim's accuracy.
Run it yourself
Clone desearch-py-examples and open ai-fact-checker. Then run the README's local commands:
export DESEARCH_API_KEY_FILE=/path/to/key # or DESEARCH_API_KEY, or --key-file
python3 app.py # web app at http://127.0.0.1:8000For a one-off check from the command line:
python3 app.py --cli "Humans only use 10 percent of their brain" --wiki --json out.json --html out.html--wiki(orwiki=1on/api/check) also searches Wikipedia, with one more call.- X search is off by default. Set
DEMO_X_ENABLED=1orDEMO_X_ENABLED=trueon the server (case-insensitive). The CLI enables X independently with--x; an API query parameter cannot enable it. --jsonand--htmlsave the full result as data or as a page.--log-dir runs/todaysaves each API call with the key removed.
What it costs
With X off by default, a check costs $0.004 for one web search, or $0.008 with the additional Wikipedia search. Enabling X adds $0.0015, for $0.0055 per check or $0.0095 with Wikipedia. Checks served from the cache cost nothing. See pricing.
A normal check takes about 10 to 15 seconds. Three live runs measured ai/search at 9.4 to 10.1 seconds. Allow up to 40 seconds with X enabled. Wikipedia adds a parallel search call, so timing can vary.
Try it
Paste a claim and see related web sources and a cited summary. Read the sources to assess the claim. X search is optional and off by default.
Ideas to extend it
- Limit sources to sites you trust with
include_domains, for example a science magazine and an encyclopedia. - Add a browser button that sends the selected text on any page to
/api/check. - Check every factual sentence in a draft article and collect linked sources for review.
- Give an agent
/api/checkas a tool so it attaches sources before it answers.
