开发者文档
API 参考
所有鉴权端点需携带 Authorization: Bearer YOUR_API_KEY 请求头。 Base URL: /api
📊 套餐与限流
| 套餐 | 价格 | 额度 | QPS |
|---|---|---|---|
| 免费版 | ¥0 | 2次/天 | 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邮箱注册新用户
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ● | 邮箱地址,需符合标准邮箱格式 | |
| password | string | ● | 密码,至少8位,需包含字母和数字 |
请求示例
{
"email": "email",
"password": "Test1234"
}响应示例
{"email": "user@example.com", "api_key": "hc_xxxxxxxxxxxxxxxxx"}响应字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| string | 注册的邮箱地址 | |
| api_key | string | API Key,格式 hc_ + 48位hex,仅返回一次,请妥善保存 |
POST
/auth/login统一登录(手机号或邮箱 + 密码)
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| account | string | ● | 手机号(11位) 或 邮箱地址 |
| password | string | ● | 登录密码 |
请求示例
{
"account": "account",
"password": "Test1234"
}响应示例
{"email": "user@example.com", "api_key": "hc_xxx", "phone": "13800138000"}POST
/auth/send-code发送手机验证码
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| phone | string | ● | 11位中国大陆手机号,格式 1[3-9]xxxxxxxxx |
请求示例
{
"phone": "phone"
}响应示例
{"ok": true, "message": "验证码已发送"}POST
/auth/phone-login手机验证码登录(新用户自动注册)
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| phone | string | ● | 11位手机号 |
| code | string | ● | 6位数字验证码 |
| set_password | string | ○ | 新用户需设置密码(≥8位含字母数字),老用户留空 |
请求示例
{
"phone": "phone",
"code": "code",
"set_password": "Test1234"
}响应示例
{"phone": "13800138000", "api_key": "hc_xxx", "is_new": true}POST
/auth/forgot-password申请密码重置
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| string | ● | 注册邮箱 |
请求示例
{
"email": "email"
}响应示例
{"ok": true}POST
/auth/reset-password执行密码重置
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| token | string | ● | 重置令牌(从邮件或服务器日志获取) |
| new_password | string | ● | 新密码,≥8位含字母数字 |
请求示例
{
"token": "...",
"new_password": "new_password"
}响应示例
{"ok": true}GET
/meBearer当前用户信息和额度
响应示例
{"user_id": 1, "plan": "free", "used": 1, "limit": 2, "remaining": 1}POST
/detectBearer检测单段文本中的AI幻觉
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | string | ● | 待检测文本,最大50,000字符,超出部分截断 |
| strict | boolean | ○ | 严格模式(自我一致性),每条声明多次判定后投票,更准确但约3倍耗时,默认false |
| domain | string | ○ | 领域模式: 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_id | int | 本次检测ID,用于历史查询和反馈 |
| summary.total | int | 提取到的声明总数 |
| summary.red | int | 存疑声明数(被判refuted且置信度≥0.8) |
| summary.yellow | int | 疑似声明数(无法确定) |
| summary.green | int | 可信声明数(被判supported) |
| summary.hallucination_risk | float | 幻觉风险指数 0.0~1.0 |
| claims[].claim.text | string | 提取的原子声明原文 |
| claims[].claim.type | string | 声明类型: factual(事实) | logical(逻辑) | subjective(主观) | common(常识) |
| claims[].verification.status | string | 判定结果: supported(支持) | refuted(反驳) | unverified(无法核实) |
| claims[].verification.confidence | float | 置信度 0.0~1.0 |
| claims[].verification.sources | array | 搜索来源列表 [{title, url, snippet}] |
| claims[].correction.corrected | string | 修正建议文本(仅refuted时有) |
POST
/detect-streamBearerSSE 流式检测(逐声明实时推送)
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | string | ● | 待检测文本 |
| strict | boolean | ○ | 严格模式,默认false |
| domain | string | ○ | 领域模式 |
请求示例
{
"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批量检测整篇文档(按段拆分)+ 可选自动重写
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| text | string | ● | 待检测的完整文档 |
| auto_rewrite | boolean | ○ | 是否自动修正未通过段落并重检,默认false |
| max_iterations | int | ○ | 最大重写轮数(含首轮),1~5,默认3 |
| strict | boolean | ○ | 严格模式 |
| domain | string | ○ | 领域模式 |
请求示例
{
"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摘要是否忠于源文档
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| source | string | ● | 源文档原文,最大50,000字符 |
| summary | string | ● | AI生成的摘要文本,最大20,000字符 |
| domain | string | ○ | 领域模式 |
请求示例
{
"source": "source",
"summary": "summary",
"domain": "domain"
}响应示例
{"report":{"summary":{"total":5,"red":0,"yellow":1,"green":4,"faithfulness":0.8},"claims":[...]}}POST
/billing/ordersBearer创建支付订单
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| plan | string | ● | 套餐: pro(¥29/月) | pro99(¥99/月) | api(¥0.1/次) |
| provider | string | ● | 支付方式: wxpay | alipay |
| period | string | ○ | 周期: 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最近检测列表
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| limit | int | ○ | 返回条数,默认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
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| fmt | string | ○ | 格式,默认json |
响应示例
导出文件: hallucc-result-{id}.jsonPOST
/feedbackBearer对声明标记准/不准
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| detection_id | int | ● | 检测ID |
| claim_id | int | ● | 声明ID |
| label | string | ● | up(准) | 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":"医疗"},...]}