pangram provides an Emacs interface to the Pangram Labs API (v3) for detecting AI-generated content in text. Given a buffer or an active region, the package sends the text to Pangram's inference endpoint and visually highlights segments that the API classifies as AI-generated or AI-assisted, using distinct overlay faces. Human-written segments are left unmarked.
The core workflow is straightforward: invoke M-x pangram-detect to analyze text, then hover over highlighted segments to see classification details (label, confidence score, and AI assistance score) in the echo area. After analysis, a summary line shows the overall verdict and the percentage breakdown across AI-generated, AI-assisted, and human categories. When you are done reviewing, invoke M-x pangram-clear to remove the overlays.
The package recognizes three segment categories: AI-generated (highlighted with a red-tinted background), AI-assisted (highlighted with an amber-tinted background), and Human (not highlighted). Both faces adapt to light and dark backgrounds automatically.
pangram requires Emacs 29.1 or later. All dependencies (json, url, auth-source-pass, seq) are built-in Emacs libraries.
Before using the package, you need:
- A Pangram Labs API key (sign up at pangram.com).
- The
passpassword manager withauth-source-passconfigured in Emacs. - The environment variable
PERSONAL_EMAILset to the email associated with your Pangram account.
Store your API key in the pass store under chrome/pangram.com/YOUR_EMAIL, with the key in a field named key.
(use-package pangram
:vc (:url "https://github.com/benthamite/pangram"))(use-package pangram
:ensure (:host github :repo "benthamite/pangram"))(use-package pangram
:straight (:host github :repo "benthamite/pangram"))(use-package pangram
:ensure (pangram :host github :repo "benthamite/pangram")
:commands (pangram-detect pangram-clear))
;; If your shell does not export PERSONAL_EMAIL to Emacs:
(setenv "PERSONAL_EMAIL" "user@example.com")Select a region of text (or leave the whole buffer unselected) and run M-x pangram-detect. Hover over highlighted segments to inspect their classification, then run M-x pangram-clear when done.
For a comprehensive description of all user options, commands, and functions, see the manual.
pangram is free software distributed under the terms of the GNU General Public License, version 3 or later.