Offline captcha Recognizer for Node.js. Runs a bundled ONNX model in-process — not a third-party captcha-solving API.
This package targets one fixed image class (noise, gradient, crossing line) — not reCAPTCHA or arbitrary OCR.
ChallengeText for the sample above: 43wpp (exactly 5 characters from [a-z0-9]).
npm install @fennr/captcha-recognizerRequires Node.js ≥ 20. Pulls native dependencies (onnxruntime-node, sharp).
Install under a short local name without publishing a second package:
npm install fcr@npm:@fennr/captcha-recognizerimport { recognize, createRecognizer } from "fcr";import { readFile } from "node:fs/promises";
import { recognize, createRecognizer } from "@fennr/captcha-recognizer";
// one-shot
const text = await recognize(await readFile("captcha.png"));
console.log(text); // e.g. "43wpp"
// reuse a session
const recognizer = await createRecognizer();
try {
const again = await recognizer.recognize(await readFile("captcha.png"));
console.log(again);
} finally {
await recognizer.dispose();
}CLI (after build / from the repo):
npm run build
npm run recognize -- path/to/image.png- Tuned for one fixed captcha image class (see sample above).
- Expected text: exactly 5 characters from
[a-z0-9]. - Not a general-purpose OCR engine.
- Not a hosted solving service — everything runs locally with the shipped model.
Invalid or unrecognized output raises RecognitionError.
Weights are derived from the public Keras captcha-recognition approach documented in krishnatherokar/captcha-recognition on Kaggle, exported to models/captcha.onnx for ONNX Runtime.
MIT — see LICENSE.
