@truthscan/image-detection
v20260709.0.0
Published
Official TruthScan TypeScript client for AI image detection — presign, upload, detect, and poll for results.
Downloads
438
Maintainers
Readme
TruthScan Image Detection — JavaScript / TypeScript Client
TypeScript client for the TruthScan AI Image Detection API. Detect whether images are AI-generated, real, digitally edited, or AI-edited.
Requirements
- Node.js 18+
- A TruthScan API key (get one here)
Installation
npm install @truthscan/image-detectionQuick start
import { ImageDetectionClient } from '@truthscan/image-detection';
const apiKey = process.env.TRUTHSCAN_API_KEY ?? 'your_api_key_here';
const client = new ImageDetectionClient(apiKey);
const result = await client.detect('/path/to/image.jpg');
console.log('Status:', result.status);
console.log('Score:', result.result ?? 'N/A');
console.log('Final:', result.result_details?.final_result ?? '');detect() runs presign → upload → detect → poll until complete.
Configuration
import {
ImageDetectionClient,
DefaultConsoleLogger,
} from '@truthscan/image-detection';
const client = new ImageDetectionClient(
'YOUR_API_KEY',
undefined, // optional base URL
60, // optional timeout (seconds)
new DefaultConsoleLogger('info')
);API reference
ImageDetectionClient
| Method | Description |
|--------|-------------|
| detect(image, email?, generatePreview?, maxPollAttempts?, pollIntervalSeconds?) | Full workflow: presign, upload, detect, poll. Returns DetectionResult. |
| checkUserCredits() | Returns credit balance for the API key. |
ImageDetectionService (low-level)
For advanced use, import ImageDetectionService and call presign, upload, detect, query, and poll directly.
Supported file formats
JPG, JPEG, PNG, WebP, JFIF, HEIC, HEIF, AVIF, BMP, TIFF, TIF, GIF, SVG, PDF
File size limits: 1 KB – 10 MB
Note: Remove spaces from filenames before uploading.
Development
cd javascript
npm ci
npm run build
npm testLicense
MIT
