# 前后对比

POST/v1/reports/compare

比较两组条件相同的结果，说明是变高、变低、看不出差别，还是样本不够。

## 价格

- 价格: 不收费

这个接口不收费，所以不接受 Idempotency-Key 和 X-Max-Price；带了会返回 invalid_params。

## 参数

放在 JSON 请求体里，不能放在网址里。

`a` 对象 必填

之前的那一批。

`a.job_ids` 文字列表 必填

要统计的任务。1–20 个，不能重复。

`a.engines` 文字列表

只统计这些平台。不写就统计任务里的每个平台。至少 1 个，不能重复。

`a.prompts` 文字列表

只统计这些问题。不写就统计任务里的每个问题。1–100 个，每个最多 2,000 个字符，不能重复。

`b` 对象 必填

之后的那一批。同一条回答不能同时放在两边。

`b.job_ids` 文字列表 必填

要统计的任务。1–20 个，不能重复。

`b.engines` 文字列表

只统计这些平台。不写就统计任务里的每个平台。至少 1 个，不能重复。

`b.prompts` 文字列表

只统计这些问题。不写就统计任务里的每个问题。1–100 个，每个最多 2,000 个字符，不能重复。

`brand` 文字

品牌名。brand 和 domains 至少给一个。最多 100 个字符。

`aliases` 文字列表

品牌的其他写法，例如英文名。最多 20 个，每个最多 100 个字符，不能重复。

`exclude` 文字列表

包含品牌名、但不算这个品牌的词，例如品牌是“苹果”时的“苹果手机壳”。最多 20 个，每个最多 100 个字符，不能重复。

`domains` 文字列表

算作自己的域名，子域名也算。brand 和 domains 至少给一个。1–20 个，每个最多 253 个字符，不能重复。

## 请求头

`Authorization` 必填

Bearer 加你的 API Key。

## 返回

成功时返回 HTTP 200，数据在 `data.item`，是一个 `CompareReport`。字段一直都在： `[]` 是这次没有， `null` 是平台不提供或看不出来。

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `method` | `Method` | 算法的版本和口径 |
| `rows` | `CompareRow[]` | 每组能比的结果、每项指标一行 |
| `comparable` | `boolean` | 至少有一组能比。是 true 时，mismatches 里也可能有不能比的 |
| `mismatches` | `string[]` | 哪些不能比，为什么 |

### 里面的对象

**Method 4 个字段**

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `version` | `string` | 算法版本。分母、区间或识别规则变了就升版本 |
| `denominators` | `{ answer_rate: string, mention_rate: string, citation_rate: string }` | 三个比例各自的分母 |
| `brand_rules` | `string` | 品牌识别规则 |
| `seed` | `integer` | 重抽样用的随机种子，所以同样的输入结果相同 |

**CompareRow 11 个字段**

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `engine` | `string` | 平台编号 |
| `channel_id` | `string \| null` | 实际走的线路。null 表示这些回答都没有发出去 |
| `tier` | `"basic" \| "full"` | 基础版或完整版 |
| `conditions` | `{ surface: string \| null, interface: string \| null, login: string \| null, thinking: boolean \| null, country: string \| null, region: string \| null, requested_country: string \| null, requested_region: string \| null }` | 这一组的采集条件。实际地区不知道时，按你要求的地区分组 |
| `metric` | `"answer_rate" \| "mention_rate" \| "citation_rate"` | 比的是哪个比例 |
| `a` | `Rate` | 之前那批的比例。只算两边都有数据的题 |
| `b` | `Rate` | 之后那批的比例。只算两边都有数据的题 |
| `difference` | `number \| null` | b − a |
| `low` | `number \| null` | 差值 95% 区间的下限。结论是 not_enough 时为 null |
| `high` | `number \| null` | 差值 95% 区间的上限 |
| `verdict` | `"up" \| "down" \| "not_clear" \| "not_enough" \| "single_prompt"` | up 变高；down 变低；not_clear 看不出差别，不等于没有变化；not_enough 数据不够；single_prompt 只有一道题，只给差值和区间 |

**Rate 8 个字段**

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `count` | `integer` | 符合的回答数 |
| `sample_size` | `integer` | 算进分母的回答数 |
| `prompt_count` | `integer` | 有数据的题目数 |
| `value` | `number \| null` | 比例。先算每道题的比例再取平均，所以多道题时不一定等于 count ÷ sample_size。null 是没有数据，不是 0 |
| `low` | `number \| null` | 95% 区间的下限 |
| `high` | `number \| null` | 95% 区间的上限 |
| `method` | `"wilson_95" \| "cluster_bootstrap_95" \| null` | 区间的算法：一道题用 wilson_95，多道题用 cluster_bootstrap_95 |
| `enough` | `boolean` | 样本够不够。false 时不要拿这个比例下结论 |

## 常见错误

返回错误就没有收费，只有 `settlement_unknown`：它表示暂时不知道有没有扣费，要用同一个 Idempotency-Key 再查。[查看每个错误码](https://www.askcrawl.com/zh/docs/errors/)。

| 错误 | HTTP | 意思 | 收费吗 |
| --- | --- | --- | --- |
| [`invalid_params`](https://www.askcrawl.com/zh/docs/errors/#invalid_params) | 400 | 参数不合法 | 没有收费 |
| [`not_found`](https://www.askcrawl.com/zh/docs/errors/#not_found) | 404 | 对象不存在、私密或已删除 | 没有收费 |
| [`report_too_large`](https://www.askcrawl.com/zh/docs/errors/#report_too_large) | 400 | 报告的回答太多，请减少任务，或按平台、题目筛选 | 没有收费 |
| [`unauthorized`](https://www.askcrawl.com/zh/docs/errors/#unauthorized) | 401 | 没有带凭证，或凭证无效、已停用、已过期 | 没有收费 |
| [`rate_limited`](https://www.askcrawl.com/zh/docs/errors/#rate_limited) | 429 | 请求过快，或同时进行的调用过多 | 没有收费 |

```
curl https://api.askcrawl.com/v1/reports/compare \
  -H <b>"Authorization: Bearer $API_KEY"</b> \
  -H <b>"Content-Type: application/json"</b> \
  -d '{
    <b>"a"</b>: {
      <b>"job_ids"</b>: [
        <b>"2f6c1c0e-5b7a-4d1e-9a53-0c8e4f7b21a6"</b>
      ]
    },
    <b>"b"</b>: {
      <b>"job_ids"</b>: [
        <b>"9d3b7e42-1a6f-4c58-b0e7-6a2f5d914c3b"</b>
      ]
    },
    <b>"brand"</b>: <b>"苹果"</b>
  }'
```

上一级

[接口参考](https://www.askcrawl.com/zh/docs/api/)

相近的页面

[可见度报告](https://www.askcrawl.com/zh/docs/api/reports-visibility/)

依据

[错误和收费](https://www.askcrawl.com/zh/docs/errors/)

[费用、冻结和结算](https://www.askcrawl.com/zh/docs/billing/)

接着做

[快速开始](https://www.askcrawl.com/zh/docs/quickstart/)

[连接 AI 助手](https://www.askcrawl.com/zh/docs/mcp/)

> 网页：https://www.askcrawl.com/zh/docs/api/reports-compare/ · 内容日期：2026-12-01
