使用 CamScanner 检测图片是否由 AI 模型生成(如 Stable Diffusion、Midjourney、DALL·E)。基于 AIGC 检测引擎,能够...
CamScanner provides an AIGC-detection engine that determines whether an image was produced by an AI generator. The workflow is a 2-step pipeline: upload the image, then validate it with validate_mode: 2. Unlike conversion skills, this skill does not produce a file — the validate step returns a JSON result whose key fields ( ai_check_result, confidence, result_text) should be reported back to the user directly.
ai_check_result, confidence, and result_text from the response and report them in plain language.ai_check_result to a verdict: 1 = not AI-generated, 2 = suspected AI-generated, 3 = AI-generated.confidence value (a float in [0, 1]) so the user understands how certain the verdict is.result_text is returned in Chinese by the API. If the user asked in English (or any other language), translate/rephrase it into that language. If the user asked in Chinese, you can use result_text as-is.Important: Privacy & Data Flow Notice
- Third-party service: This skill sends your files to CamScanner's official servers (
ai-tools.camscanner.com) for processing.- Data retention: CamScanner servers process your files in real-time. Files are not permanently stored on the server.
- Result: Only a JSON detection result is returned — no file is downloaded.
Base URL: https://ai-tools.camscanner.com
source_typevalidate_modeDetectionEngineimage2AIGC (AI-generated)aigcdetection
bash
BASE="https://ai-tools.camscanner.com"
IN_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/upload_file/execute" \
-H "Content-Type: application/octet-stream" \
--data-binary "@/path/to/image.jpg" | jq -r '.tool_result.data.file_id')
Response:
json
{
"code": 200,
"tool": "upload_file",
"tool_result": {
"success": true,
"data": {
"file_id": "file_1741857600_ab12cd34ef56.jpg",
"size": 24576
}
}
}
bash
curl -sS -X POST "$BASE/v1/tools/validate_image/execute" \
-H "Content-Type: application/json" \
-d "{\"file_id\":\"$IN_FILE_ID\",\"validate_mode\":2}"
Response (suspected AI-generated example):
json
{
"code": 200,
"tool": "validate_image",
"tool_result": {
"success": true,
"data": {
"ai_check_result": 2,
"confidence": 0.346435546875,
"engine": "aigcdetection",
"file_id": "file_xxx.jpg",
"result_text": "检测结果为疑似 AI 生成图片",
"review_state": "auto_checked",
"validate_mode": 2
},
"metadata": {
"ai_check_result": 2,
"confidence": 0.346435546875,
"engine": "aigcdetection",
"result_text": "检测结果为疑似 AI 生成图片",
"review_state": "auto_checked",
"validate_mode": 2
}
}
}
FieldTypeMeaningai_check_resultinteger1 = not AI-generated, 2 = suspected AI-generated, 3 = AI-generatedconfidencefloatModel confidence score in [0, 1]``result_textstringHuman-readable conclusion (Chinese by default — translate for other languages)review_statestringReview status (e.g. auto_checked) — informational, not user-facingvalidate_modeintegerEcho of the requested mode (always 2 for AIGC detection)
ai_check_resultVerdictSuggested phrasing (EN)1Not AI-generated"Looks like a real image"2Suspected AI-generated"Suspected to be AI-generated"3AI-generated"Detected as AI-generated"
Detect whether an image is AI-generated (two-step, reads JSON result):
bash
BASE="https://ai-tools.camscanner.com"
INPUT_IMAGE="/path/to/image.jpg"
# Upload
IN_FILE_ID=$(curl -sS -X POST "$BASE/v1/tools/upload_file/execute" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$INPUT_IMAGE" | jq -r '.tool_result.data.file_id')
# Validate and extract key fields
RESULT=$(curl -sS -X POST "$BASE/v1/tools/validate_image/execute" \
-H "Content-Type: application/json" \
-d "{\"file_id\":\"$IN_FILE_ID\",\"validate_mode\":2}")
AI_CHECK=$(echo "$RESULT" | jq -r '.tool_result.data.ai_check_result')
CONFIDENCE=$(echo "$RESULT" | jq -r '.tool_result.data.confidence')
RESULT_TEXT=$(echo "$RESULT" | jq -r '.tool_result.data.result_text')
echo "ai_check_result: $AI_CHECK"
echo "confidence: $CONFIDENCE"
echo "result_text: $RESULT_TEXT"
MistakeFixWrong Content-Type on uploadUpload uses application/octet-stream, not multipart/form-dataUsing GET instead of POSTBoth endpoints use POSTPassing validate_mode as a stringvalidate_mode is an integer — use 2, not "2"Including output_mode in the requestvalidate_image does not use output_mode; it always returns JSONTreating ai_check_result as booleanIt is a 3-state integer ( 1/ 2/ 3); map explicitly to a verdictReporting "suspected" as "AI-generated"ai_check_result == 2 means suspected, not confirmed — phrase accordinglyReporting result_text verbatim in ENresult_text is Chinese; translate to match the user's language
Check each step before proceeding:
bash
# After upload
if [ -z "$IN_FILE_ID" ] || [ "$IN_FILE_ID" = "null" ]; then
echo "Upload failed"; exit 1
fi
# After validate
if [ "$AI_CHECK" = "null" ] || [ -z "$AI_CHECK" ]; then
echo "Validation failed"; exit 1
fi