通过我们的API接口,将多平台AI检测对比功能集成到您的应用中
AI检测率对比工具API允许开发者将我们的多平台AI内容检测对比功能集成到自己的应用、网站或服务中。通过API,您可以程序化地提交文本进行检测,并获取多个主流AI检测平台的结果对比数据。
当前API版本: v1
以下是一个简单的API调用示例,展示如何获取支持的检测平台列表:
curl -X GET "https://api.aidetectiontool.com/v1/tools" \ -H "X-API-Key: your_api_key_here"
成功的响应将返回所有支持的检测平台及其相关信息。
AI检测率对比工具API使用API密钥进行身份验证。所有API请求都需要包含有效的API密钥,否则请求将被拒绝。
要获取API密钥,请按照以下步骤操作:
在所有API请求中,通过HTTP头信息传递您的API密钥:
X-API-Key: your_api_key_here
重要提示:请保护好您的API密钥,不要在客户端代码中暴露API密钥,避免滥用。
https://api.aidetectiontool.com/v1/tools
返回所有支持的AI检测平台列表及其详细信息。
无查询参数
{
"success": true,
"data": [
{
"id": "originality_ai",
"name": "Originality.ai",
"description": "专注于AI生成内容检测的专业平台",
"accuracy_rating": 4.7,
"supported_languages": ["en", "zh", "ja", "de"],
"last_updated": "2024-05-15T08:30:00Z"
},
{
"id": "zero_gpt",
"name": "ZeroGPT",
"description": "免费的AI内容检测工具",
"accuracy_rating": 4.2,
"supported_languages": ["en", "zh", "es", "fr"],
"last_updated": "2024-05-10T14:20:00Z"
}
// 更多检测工具...
]
}
https://api.aidetectiontool.com/v1/detect
提交文本内容进行多平台AI检测,并获取检测结果。
| 参数名 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| text | string | 是 | 需要检测的文本内容,建议长度不少于200字符 |
| tools | array | 否 | 指定要使用的检测平台ID列表,不指定则使用所有支持的平台 |
| mode | string | 否 | 检测模式,"sync"为同步模式(默认),"async"为异步模式 |
{
"text": "人工智能(AI)是计算机科学的一个分支,它致力于创造能够模拟人类智能的系统。这些系统可以学习、推理、自适应,并执行通常需要人类智能才能完成的任务。人工智能的发展已经在许多领域产生了深远影响,包括医疗保健、金融、交通和教育等。",
"tools": ["originality_ai", "zero_gpt", "grammarly"],
"mode": "sync"
}
{
"success": true,
"request_id": "req-1234567890abcdef",
"detected_at": "2024-05-20T15:30:45Z",
"text_length": 385,
"results": [
{
"tool_id": "originality_ai",
"tool_name": "Originality.ai",
"ai_detected": true,
"ai_percentage": 78.5,
"confidence": "high",
"analysis": "文本包含明显的AI生成特征,尤其是在句式结构和术语使用方面"
},
{
"tool_id": "zero_gpt",
"tool_name": "ZeroGPT",
"ai_detected": true,
"ai_percentage": 62.3,
"confidence": "medium",
"analysis": "检测到部分内容可能由AI生成"
},
{
"tool_id": "grammarly",
"tool_name": "Grammarly AI检测",
"ai_detected": false,
"ai_percentage": 15.8,
"confidence": "low",
"analysis": "未检测到明显的AI生成特征"
}
],
"summary": {
"average_ai_percentage": 52.2,
"highest_ai_percentage": 78.5,
"lowest_ai_percentage": 15.8,
"ai_detected_count": 2,
"total_tools_used": 3
}
}
https://api.aidetectiontool.com/v1/results/{request_id}
当使用异步模式提交检测请求后,通过此端点查询检测结果。
| 参数名 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
| request_id | string | 是 | 检测请求的ID,从提交请求的响应中获取 |
{
"success": true,
"request_id": "req-1234567890abcdef",
"status": "processing",
"progress": 65,
"message": "检测正在进行中,请稍后查询结果",
"started_at": "2024-05-20T15:30:45Z"
}
{
"success": true,
"request_id": "req-1234567890abcdef",
"status": "completed",
"detected_at": "2024-05-20T15:32:10Z",
"text_length": 385,
"results": [
// 检测结果,格式与同步模式相同
],
"summary": {
// 结果摘要,格式与同步模式相同
}
}
所有API响应均采用JSON格式。成功的响应将包含一个success: true字段,以及相关的响应数据。
{
"success": true,
"data": {
// 响应数据,根据不同端点有所不同
}
}
{
"success": false,
"error": {
"code": "ERROR_CODE",
"message": "人类可读的错误信息",
"details": {
// 可选的错误详情
}
}
}
| HTTP状态码 | 错误代码 | 描述 |
|---|---|---|
| 401 | INVALID_API_KEY | API密钥无效或未提供 |
| 403 | ACCESS_DENIED | 没有访问请求资源的权限 |
| 404 | RESOURCE_NOT_FOUND | 请求的资源不存在 |
| 400 | INVALID_REQUEST | 请求参数无效或不完整 |
| 429 | RATE_LIMIT_EXCEEDED | 超出API速率限制 |
| 500 | INTERNAL_ERROR | 服务器内部错误 |
| 503 | SERVICE_UNAVAILABLE | 服务暂时不可用 |
为了确保API服务的稳定性和公平使用,我们实施了速率限制。不同的API计划有不同的速率限制:
适合开发者测试和小型项目
适合中小型企业应用
适合大型企业和高流量应用
API响应头中包含速率限制信息,帮助您监控和调整请求频率:
X-RateLimit-Limit: 1000 # 每天最大请求数 X-RateLimit-Remaining: 850 # 剩余请求数 X-RateLimit-Reset: 1621507200 # 限制重置的时间戳(UTC)
import requests
import json
API_KEY = 'your_api_key_here'
API_URL = 'https://api.aidetectiontool.com/v1/detect'
headers = {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
}
data = {
'text': '人工智能(AI)是计算机科学的一个分支...',
'tools': ['originality_ai', 'zero_gpt'],
'mode': 'sync'
}
response = requests.post(API_URL, headers=headers, json=data)
result = response.json()
if result['success']:
print(f"检测完成,平均AI概率: {result['summary']['average_ai_percentage']}%")
for tool_result in result['results']:
print(f"{tool_result['tool_name']}: {tool_result['ai_percentage']}% AI生成概率")
else:
print(f"检测失败: {result['error']['message']}")
const API_KEY = 'your_api_key_here';
const API_URL = 'https://api.aidetectiontool.com/v1/detect';
async function detectAI() {
try {
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: '人工智能(AI)是计算机科学的一个分支...',
tools: ['originality_ai', 'zero_gpt'],
mode: 'sync'
})
});
const result = await response.json();
if (result.success) {
console.log(`检测完成,平均AI概率: ${result.summary.average_ai_percentage}%`);
result.results.forEach(toolResult => {
console.log(`${toolResult.tool_name}: ${toolResult.ai_percentage}% AI生成概率`);
});
} else {
console.error(`检测失败: ${result.error.message}`);
}
} catch (error) {
console.error('请求出错:', error);
}
}
// 调用检测函数
detectAI();
<?php
$apiKey = 'your_api_key_here';
$apiUrl = 'https://api.aidetectiontool.com/v1/detect';
$headers = [
'X-API-Key: ' . $apiKey,
'Content-Type: application/json'
];
$data = [
'text' => '人工智能(AI)是计算机科学的一个分支...',
'tools' => ['originality_ai', 'zero_gpt'],
'mode' => 'sync'
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if ($result['success']) {
echo "检测完成,平均AI概率: " . $result['summary']['average_ai_percentage'] . "%\n";
foreach ($result['results'] as $toolResult) {
echo $toolResult['tool_name'] . ": " . $toolResult['ai_percentage'] . "% AI生成概率\n";
}
} else {
echo "检测失败: " . $result['error']['message'] . "\n";
}
?>