Work/Fact-Checker
A prototype became a working service in five days, at a third of the cost
It shows the step after a first AI tool. A prototype that needed a person at the keyboard became a safe service that other people and software can use, and a repeat question reuses the first answer.
- Kind
- My own build
- Result
- 70% fewer model calls
- Speed
- 3 times faster per claim
In one paragraph
A fact-checking prototype lived in a Jupyter notebook, a developer's test file. It accepted any input, with no limit on requests. It paid for the same model call every time it was asked the same question, and only a person at a keyboard could run it. Fact-Checker turned it into a service. It takes text or a link, breaks it into single claims, finds evidence on the web and asks the model for a verdict of true, false or uncertain. Results are kept for 24 hours, so the service makes about 70% fewer model calls. Each claim takes three to five seconds instead of ten to fifteen. In five days, I built the backend and frontend in about 3,500 lines.
The problem I started from
The notebook worked, once per run, for one person, at whatever the model charged that day. To serve other people it needed five things: protection against bad input, a limit on requests, stored answers, a way for other software to call it, and clean handling of errors.
The job was to make the existing fact-checking safe to expose, not to improve it.
What I decided
Security before features. Before the service took its first request, it already checked every link against a strict list of allowed sites, accepted five requests a minute, cleaned text on the way in and encoded it on the way out.
A cache that keeps answers for 24 hours. The same claims come up again and again, and a question asked a day later is still the same question. Reusing those answers cut the paid calls to the AI model by about 70%. Twenty-four hours was where fresh answers and cost balanced out.
A 30-second limit on every outside call. The web search and the model both belong to other companies. If either one hangs, the service stops waiting after 30 seconds instead of hanging with it.
A request ID on everything. Each request carries one ID through every line of the logs. When something fails, it can be traced from start to finish without guessing.
What exists
| Flow | Input → claim extraction → evidence retrieval (Parallel Web API) → cache check → evaluation (Cerebras) → verdict |
|---|---|
| Security | Allowlist URL validation, 5 req/min rate limit, sanitization, output encoding, global error middleware, 30 s timeouts |
| Cache | Redis, 24 h TTL, ~70% reduction in model calls |
| Speed | 3 to 5 seconds per claim, from 10 to 15 in the notebook |
| Code | ~2,000 lines Python (FastAPI), ~1,500 lines TypeScript (Next.js, React) |
| Deploy | Docker Compose, one command, health checks |
| Time | Five days |
What I would do differently
Stream the progress. A claim takes seconds, and the user watches a spinner. Server-sent events would show each step as it happens: pulling out claims, finding evidence and judging them.