AI Image Detection API — Client SDKs
Official client libraries for TruthScan AI Image Detection. Detect whether images are AI-generated, real, digitally edited, or AI-edited in a single method call.
Python SDK
Official Python client for TruthScan AI Image Detection. Detect whether images are AI-generated, real, digitally edited, or AI-edited in a single method call.
Requirements
| Requirement | Details |
|---|---|
| Python | 3.9 or later |
| Dependency | pip install truthscan-image-detector-client |
| API Key | Set environment variable TRUTHSCAN_API_KEY to your key |
Download
| Package | truthscan-image-detector-client |
| Registry | https://pypi.org/project/truthscan-image-detector-client/ |
Install the latest version — check the registry link above for the current release number.
Install
pip install truthscan-image-detector-clientRun Image Detection
Call client.detect() with an image path. The method handles presign, upload, detection, and polling automatically — it blocks until the result is ready.
import os
from truthscan.image_detection import ImageDetectionClient
# Load API key from environment
api_key = os.environ.get("TRUTHSCAN_API_KEY", "your_api_key_here")
client = ImageDetectionClient(api_key=api_key)
# Run full detection workflow
result = client.detect("path/to/image.jpg")
print(f"Status : {result['status']}")
print(f"Score : {result.get('result', 'N/A')}")
print(f"Final : {(result.get('result_details') or {}).get('final_result', '')}")JavaScript / TypeScript SDK
Official TypeScript/JavaScript client for TruthScan AI Image Detection. Works in any Node.js project and ships with full TypeScript type declarations.
Requirements
| Requirement | Details |
|---|---|
| Node.js | 18 or later |
| Package Manager | npm, yarn, or pnpm |
| API Key | Set environment variable TRUTHSCAN_API_KEY to your key |
Download
| Package | @truthscan/image-detection |
| Registry | https://www.npmjs.com/package/@truthscan/image-detection |
Install the latest version — check the registry link above for the current release number.
Install
npm install @truthscan/image-detectionRun Image Detection
Call client.detect() with an image path. The method handles presign, upload, detect, and poll — it resolves the Promise when the result is ready.
import { ImageDetectionClient } from '@truthscan/image-detection';
// Load API key from environment
const apiKey = process.env.TRUTHSCAN_API_KEY ?? 'your_api_key_here';
const client = new ImageDetectionClient(apiKey);
// Run full detection workflow
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 ?? '');PHP SDK
Official PHP client for TruthScan AI Image Detection. Compatible with PHP 7.4+ and installable via Composer.
Requirements
| Requirement | Details |
|---|---|
| PHP | 7.4 or later |
| Extension | curl (must be enabled) |
| API Key | Set environment variable TRUTHSCAN_API_KEY to your key |
Download
| Package | truthscan/image-detector-client |
| Registry | https://packagist.org/packages/truthscan/image-detector-client |
Install the latest version — check the registry link above for the current release number.
Install
composer require truthscan/image-detector-clientRun Image Detection
Call $client->detect() with an image path. The method handles presign, upload, detect, and polling — it returns when the result is ready.
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Truthscan\ImageDetection\ImageDetectionClient;
// Load API key from environment
$apiKey = getenv('TRUTHSCAN_API_KEY') ?: 'your_api_key_here';
$client = new ImageDetectionClient($apiKey);
// Run full detection workflow
$result = $client->detect('/path/to/image.jpg');
echo "Status : {$result->status}\n";
echo 'Score : ' . ($result->result ?? 'N/A') . "\n";
echo 'Final : ' . ($result->result_details->final_result ?? '') . "\n";.NET SDK
Official .NET client for TruthScan AI Image Detection. Available on NuGet and compatible with modern .NET projects.
Requirements
| Requirement | Details |
|---|---|
| .NET | See NuGet page for supported target frameworks |
| Tool | .NET CLI or Visual Studio NuGet Package Manager |
| API Key | Set environment variable TRUTHSCAN_API_KEY to your key |
Download
| Package | Truthscan.ImageDetection |
| Registry | https://www.nuget.org/packages/Truthscan.ImageDetection/ |
Install the latest version — check the registry link above for the current release number.
Install
dotnet add package Truthscan.ImageDetectionOr add to your .csproj project file
<PackageReference Include="Truthscan.ImageDetection" Version="LATEST_VERSION" />Run Image Detection
Call await client.Detect() with an image path. The method handles presign, upload, detect, and polling — it completes when the result is ready.
using Truthscan.ImageDetection;
// Load API key from environment
var apiKey = Environment.GetEnvironmentVariable("TRUTHSCAN_API_KEY")
?? "YOUR_API_KEY";
var client = new ImageDetectionClient(apiKey);
// Run full detection workflow
var result = await client.Detect("/path/to/image.jpg");
Console.WriteLine($"Status : {result.Status}");
Console.WriteLine($"Score : {result.Result}");
Console.WriteLine($"Final : {result.ResultDetails?.FinalResult}");Java SDK
Official Java client for TruthScan AI Image Detection. Available on Maven Central and compatible with Java 11+. Use detectImage() for a single call that runs the full workflow.
Requirements
| Requirement | Details |
|---|---|
| Java | 11 or later |
| Build Tool | Maven or Gradle |
| API Key | Set environment variable TRUTHSCAN_API_KEY to your key |
Download
| Package | com.truthscan:ai-image-detector-client |
| Registry | https://central.sonatype.com/artifact/com.truthscan/ai-image-detector-client |
Install the latest version — check the registry link above for the current release number.
Install
Maven (pom.xml)
<dependency>
<groupId>com.truthscan</groupId>
<artifactId>ai-image-detector-client</artifactId>
<version>LATEST_VERSION</version>
</dependency>Gradle (build.gradle)
implementation 'com.truthscan:ai-image-detector-client:LATEST_VERSION'Run Image Detection
Call client.detectImage() with a File reference. The method handles presign, upload, detect, and polling — it returns when the result is ready. Always call client.close() when finished.
import com.truthscan.imageDetection.*;
import java.io.File;
// Load API key from environment
String apiKey = System.getenv("TRUTHSCAN_API_KEY");
ImageDetectionClient client = new ImageDetectionClient(apiKey);
// Run full detection workflow
DetectionResult result = client.detectImage(new File("photo.jpg"));
System.out.println("Result : " + result.getFinalResult());
System.out.println("Score : " + result.getResult());
// Always close the client when done
client.close();