Skip to content

JamesShell/ai-content-detector

Repository files navigation

AI Detector logo

AI Content Detector — Chrome Extension

A Chrome extension that checks whether images and text on a web page were likely generated by AI.

Image detection is handled by the Sightengine genai model. Text detection runs a local heuristic algorithm, no external API required.

Screenshots

Extension popup    AI image detection on page

Getting started

npm install
npm run build      # production build
npm run watch      # dev mode, rebuilds on save

Then load the extension in Chrome:

  1. Go to chrome://extensions
  2. Turn on Developer mode (top-right)
  3. Click Load unpacked and select the dist/ folder

Setting up API keys

After loading the extension, click its icon and open Settings from the popup footer. Enter your Sightengine API User and API Secret, then save.

Keys are stored in chrome.storage.sync and only the extension can read them.

Note: Storing API secrets in a browser extension is fine for local development but not suitable for production. In production you should route requests through a backend proxy that holds the credentials server-side.

Moving to production

  1. Set up a backend proxy (Node server, Cloudflare Worker, Lambda, etc.) that attaches the Sightengine credentials and forwards requests.
  2. Update src/config.ts to point at your proxy URL and remove the client-side credential logic from imageDetector.ts.
  3. Add authentication so the proxy only serves requests from your extension.

How it works

popup (UI)
  |  chrome.runtime messages
background (service worker)  <->  Sightengine API / text detector
  |  chrome.tabs messages
content script (DOM access, highlighting)
Module What it does
popup/ Extension popup UI. Triggers scans and displays results.
background.ts Service worker. Coordinates detection and relays messages.
content.ts Injected into pages. Collects content and highlights flagged elements.
services/imageDetector.ts Calls the Sightengine API for image analysis.
services/textDetector.ts TextDetector interface, contract for text detection providers.
services/heuristicTextDetector.ts Built-in heuristic detector using sentence-level statistical signals.
config.ts API credential helpers and endpoint URL.
utils/score.ts Maps raw scores to labels and formats them for display.
utils/dom.ts DOM traversal, text collection, and highlight injection.

Swapping in a different text detector

  1. Create a new file under src/services/ that implements the TextDetector interface.
  2. Import it in src/background.ts instead of HeuristicTextDetector.

License

MIT

About

Chrome extension that detects AI-generated images and text on any web page.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors