涉诉 / 涉税风控会话
独立风控 Agent,不是豆包联网问答 POST /v1/agent/chat/completions。
先查已开通的 9 个公开数据维度(涉诉 sifa 6 + 涉税 sat 3),规则评分后再由整理模型写 Markdown。
鉴权:Authorization: Bearer tr-...。上游 authCode 由平台渠道配置,调用方不得传入。
响应头含 X-Request-Id: tr-req-...。
messages 必填,至少一条 user。本期只接受字符串 content(图文 / 文件 → 400)。
客户端须自行回传历史;网关只使用最近 10 条(含本轮 user)。
不接受 conversation_id(传入忽略)。bot_id 传入忽略。
企业识别:规则抽取全称(含「公司 / 集团 / 有限 / 厂 / 事务所」)或 18 位统一社会信用代码。
信用代码走工商 siac keywordType=02,全称走 01;siac 成功则回显全称与代码。
抽不出 → HTTP 400,error.code=missing_company。
覆盖清单(未列入类型不查询、不出现在卡片或摘要,不承诺立案 / 纳税信用 / 重大税收违法):
涉诉 sifa(本期):
| dataType | 中文 | source_type |
|---|---|---|
| cpws | 裁判文书 | 裁判文书公开 |
| zxgg | 执行公告 | 执行信息公开 |
| shixin | 失信公告 | 失信被执行人公开 |
| ktgg | 开庭公告 | 开庭公告 |
| fygg | 法院公告 | 法院公告 |
| sifacdk | 司法查冻扣 | 司法查控公开 |
涉税 sat(本期):
| dataType | 中文 | source_type |
|---|---|---|
| satparty_qs | 欠税公告 | 欠税公告 |
| satparty_chufa | 涉税处罚 | 税务处罚公开 |
| satparty_fzc | 税务非正常户 | 税务非正常户公开 |
空结果:涉诉六类均成功且 0 命中 →「未查询到公开涉诉信息」;涉税三类同理 →「未查询到公开涉税信息」。
任一侧有失败维 → 该侧写「查询失败,不能确认无记录」,禁止用「未查询到」冒充。
全部 9 维失败 → HTTP 502,不返回空报告。部分失败 → HTTP 200 + warnings + coverage.failed。
report.score / rating 只来自规则,模型不得改数。
cards 由 company + report 服务端派生:risk_summary + 每维一张 risk_dimension。
样本必填 entry_id、title、date、source_type;案号等摘不出则为 null 并列入 fields_missing,禁止模型补全。
失败维 status=failed,hit_count 为 null,禁止当成 0 条。
兼容别名:POST /v1/agent/risk/chat/completion。
Authorization
BearerAuth API 密钥认证(OpenAI 格式)。在 Authorization 请求头中传入:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.net/v1/agent/risk/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "messages": [ { "role": "user", "content": "查一下小米科技有限责任公司的涉诉风险" } ], "stream": false }'{
"id": "tr-req-example",
"object": "chat.completion",
"model": "risk-agent",
"company": {
"keyword": "小米科技有限责任公司",
"resolved_name": "小米科技有限责任公司",
"credit_code": "91110108551385082Q",
"status": "存续"
},
"report": {
"rating": "amber",
"score": 42,
"summary": "一句话结论",
"fetched_at": 1690000000000,
"coverage": {
"total": 9,
"queried": 9,
"failed": 0
},
"warnings": [],
"dimensions": [
{
"domain": "sifa",
"data_type": "zxgg",
"label": "执行公告",
"status": "ok",
"hit_count": 196,
"samples": [
{
"entry_id": "...",
"title": "...",
"date": "2025-01-01",
"source_type": "执行信息公开",
"case_no": null,
"fields_missing": [
"case_no",
"cause",
"court",
"party_role",
"case_status"
]
}
]
}
]
},
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Markdown 规范报告……"
},
"finish_reason": "stop"
}
],
"cards": [
{
"card_type": "risk_summary",
"rating": "amber",
"score": 42,
"title": "小米科技有限责任公司",
"subtitle": "存续",
"summary": "一句话结论"
},
{
"card_type": "risk_dimension",
"domain": "sifa",
"data_type": "zxgg",
"label": "执行公告",
"status": "ok",
"hit_count": 196,
"source_type": "执行信息公开",
"samples": [
{
"entry_id": "...",
"title": "...",
"date": "2025-01-01",
"source_type": "执行信息公开",
"case_no": null,
"fields_missing": [
"case_no",
"cause",
"court",
"party_role",
"case_status"
]
}
]
}
],
"usage": {
"query_calls": 6,
"query_cached": false,
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0
}
}{
"error": {
"message": "请提供企业全称或统一社会信用代码",
"code": "missing_company"
}
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "insufficient balance -- please top up or upgrade your plan",
"type": "billing_error"
}{
"error": {
"message": "全部维度查询失败",
"code": "query_unavailable"
},
"request_id": "tr-req-example"
}