开发者文档

API 参考

所有鉴权端点需携带 Authorization: Bearer YOUR_API_KEY 请求头。 Base URL: /api

📊 套餐与限流

套餐价格额度QPS
免费版¥02次/天2
专业版¥29/月500次/月10
专业增强版¥99/月2,000次/月20
API版¥0.1/次按量20

快速开始

# 1. 注册获取 API Key
curl -X POST /api/register \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"YourPass123"}'

# 2. 调用检测(替换 YOUR_API_KEY)
curl -X POST /api/detect \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"DeepSeek由字节跳动开发","strict":false,"domain":"general"}'
POST/register

邮箱注册新用户

请求参数

参数名类型必填说明
emailstring邮箱地址,需符合标准邮箱格式
passwordstring密码,至少8位,需包含字母和数字

请求示例

{
  "email": "email",
  "password": "Test1234"
}

响应示例

{"email": "user@example.com", "api_key": "hc_xxxxxxxxxxxxxxxxx"}

响应字段说明

字段类型说明
emailstring注册的邮箱地址
api_keystringAPI Key,格式 hc_ + 48位hex,仅返回一次,请妥善保存
POST/auth/login

统一登录(手机号或邮箱 + 密码)

请求参数

参数名类型必填说明
accountstring手机号(11位) 或 邮箱地址
passwordstring登录密码

请求示例

{
  "account": "account",
  "password": "Test1234"
}

响应示例

{"email": "user@example.com", "api_key": "hc_xxx", "phone": "13800138000"}
POST/auth/send-code

发送手机验证码

请求参数

参数名类型必填说明
phonestring11位中国大陆手机号,格式 1[3-9]xxxxxxxxx

请求示例

{
  "phone": "phone"
}

响应示例

{"ok": true, "message": "验证码已发送"}
POST/auth/phone-login

手机验证码登录(新用户自动注册)

请求参数

参数名类型必填说明
phonestring11位手机号
codestring6位数字验证码
set_passwordstring新用户需设置密码(≥8位含字母数字),老用户留空

请求示例

{
  "phone": "phone",
  "code": "code",
  "set_password": "Test1234"
}

响应示例

{"phone": "13800138000", "api_key": "hc_xxx", "is_new": true}
POST/auth/forgot-password

申请密码重置

请求参数

参数名类型必填说明
emailstring注册邮箱

请求示例

{
  "email": "email"
}

响应示例

{"ok": true}
POST/auth/reset-password

执行密码重置

请求参数

参数名类型必填说明
tokenstring重置令牌(从邮件或服务器日志获取)
new_passwordstring新密码,≥8位含字母数字

请求示例

{
  "token": "...",
  "new_password": "new_password"
}

响应示例

{"ok": true}
GET/meBearer

当前用户信息和额度

响应示例

{"user_id": 1, "plan": "free", "used": 1, "limit": 2, "remaining": 1}
POST/detectBearer

检测单段文本中的AI幻觉

请求参数

参数名类型必填说明
textstring待检测文本,最大50,000字符,超出部分截断
strictboolean严格模式(自我一致性),每条声明多次判定后投票,更准确但约3倍耗时,默认false
domainstring领域模式: general(通用) | medical(医疗) | legal(法律) | finance(金融),默认general

请求示例

{
  "text": "text",
  "strict": false,
  "domain": "domain"
}

响应示例

{"detection_id":1, "input":"…", "summary":{"total":3,"red":1,"yellow":1,"green":1,"hallucination_risk":0.67}, "claims":[...], "quota":{"remaining":1}, "strict":false, "domain":"general"}

响应字段说明

