Back to templates

Template details

AI Facts

Next.js app that transcribes spoken statements in real time with Deepgram and fact-checks them using OpenAI and Perplexity via Vercel AI Gateway.

About this template

AI Facts is a Next.js application for real-time fact checking of spoken statements, built by Vercel Labs. It captures microphone audio, transcribes it with Deepgram, splits the transcript into distinct statements, and routes each claim through the Vercel AI Gateway to OpenAI and Perplexity for verification, displaying a status and explanation live.

What is AI Facts?

AI Facts is a Next.js web application that performs real-time fact checking on spoken statements. It takes live microphone audio as input, transcribes it with Deepgram, and outputs a verification status plus a written explanation for each detected claim, produced by OpenAI and Perplexity models reached through the Vercel AI Gateway. It is maintained under the vercel-labs organization on GitHub.

What makes AI Facts stand out?

  • Real-time audio transcription — Deepgram's API captures and transcribes spoken audio as a live stream rather than an uploaded file.
  • Dual-model fact checking — each claim is cross-referenced by both OpenAI and Perplexity through a unified gateway, not a single model.
  • Statement segmentation — transcribed text is split into distinct statements at sentence punctuation ('?!.'), so each claim is checked individually.
  • Explanation of validity — the app returns a detailed rationale for why a statement is judged true or false, not just a label.
  • Live results — verification status and explanations appear as statements are processed.
  • Vercel one-click deploy — a Deploy with Vercel button clones the repository and requires a Deepgram API key as an environment variable.
  • Next.js stack — the frontend and API routes use Next.js with the AI SDK for model calls.
  • ShadcnUI and Tailwind CSS — UI components and styling are built on ShadcnUI and Tailwind CSS.

Who is it for?

  • Developers building fact-checking tools: start from a working pipeline that already wires audio streaming, transcription, and multi-model verification.
  • Hackathon and prototype teams: one-click Vercel deployment and a small set of environment variables get a live demo running quickly.
  • Developers learning the AI SDK and AI Gateway: the project shows a concrete pattern for routing requests to OpenAI and Perplexity through one gateway.
  • Journalists or researchers testing live claims: use the app to see how AI models flag spoken statements during broadcasts or interviews.

How does AI Facts work?

A user speaks into the microphone, and Deepgram processes the audio stream in real time, returning transcribed text. The transcript is split into distinct statements by sentence punctuation, and each statement is routed through the AI Gateway to OpenAI and Perplexity for fact checking. The verification status and explanation are then displayed to the user.

What do you need to run AI Facts?

AI Facts requires an AI_GATEWAY_API_KEY and a DEEPGRAM_API_KEY in a .env file, copied from .env.example. Install dependencies with npm install, add the keys, then run npm run dev and open the app at localhost port 3000. When deployed on Vercel, authentication happens automatically via OIDC and the gateway key is not required. An AI Gateway API key can be created from the Vercel dashboard.

Screenshot of AI Facts