AI-Generated Image Detection
genaiDetect if an image was generated by an AI model such as Nano Banana, Seedream, Stable Diffusion, GPT, MidJourney, Flux, Firefly and more.
Overview
The AI-Generated Image Detection Model can help you determine if an image was entirely generated by an AI model, or if it is a real image. This model was trained on millions of artificially-created and human-created images spanning all sorts of content such as photography, art, drawings, memes and more.
The Model works by analyzing the visual (pixel) content of the image. No meta-data is used in the analysis. Tampering with meta-data such as EXIF data therefore has no effect on the scoring.
The Model was trained to detect images generated by the main models currently in use: Nano Banana, GPT-image, Stable Diffusion, MidJourney, Firefly, Flux, Reve, Recraft, Imagen, Ideogram, GANs... Additional models will be added over time as they become available.
Use cases
- Tag AI-generated imagery as such, to limit the spread of misinformation and fake news
- Implement stricter moderation rules on AI-generated imagery
- Detect potential fraud with fake ids, fake profiles or fake claims
- Limit ai-generated spam
- Enact bans on AI-generated imagery
Related model
The following 3 models can provide a useful complement to the AI-generated image detection model:
- Deepfake Detection: Detect swapped or modified faces.
- Type Detection: Detect if an image is a photography or an illustration.
- AI Video Detection: Detect AI-generated videos.
Examples
AI-generated images

Stable Diffusion

MidJourney

Firefly

DALL-E 3

Ideogram

Flux

Kling

SeeDream

GPT

Nano Banana Pro

StyleGan2 (thispersondoesnotexist)
Use the model
If you haven't already, create an account to get your own API keys.
Detect if an image was AI-generated
Let's say you want to check the following image:
You can either send the image URL, or upload the raw binary image.
Option 1: Send image URL
Here's how to proceed if you choose to share the image URL:
curl -X GET -G 'https://api.sightengine.com/1.0/check.json' \
-d 'models=genai' \
-d 'api_user={api_user}&api_secret={api_secret}' \
--data-urlencode 'url=https://sightengine.com/assets/img/examples/example-prop-c1.jpg'
# this example uses requests
import requests
import json
params = {
'url': 'https://sightengine.com/assets/img/examples/example-prop-c1.jpg',
'models': 'genai',
'api_user': '{api_user}',
'api_secret': '{api_secret}'
}
r = requests.get('https://api.sightengine.com/1.0/check.json', params=params)
output = json.loads(r.text)
$params = array(
'url' => 'https://sightengine.com/assets/img/examples/example-prop-c1.jpg',
'models' => 'genai',
'api_user' => '{api_user}',
'api_secret' => '{api_secret}',
);
// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/check.json?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
$output = json_decode($response, true);
// this example uses axios
const axios = require('axios');
axios.get('https://api.sightengine.com/1.0/check.json', {
params: {
'url': 'https://sightengine.com/assets/img/examples/example-prop-c1.jpg',
'models': 'genai',
'api_user': '{api_user}',
'api_secret': '{api_secret}',
}
})
.then(function (response) {
// on success: handle response
console.log(response.data);
})
.catch(function (error) {
// handle error
if (error.response) console.log(error.response.data);
else console.log(error.message);
});
See request parameter description
| Parameter | Type | Description |
| url | string | URL of the image to analyze |
| models | string | comma-separated list of models to apply |
| api_user | string | your API user id |
| api_secret | string | your API secret |
Option 2: Send raw image
Here's how to proceed if you choose to upload the raw image:
curl -X POST 'https://api.sightengine.com/1.0/check.json' \
-F 'media=@/path/to/image.jpg' \
-F 'models=genai' \
-F 'api_user={api_user}' \
-F 'api_secret={api_secret}'
# this example uses requests
import requests
import json
params = {
'models': 'genai',
'api_user': '{api_user}',
'api_secret': '{api_secret}'
}
files = {'media': open('/path/to/image.jpg', 'rb')}
r = requests.post('https://api.sightengine.com/1.0/check.json', files=files, data=params)
output = json.loads(r.text)
$params = array(
'media' => new CurlFile('/path/to/image.jpg'),
'models' => 'genai',
'api_user' => '{api_user}',
'api_secret' => '{api_secret}',
);
// this example uses cURL
$ch = curl_init('https://api.sightengine.com/1.0/check.json');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = curl_exec($ch);
curl_close($ch);
$output = json_decode($response, true);
// this example uses axios and form-data
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
data = new FormData();
data.append('media', fs.createReadStream('/path/to/image.jpg'));
data.append('models', 'genai');
data.append('api_user', '{api_user}');
data.append('api_secret', '{api_secret}');
axios({
method: 'post',
url:'https://api.sightengine.com/1.0/check.json',
data: data,
headers: data.getHeaders()
})
.then(function (response) {
// on success: handle response
console.log(response.data);
})
.catch(function (error) {
// handle error
if (error.response) console.log(error.response.data);
else console.log(error.message);
});
See request parameter description
| Parameter | Type | Description |
| media | file | image to analyze |
| models | string | comma-separated list of models to apply |
| api_user | string | your API user id |
| api_secret | string | your API secret |
Response
The API will then return a JSON response with the ai_generated score. This score is a float between 0 and 1. The higher the value, the higher the confidence that the image is AI-generated:
{
"status": "success",
"request": {
"id": "req_0zrbHDeitGYY7wEGncAne",
"timestamp": 1491402308.4762,
"operations": 5
},
"type": {
"ai_generated": 0.01
},
"media": {
"id": "med_0zrbk8nlp4vwI5WxIqQ4u",
"uri": "https://sightengine.com/assets/img/examples/example-prop-c2.jpg"
}
}