Skip to main content

Overview

Analyze an image to determine if it was generated by AI. The endpoint uses an ensemble of 5 specialized detection models to provide accurate results.

Request

Method: POST Path: /api/detect Auth: X-Api-Key: <API_KEY> Content-Type: application/json Cost: 1 credit per detection

Request Body

image
string
required
Base64-encoded image data (JPG, PNG, or WebP)
If true, the image is stored for research purposes to improve detection accuracy

Examples

from bijou import BijouClient

client = BijouClient(api_key="bijou_your-key")

# From file path
result = client.detect("path/to/image.jpg")

# From bytes
with open("image.jpg", "rb") as f:
    result = client.detect(f.read())

print(f"Prediction: {result.prediction}")
print(f"Confidence: {result.confidence:.1%}")
print(f"Verdict: {result.verdict}")

Response

prediction
string
required
Detection result: "ai", "real", or "uncertain"
confidence
number
required
Confidence score from 0.0 to 1.0
ensemble_score
number
required
Weighted average score from all models (0.0 to 1.0)
verdict
string
required
Human-readable verdict: "ai_generated", "likely_real", or "uncertain"
models_succeeded
number
required
Number of models that successfully processed the image
models_total
number
required
Total number of models in the ensemble (currently 5)
model_results
object
required
Individual results from each detection model
detection_latency_ms
number
required
Total detection time in milliseconds
stored
boolean
required
Whether the image was stored for research (only true if consent: true)

Example Response

{
  "statusCode": 200,
  "body": {
    "data": {
      "prediction": "ai",
      "confidence": 0.87,
      "ensemble_score": 0.87,
      "verdict": "ai_generated",
      "models_succeeded": 5,
      "models_total": 5,
      "model_results": {
        "aeroblade": {
          "score": 0.92,
          "latency_ms": 145
        },
        "univfd": {
          "score": 0.88,
          "latency_ms": 132
        },
        "npr": {
          "score": 0.79,
          "latency_ms": 98
        },
        "fire": {
          "score": 0.91,
          "latency_ms": 156
        },
        "cnnspot": {
          "score": 0.82,
          "latency_ms": 112
        }
      },
      "detection_latency_ms": 523,
      "stored": false,
      "s3_key": null,
      "research_image_key": null,
      "research_result_key": null
    }
  }
}

Verdict Interpretation

Ensemble ScoreVerdictMeaning
>= 0.7ai_generatedHigh confidence the image is AI-generated
0.4 - 0.7uncertainInconclusive - may need manual review
< 0.4likely_realHigh confidence the image is authentic

Error Responses

{
  "statusCode": 400,
  "body": {
    "error": "Invalid base64 image"
  }
}

Handling Errors

from bijou import BijouClient, BijouInsufficientCreditsError

client = BijouClient(api_key="bijou_your-key")

try:
    result = client.detect("image.jpg")
except BijouInsufficientCreditsError:
    print("You're out of credits! Buy more at trybijou.com/profile")

Limits

LimitValue
Max image size10 MB
Supported formatsJPG, PNG, WebP
Rate limit100 requests/minute
Cost1 credit per detection