字段类型说明
detection_idint本次检测ID,用于历史查询和反馈
summary.totalint提取到的声明总数
summary.redint存疑声明数(被判refuted且置信度≥0.8)
summary.yellowint疑似声明数(无法确定)
summary.greenint可信声明数(被判supported)
summary.hallucination_riskfloat幻觉风险指数 0.0~1.0
claims[].claim.textstring提取的原子声明原文
claims[].claim.typestring声明类型: factual(事实) | logical(逻辑) | subjective(主观) | common(常识)
claims[].verification.statusstring判定结果: supported(支持) | refuted(反驳) | unverified(无法核实)
claims[].verification.confidencefloat置信度 0.0~1.0
claims[].verification.sourcesarray搜索来源列表 [{title, url, snippet}]
claims[].correction.correctedstring修正建议文本(仅refuted时有)
POST/detect-streamBearer

SSE 流式检测(逐声明实时推送)

请求参数

参数名类型必填说明
textstring待检测文本
strictboolean严格模式,默认false
domainstring领域模式

请求示例

{
  "text": "text",
  "strict": false,
  "domain": "domain"
}

响应示例

event: claim
data: {"claim_id":1,"text":"...","status":"refuted","confidence":0.92}

event: summary
data: {"total":3,"red":1,...}
POST/batchBearer

批量检测整篇文档(按段拆分)+ 可选自动重写

请求参数

参数名类型必填说明
textstring待检测的完整文档
auto_rewriteboolean是否自动修正未通过段落并重检,默认false
max_iterationsint最大重写轮数(含首轮),1~5,默认3
strictboolean严格模式
domainstring领域模式

请求示例

{
  "text": "text",
  "auto_rewrite": false,
  "max_iterations": 1,
  "strict": false,
  "domain": "domain"
}

响应示例

{"report":{"overall":{"segments":5,"resolved":4,"unresolved":1},"segments":[...]}}
POST/source-checkBearer

源文档对照:检测AI摘要是否忠于源文档

请求参数

参数名类型必填说明
sourcestring源文档原文,最大50,000字符
summarystringAI生成的摘要文本,最大20,000字符
domainstring领域模式

请求示例

{
  "source": "source",
  "summary": "summary",
  "domain": "domain"
}

响应示例

{"report":{"summary":{"total":5,"red":0,"yellow":1,"green":4,"faithfulness":0.8},"claims":[...]}}
POST/billing/ordersBearer

创建支付订单

请求参数

参数名类型必填说明
planstring套餐: pro(¥29/月) | pro99(¥99/月) | api(¥0.1/次)
providerstring支付方式: wxpay | alipay
periodstring周期: month(默认) | year(年付=10个月)

请求示例

{
  "plan": "plan",
  "provider": "provider",
  "period": "period"
}

响应示例

{"order_id":1,"plan":"pro","amount":2900,"provider":"wxpay","status":"pending","qr_code":"...","pay_url":"..."}
GET/billing/subscriptionBearer

当前订阅状态

响应示例

{"subscribed":true,"plan":"pro","status":"active","current_period_end":"2026-08-22"}
GET/historyBearer

最近检测列表

请求参数

参数名类型必填说明
limitint返回条数,默认20

响应示例

{"items":[{"id":1,"input":"...","llm_calls":3,"search_calls":1,"created_at":"2026-07-27"}]}
GET/history/{id}Bearer

某次检测的完整结果

响应示例

{"id":1,"input":"...","result":{"summary":{...},"claims":[...]}}
GET/detect/{id}/exportBearer

导出检测结果JSON

请求参数

参数名类型必填说明
fmtstring格式,默认json

响应示例

导出文件: hallucc-result-{id}.json
POST/feedbackBearer

对声明标记准/不准

请求参数

参数名类型必填说明
detection_idint检测ID
claim_idint声明ID
labelstringup(准) | down(不准)

请求示例

{
  "detection_id": 1,
  "claim_id": 1,
  "label": "label"
}

响应示例

{"ok": true}
GET/health

健康检查

响应示例

{"status":"ok","search_backend":"qianfan","llm_provider":"deepseek","redis":"connected"}
GET/models

可用LLM模型列表

响应示例

{"active":"deepseek","providers":[{"name":"deepseek","default_model":"deepseek-chat","active":true},...]}
GET/domains

可用领域模式

响应示例

{"active":"general","domains":[{"key":"general","name":"通用"},{"key":"medical","name":"医疗"},...]}