> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aibase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 平台对比

> 查询指定品牌在指定时间范围内各 AI 平台（大模型）的对比指标，包括平均提及位次、总记录数、TOP1/TOP3/TOP10 提及率、情感得分、品牌得分、曝光率与提及次数。

查询指定品牌在指定时间范围内各 AI 平台（大模型）的对比指标，包括平均提及位次、总记录数、TOP1/TOP3/TOP10 提及率、情感得分、品牌得分、曝光率与提及次数。返回结构为平台维度数组，可直接用于平台横向对比。

<Info>
  **执行模式：SYNC · 实时请求。**
  请求发出后服务端同步执行业务，结果直接在当前响应的 `data` 中返回，不存在异步任务、无需轮询、无需二次查询。
</Info>

## 接口速查

| 项目 | 当前接口约定 |
| - | - |
| 接口状态 | 已上线 |
| 请求方式 | `POST` |
| 请求地址 | `https://geobaseapi.aibase.com/v1/openapi/execute` |
| 业务标识 | `llm.comparison` |
| 执行模式 | **SYNC · 实时请求**（直接返回，无需轮询） |
| 身份认证 | Header `AIBase-API-Key` |
| 请求格式 | `application/json` |
| 返回结构 | 数组结构 |

## 请求头

<ParamField header="AIBase-API-Key" type="string" required>
  开发者 API Key，例如 `AIBase_xxx`。用于身份认证、有效期与调用权限校验，请仅在服务端保存和使用。
</ParamField>

<ParamField header="Content-Type" type="string" required>
  固定为 `application/json`。
</ParamField>

<ParamField header="AIBase-Request-Id" type="string">
  开发者自定义请求 ID，用于请求追踪；不传时系统自动生成 UUID。
</ParamField>

## 请求体

<ParamField body="apiCode" type="string" required>
  固定为 `llm.comparison`
</ParamField>

<ParamField body="data.brandId" type="string" required>
  所属品牌 ID，为空返回 `4001`
</ParamField>

<ParamField body="data.llmName" type="string">
  按 AI 平台筛选，如 `deepseek`；不传返回全部平台
</ParamField>

<ParamField body="data.startDate" type="string">
  格式 `yyyy-MM-dd`；默认最近 7 天
</ParamField>

<ParamField body="data.endDate" type="string">
  格式 `yyyy-MM-dd`；默认今天，不能晚于今天
</ParamField>

