# 公开信息风控会话

风控智能体复用 `POST /v1/search` 的联网搜索渠道，查询企业公开网页线索，由整理模型生成带来源链接的报告。当前不调用法海工商、query 或 export 接口。

企业全称可直接用于检索；只有官方网页中标注的企业名称与有效信用代码唯一对应时，`identity_status=matched`。名称未核实返回 `user_provided`，不冒充工商登记确认。仅提供信用代码且无法对应企业名称时返回 `company_unresolved`。

保留九个检索维度：`cpws`、`zxgg`、`shixin`、`ktgg`、`fygg`、`sifacdk`、`satparty_qs`、`satparty_chufa`、`satparty_fzc`。维度状态为 `evidence_found`（待核实线索）、`unverified`（未确认）或 `failed`。网页样本仅接受官方域名及目标企业全称匹配，仍需核实案件角色、主体关系、日期和裁判结果。

`report.source=web_search`，`rating=unknown`，`score=null`，`hit_count=null`。`evidence_count` 仅为展示的网页线索数，不是案件总数或风险数量。未找到证据不代表无风险，历史记录不证明当前状态。

企业识别和各维度的每次成功搜索均按 `doubao-web-search` 的实际价格计费；空搜索结果也算成功调用。缓存有效期 24 小时，命中不收搜索费。整理模型按 token 计费；不再按原法海 `risk-agent` 单价收费。即使识别未匹配或整理失败，已完成的搜索仍按次结算。

鉴权 `Authorization: Bearer tr-...`。受限密钥须允许 `risk-agent`、`doubao-web-search`，生成报告时还需允许配置的整理模型及对应渠道。调用方无需传数据源凭据。

`messages` 只接受字符串 content，至少一条 user；网关使用最近 10 条历史。`identify=true` 仅核对主体，最多发起一次搜索；`stream=true` 返回 SSE。旧报告历史可读取，新搜索缓存与旧法海缓存隔离。兼容别名 `/v1/agent/risk/chat/completion`。

## POST /v1/agent/risk/chat/completions

> Public-information risk screening

The risk agent reuses the web-search channel behind `POST /v1/search` and generates a cited public-information screening report. It no longer calls Fahai identity, query or export APIs.

A supplied legal name can be searched without claiming registry verification. `identity_status=matched` requires a unique labelled name and checksum-valid credit code in an official document. Otherwise a supplied name is `user_provided`. A credit code without a resolved legal name returns `company_unresolved`.

Nine search dimensions remain: `cpws`, `zxgg`, `shixin`, `ktgg`, `fygg`, `sifacdk`, `satparty_qs`, `satparty_chufa`, `satparty_fzc`. Status is `evidence_found` (unverified leads), `unverified`, or `failed`. Cards require an official source domain and an exact company-name mention; party roles, relationships, dates and outcomes still need verification.

`report.source=web_search`, `rating=unknown`, `score=null`, and `hit_count=null`. `evidence_count` counts displayed web leads, not cases or risks. Missing evidence does not establish no risk, and historical records do not establish current status.

Each successful identity or dimension search is billed at the actual `doubao-web-search` rate, including an empty result. The 24-hour cache avoids search fees. The writer is billed by tokens; the former risk-agent/Fahai per-call rate is not used. Completed searches remain billable if identity cannot be resolved or report writing fails.

Use `Authorization: Bearer tr-...`. Restricted keys must allow `risk-agent`, `doubao-web-search`, and, for reports, the configured writer model and their channels. No provider credentials are required from callers.

Messages accept string content and require a user message; the last 10 messages are used. `identify=true` only checks identity with at most one search; `stream=true` returns SSE. Historical reports remain readable; new search caches are separate from old Fahai data. Alias: `/v1/agent/risk/chat/completion`.

### Authentication

`Authorization: Bearer tr-xxx`

### Request Body

Content-Type: `application/json`

- **messages** `object[]` **(required)**  
  
- **messages[].role** ``user` | `assistant` | `system`` **(required)**  
  
- **messages[].content** `string` **(required)**  
  
- **stream** `boolean` (default: `false`)  
  
- **identify** `boolean` (default: `false`)  
  Identity search only; successful uncached searches are billed.

### Response

### Error Codes

- `400`: Invalid request, missing company, invalid credit code, or unresolved code.
- `402`: Insufficient balance. Previously completed searches remain billable.
- `403`: Model or channel not allowed.
- `429`: Search rate limited.
- `502`: Search or writer unavailable. All failed dimensions return no report.
- `503`: Required search or writer configuration unavailable.