<Note>
  时间范围规则：`startDate`/`endDate` 不传时默认查询最近 7 天；`endDate` 晚于今天会被自动截断为今天；起止时间跨度最大 6 个月；开始日期晚于结束日期将直接报错。
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl --location 'https://geobaseapi.aibase.com/v1/openapi/execute' \
    --header 'Content-Type: application/json' \
    --header 'AIBase-API-Key: AIBase_xxxxxxxxxxxxxxxx' \
    --header 'AIBase-Request-Id: req-20260924-001' \
    --data '{
      "apiCode": "llm.comparison",
      "data": {
        "brandId": "brand-001",
        "llmName": "deepseek",
        "startDate": "2026-09-01",
        "endDate": "2026-09-23"
      }
    }'
  ```

  ```python Python theme={null}
  import os
  import requests

  api_key = os.environ["AIBASE_API_KEY"]
  headers = {
      "AIBase-API-Key": api_key,
      "Content-Type": "application/json",
      "AIBase-Request-Id": "req-20260924-001",
  }

  res = requests.post(
      "https://geobaseapi.aibase.com/v1/openapi/execute",
      headers=headers,
      json={"apiCode": "llm.comparison", "data": {"brandId": "brand-001", "llmName": "deepseek", "startDate": "2026-09-01", "endDate": "2026-09-23"}},
      timeout=60,
  )
  res.raise_for_status()
  payload = res.json()

  if payload["code"] == 200:
      print(payload["data"])
  ```

  ```javascript Node.js theme={null}
  const res = await fetch("https://geobaseapi.aibase.com/v1/openapi/execute", {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "AIBase-API-Key": process.env.AIBASE_API_KEY,
      "AIBase-Request-Id": "req-20260924-001",
    },
    body: JSON.stringify({"apiCode": "llm.comparison", "data": {"brandId": "brand-001", "llmName": "deepseek", "startDate": "2026-09-01", "endDate": "2026-09-23"}}),
  });

  const payload = await res.json();
  if (payload.code === 200) {
    console.log(payload.data);
  }
  ```

  ```java Java theme={null}
  String body = """
  {
    "apiCode": "llm.comparison",
    "data": {
      "brandId": "brand-001",
      "llmName": "deepseek",
      "startDate": "2026-09-01",
      "endDate": "2026-09-23"
    }
  }
  """;

  HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://geobaseapi.aibase.com/v1/openapi/execute"))
      .header("Content-Type", "application/json")
      .header("AIBase-API-Key", "AIBase_xxxxxxxxxxxxxxxx")
      .header("AIBase-Request-Id", "req-20260924-001")
      .POST(BodyPublishers.ofString(body))
      .build();

  HttpResponse<String> response = HttpClient.newHttpClient()
      .send(request, BodyHandlers.ofString());
  System.out.println(response.body());
  ```
</RequestExample>

## 返回参数

业务结果位于 `data`，为数组结构，每个元素对应一个 AI 平台的对比指标。

<ResponseField name="data" type="object[]">
  各 AI 平台的对比指标数组。
</ResponseField>

<ResponseField name="data[].llmName" type="string">
  AI 平台名称。
</ResponseField>

<ResponseField name="data[].position" type="number">
  品牌在该平台的平均提及位次。
</ResponseField>

<ResponseField name="data[].totalCount" type="integer">
  该平台的总记录数。
</ResponseField>

<ResponseField name="data[].top1Rate" type="number">
  TOP1 提及率（%）。
</ResponseField>

<ResponseField name="data[].top3Rate" type="number">
  TOP3 提及率（%）。
</ResponseField>

<ResponseField name="data[].top10Rate" type="number">
  TOP10 提及率（%）。
</ResponseField>

<ResponseField name="data[].sentimentScore" type="number">
  品牌在该平台的情感得分。
</ResponseField>

<ResponseField name="data[].comprehensiveScore" type="number">
  品牌 GEO 综合得分。
</ResponseField>

<ResponseField name="data[].visibilityRatePercent" type="number">
  品牌在该平台的曝光率（%）。
</ResponseField>

<ResponseField name="data[].totalVisibilityCount" type="integer">
  品牌在该平台的提及次数。
</ResponseField>

<ResponseExample>
  ```json 200 (成功响应) theme={null}
  {
    "code": 200,
    "msg": "成功",
    "data": [
      {
        "llmName": "deepseek",
        "position": 1.6,
        "totalCount": 120,
        "top1Rate": 42.1,
        "top3Rate": 85.5,
        "top10Rate": 95.2,
        "sentimentScore": 82.5,
        "comprehensiveScore": 86.3,
        "visibilityRatePercent": 78.2,
        "totalVisibilityCount": 98
      },
      {
        "llmName": "chatgpt",
        "position": 2.3,
        "totalCount": 96,
        "top1Rate": 30.2,
        "top3Rate": 68.4,
        "top10Rate": 89.7,
        "sentimentScore": 76.8,
        "comprehensiveScore": 80.1,
        "visibilityRatePercent": 62.5,
        "totalVisibilityCount": 76
      }
    ],
    "timeStamp": 1788830174812
  }
  ```
</ResponseExample>

## 接入注意事项

1. `apiCode` 必须固定为 `llm.comparison`。
2. `brandId` 为必填参数，为空返回 `4001`（所需参数不足）。
3. `startDate`/`endDate` 格式必须为 `yyyy-MM-dd`，默认最近 7 天，最大查询跨度 6 个月。
4. 返回结构为平台维度数组（非分页）；无数据时返回空数组，不代表调用失败。
5. 各占比字段（`top1Rate`、`top3Rate`、`top10Rate`、`visibilityRatePercent`）为百分比数值。
6. 可与 `llm.trend` 配合使用：趋势接口看每日变化，本接口看整体对比。

<AccordionGroup>
  <Accordion title="Java 返回对象">
    ```java theme={null}
    public class LLMComparisonData {
        private String llmName;
        private BigDecimal position;
        private Long totalCount;
        private BigDecimal top1Rate;
        private BigDecimal top3Rate;
        private BigDecimal top10Rate;
        private BigDecimal sentimentScore;
        private BigDecimal comprehensiveScore;
        private BigDecimal visibilityRatePercent;
        private Integer totalVisibilityCount;
    }
    ```

    完整响应类型可表示为 `ReturnResult<List<LLMComparisonData>>`（`ReturnResult` 定义见 6.2.5）。
  </Accordion>

  <Accordion title="TypeScript 类型">
    ```typescript theme={null}
    export interface LLMComparisonData {
      llmName: string;
      position: number | null;
      totalCount: number;
      top1Rate: number | null;
      top3Rate: number | null;
      top10Rate: number | null;
      sentimentScore: number | null;
      comprehensiveScore: number | null;
      visibilityRatePercent: number | null;
      totalVisibilityCount: number;
    }
    ```

    可按以下 TypeScript 类型定义解析响应数据。
  </Accordion>
</AccordionGroup>

<Note>
  本页的 cURL 与 Java 示例来自官方接口文档；Python 与 Node.js 示例为等价转写，未经服务端联调，请以实际返回结果为准。
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.