{
  "openapi": "3.0.3",
  "info": {
    "title": "SheepGeo 开放平台 API",
    "description": "# SheepGeo 开放平台 API\n\n为第三方开发者提供 SheepGeo 生成式搜索优化能力的 RESTful API。\n\n## 认证方式\n\n所有 API 请求需要在 Header 中携带 API Key：\n\n```\nAuthorization: Bearer sgeo_sk_xxxxxxxxxxxxxxxx\n```\n\n或者：\n\n```\nX-API-Key: sgeo_sk_xxxxxxxxxxxxxxxx\n```\n\n## 速率限制\n\n- 每分钟请求上限：由平台按账号策略统一分配（默认 60 次/分钟）\n- 每日请求上限：由平台按账号策略统一分配（默认 2000 次/天）\n\n超出限制时返回 HTTP 429 状态码。\n\n## 配额消耗\n\n已购开发者配额包为永久额度，不会按天数失效。\n如果存在试用、活动或管理员赠送额度，可能会单独带有效期，并在余额接口中显示。\n\n不同 API 消耗不同数量的 AI 调用配额：\n- AI 可见性检测 (ai-visibility): 按模型数计算（每个模型 1 次 AI call）\n- 关键词轮询 (keyword-polling): 按实际检测次数计算\n- 精准采样 (precision-sampling): 按模型数 × 重复次数计算\n- 竞品分析 (competitor-analysis): 按 V2 实际查询计划数 × 模型数计算\n- 品牌监控 (brand-monitoring): 按每轮监控执行的模型数计算\n- 效果追踪 (effect-tracking): 内容资产管理与命中查询不消耗 AI calls\n- 余额查询 (balance): 仅查询账户状态，不消耗 AI calls\n\n关键词轮询支持可选的浏览器证据采集：\n- 请求体传 `evidence.screenshot=true` 可返回对话长截图\n- 请求体传 `evidence.video=true` 可返回对话录屏\n- 当前仅 DeepSeek、豆包、文心和通义千问的关键词渗透检测支持浏览器证据采集\n- 该能力灰度开放，需要管理员为账号或 API Key 开通后才能使用；未开通时会在扣费前返回权限错误\n- 普通次数配额客户：截图按每次支持模型检测额外 +1 AI call，录屏额外 +2 AI calls\n- 企业 API 预付费客户：按合同/后台配置的模型固定单价结算，`amountYuan` 不会因 evidence 请求被动态翻倍\n\n## 错误处理\n\nAPI 返回统一的错误格式：\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ERROR_CODE\",\n    \"message\": \"错误描述\"\n  },\n  \"meta\": {\n    \"requestId\": \"req_xxxxx\",\n    \"timestamp\": \"2026-02-04T12:00:00Z\"\n  }\n}\n```",
    "version": "1.0.0",
    "contact": {
      "name": "SheepGeo 技术支持",
      "email": "support@sheepgeo.com"
    },
    "termsOfService": "https://sheepgeo.com/terms"
  },
  "servers": [
    {
      "url": "https://0.0.0.0:3000",
      "description": "生产环境"
    },
    {
      "url": "http://localhost:3000",
      "description": "本地开发"
    }
  ],
  "tags": [
    {
      "name": "ai-visibility",
      "description": "AI 可见性检测"
    },
    {
      "name": "keyword-polling",
      "description": "关键词轮询对比"
    },
    {
      "name": "precision-sampling",
      "description": "精准采样稳定性检测"
    },
    {
      "name": "competitor-analysis",
      "description": "竞品多维对比分析"
    },
    {
      "name": "brand-monitoring",
      "description": "周期品牌监控（暂不可用：品牌监控功能正在临时维护中，暂不可用。）"
    },
    {
      "name": "effect-tracking",
      "description": "内容资产效果追踪"
    },
    {
      "name": "balance",
      "description": "开发者账户余额查询"
    },
    {
      "name": "media",
      "description": "媒体库查询与文章发稿（白名单开放，独立扣除媒体发布余额）"
    }
  ],
  "paths": {
    "/api/v1/ai-visibility": {
      "post": {
        "tags": [
          "ai-visibility"
        ],
        "summary": "执行 AI 可见性检测",
        "description": "检测网站在 9 大主流 AI 模型中的可见性。按实际选中模型数消耗配额，每检测 1 个模型消耗 1 次 AI 调用。",
        "operationId": "checkAiVisibility",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AiVisibilityRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "检测成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiVisibilityResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v1/ai-visibility/{taskId}": {
      "get": {
        "tags": [
          "ai-visibility"
        ],
        "summary": "查询 AI 可见性任务结果",
        "description": "根据 taskId 查询 AI 可见性检测任务的运行状态和最终结果。",
        "operationId": "getAiVisibilityTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "任务 ID，格式如 vis_123"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiVisibilityResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/keyword-polling": {
      "post": {
        "tags": [
          "keyword-polling"
        ],
        "summary": "执行关键词轮询检测",
        "description": "对指定关键词进行多 AI 模型轮询检测，获取品牌推荐情况对比。支持 existingQueries 导入自定义查询词并跳过生成阶段。默认建议先用轻量模式生成轮询词（queriesPerModel=3, deepPenetration=false），确认查询词质量后再执行完整交叉检测。",
        "operationId": "executeKeywordPolling",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KeywordPollingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "检测成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeywordPollingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v1/keyword-polling/{taskId}": {
      "get": {
        "tags": [
          "keyword-polling"
        ],
        "summary": "查询关键词轮询任务结果",
        "description": "根据 taskId 查询关键词轮询任务的进度和完整结果。",
        "operationId": "getKeywordPollingTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "关键词轮询任务 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeywordPollingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/keyword-polling/{taskId}/cancel": {
      "post": {
        "tags": [
          "keyword-polling"
        ],
        "summary": "取消关键词轮询任务",
        "description": "取消一个还没结束的关键词轮询任务（只能取消通过开放接口创建的任务）。排队中的任务立即取消；正在检测的任务会在正在问的那几个问题回答完后停下（status=cancelling），之后查询任务状态变为 cancelled。已经拿到有效回答的部分照常计费、结果仍可查询，没完成的部分自动退回（refund.status=pending 表示停下后再退）。重复调用不会重复退款；已完成 / 已失败的任务返回 409。",
        "operationId": "cancelKeywordPollingTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "关键词轮询任务 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "已取消或已请求取消",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": true
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "taskId": {
                          "type": "integer"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "cancelled",
                            "cancelling"
                          ],
                          "description": "cancelled=已取消；cancelling=正在停下，稍后查询任务状态"
                        },
                        "alreadyCancelled": {
                          "type": "boolean",
                          "description": "任务之前就已取消（重复调用）"
                        },
                        "refund": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "enum": [
                                "refunded",
                                "pending",
                                "none"
                              ],
                              "description": "refunded=已退回；pending=任务停下后自动退回；none=没有需要退的部分"
                            },
                            "amountYuan": {
                              "type": "number",
                              "description": "预付费账户退回金额（元）"
                            },
                            "credits": {
                              "type": "integer",
                              "description": "次数余额退回次数"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "409": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/precision-sampling": {
      "post": {
        "tags": [
          "precision-sampling"
        ],
        "summary": "创建精准采样任务",
        "description": "对同一问题做多轮重复检测，用于评估品牌命中稳定性。配额按模型数乘以重复次数计算。",
        "operationId": "executePrecisionSampling",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PrecisionSamplingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrecisionSamplingResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v1/precision-sampling/{taskId}": {
      "get": {
        "tags": [
          "precision-sampling"
        ],
        "summary": "查询精准采样任务结果",
        "description": "根据 taskId 查询精准采样任务的进度、结果和稳定性统计。",
        "operationId": "getPrecisionSamplingTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "精准采样任务 ID，格式如 ps_123"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PrecisionSamplingResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/competitor-analysis": {
      "post": {
        "tags": [
          "competitor-analysis"
        ],
        "summary": "创建竞品分析任务",
        "description": "使用 V2 平衡查询计划，分别返回开放市场自然推荐、多品牌偏好和两两比较，并报告检测完整度。",
        "operationId": "executeCompetitorAnalysis",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompetitorAnalysisRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompetitorAnalysisResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v1/competitor-analysis/{taskId}": {
      "get": {
        "tags": [
          "competitor-analysis"
        ],
        "summary": "查询竞品分析任务结果",
        "description": "根据 taskId 查询竞品分析任务的进度、维度结果和竞品对比摘要。",
        "operationId": "getCompetitorAnalysisTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "竞品分析任务 ID，格式如 ca_123"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompetitorAnalysisResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/brand-monitoring": {
      "post": {
        "tags": [
          "brand-monitoring"
        ],
        "summary": "创建品牌监控任务",
        "description": "当前暂不可用：品牌监控功能正在临时维护中，暂不可用。",
        "operationId": "createBrandMonitoringTask",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BrandMonitoringRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "任务创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandMonitoringTaskResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      },
      "get": {
        "tags": [
          "brand-monitoring"
        ],
        "summary": "获取品牌监控任务列表",
        "description": "当前暂不可用：品牌监控功能正在临时维护中，暂不可用。",
        "operationId": "listBrandMonitoringTasks",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandMonitoringListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v1/brand-monitoring/{taskId}": {
      "get": {
        "tags": [
          "brand-monitoring"
        ],
        "summary": "查询品牌监控任务详情",
        "description": "当前暂不可用：品牌监控功能正在临时维护中，暂不可用。",
        "operationId": "getBrandMonitoringTask",
        "parameters": [
          {
            "name": "taskId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "品牌监控任务 ID，格式如 bm_123"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrandMonitoringTaskResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/api/v1/effect-tracking/assets": {
      "get": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "获取效果追踪内容资产列表",
        "description": "返回当前 API Key 所属账号下的活跃内容资产。该接口不消耗 AI calls。",
        "operationId": "listEffectTrackingAssets",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            },
            "description": "返回数量"
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "分页偏移量"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingAssetListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "post": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "新增效果追踪内容资产",
        "description": "把已发布文章、媒体稿或内容页同步为效果追踪资产。该接口不消耗 AI calls。",
        "operationId": "createEffectTrackingAsset",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EffectTrackingAssetRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingAssetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/effect-tracking/assets/bulk": {
      "post": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "批量导入效果追踪内容资产",
        "description": "批量同步已发布内容资产，支持 assets 数组或 rawText / csv 导入。单次最多 200 条。",
        "operationId": "bulkImportEffectTrackingAssets",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EffectTrackingBulkImportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "导入完成",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingBulkImportResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/effect-tracking/assets/{assetId}": {
      "get": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "查询效果追踪内容资产详情",
        "description": "查询单条内容资产。可通过 includeMatches=true 同时返回该内容的 AI 引用命中明细。",
        "operationId": "getEffectTrackingAsset",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "内容资产 ID"
          },
          {
            "name": "includeMatches",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "是否包含命中明细"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingAssetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "patch": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "更新效果追踪内容资产",
        "description": "更新标题、平台、发布时间、作者或资产状态。",
        "operationId": "updateEffectTrackingAsset",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "内容资产 ID"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EffectTrackingAssetUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "更新成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingAssetResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      },
      "delete": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "归档效果追踪内容资产",
        "description": "将内容资产标记为 archived，不删除历史命中记录。",
        "operationId": "archiveEffectTrackingAsset",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "内容资产 ID"
          }
        ],
        "responses": {
          "200": {
            "description": "归档成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingAssetResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/effect-tracking/assets/{assetId}/matches": {
      "get": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "查询单篇内容的 AI 引用命中",
        "description": "返回某个内容资产在 AI 回答引用来源中的命中明细。",
        "operationId": "listEffectTrackingAssetMatches",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            },
            "description": "内容资产 ID"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 100
            },
            "description": "返回数量"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingMatchesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/effect-tracking/matches": {
      "get": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "查询最近效果追踪命中",
        "description": "返回当前账号最近的内容资产引用命中动态。",
        "operationId": "listRecentEffectTrackingMatches",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            },
            "description": "返回数量"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingMatchesResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/effect-tracking/summary": {
      "get": {
        "tags": [
          "effect-tracking"
        ],
        "summary": "查询效果追踪汇总",
        "description": "返回内容资产总览、引用率、趋势、模型分布、平台分布和 Top 内容。",
        "operationId": "getEffectTrackingSummary",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EffectTrackingSummaryResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/balance": {
      "get": {
        "tags": [
          "balance"
        ],
        "summary": "查询开发者账户余额",
        "description": "返回当前 API Key 对应账号的可用 AI calls、永久配额余额和当前密钥速率限制。该接口不消耗配额。",
        "operationId": "getDeveloperBalance",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    },
    "/api/v1/media": {
      "get": {
        "tags": [
          "media"
        ],
        "summary": "查询在架媒体列表",
        "description": "需开通媒体 API 白名单且 API Key 开启 media_read 权限。不消耗 AI calls。limit<=50，page*limit<=2000，支持按 AI 被引排序（ai_cited_desc）。",
        "operationId": "listV1Media",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "媒体名称或平台关键词"
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "news",
                "wemedia"
              ]
            },
            "description": "媒体类型：news（网媒）/ wemedia（自媒体）"
          },
          {
            "name": "platform",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "所属平台"
          },
          {
            "name": "industry",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "行业分类"
          },
          {
            "name": "priceMin",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "最低实付价（元）"
          },
          {
            "name": "priceMax",
            "in": "query",
            "schema": {
              "type": "number"
            },
            "description": "最高实付价（元）"
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ai_cited_desc",
                "price_asc",
                "price_desc"
              ],
              "default": "ai_cited_desc"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "429": {
            "$ref": "#/components/responses/RateLimitExceeded"
          }
        }
      }
    },
    "/api/v1/media/match-domains": {
      "post": {
        "tags": [
          "media"
        ],
        "summary": "按域名反查可投媒体",
        "description": "输入 AI 引用域名（每次最多 20 个），返回各域名对应可投稿媒体与实付价。不消耗配额。",
        "operationId": "matchV1MediaDomains",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1MediaMatchDomainsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "匹配成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaMatchDomainsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/v1/media/quote": {
      "post": {
        "tags": [
          "media"
        ],
        "summary": "实时核价与发稿预检",
        "description": "校验 mediaIds 在架状态与实时实付价，并在提供 article / articleId 时执行内容合规与发稿预检。不扣费。",
        "operationId": "quoteV1Media",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1MediaQuoteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "核价完成",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaQuoteResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/v1/media/orders": {
      "get": {
        "tags": [
          "media"
        ],
        "summary": "查询发稿订单列表",
        "description": "分页或按 updatedSince 增量同步发稿订单状态、发布链接与拒稿原因。不消耗配额。",
        "operationId": "listV1MediaOrders",
        "parameters": [
          {
            "name": "batchNo",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "clientOrderRef",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "pending_accept",
                "publishing",
                "published",
                "rejected",
                "cancelled"
              ]
            }
          },
          {
            "name": "updatedSince",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaOrderListResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "media"
        ],
        "summary": "创建媒体发稿订单",
        "description": "正式下单需账号白名单 allowPublish=true 且 API Key 开启 media_publish，并必传 Idempotency-Key（持久化防重）；支持 dryRun=true 零扣费联调、maxTotalYuan 滑点保护与自动入效果追踪。扣除独立媒体余额（元）。",
        "operationId": "createV1MediaOrders",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 8,
              "maxLength": 128
            },
            "description": "正式下单必传幂等键（推荐 UUID）"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/V1MediaOrderCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "下单已受理",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaOrderCreateResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          }
        }
      }
    },
    "/api/v1/media/orders/{orderNo}": {
      "get": {
        "tags": [
          "media"
        ],
        "summary": "查询单笔发稿订单详情",
        "description": "按公开订单号（orderNo）查询最新状态、发布链接与拒稿原因。",
        "operationId": "getV1MediaOrder",
        "parameters": [
          {
            "name": "orderNo",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "公开订单号，例如 SGM-XXXX"
          }
        ],
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaOrderDetailResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/v1/media/balance": {
      "get": {
        "tags": [
          "media"
        ],
        "summary": "查询媒体发布余额与日限额",
        "description": "返回当前账号的独立媒体余额（元）、日消费限额与今日已用金额。不消耗配额。",
        "operationId": "getV1MediaBalance",
        "responses": {
          "200": {
            "description": "查询成功",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/V1MediaBalanceResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API Key (格式: sgeo_sk_xxx)"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API Key Header"
      }
    },
    "schemas": {
      "V1MediaItem": {
        "type": "object",
        "properties": {
          "mediaId": {
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "news",
              "wemedia"
            ]
          },
          "platform": {
            "type": "string",
            "nullable": true
          },
          "industry": {
            "type": "string",
            "nullable": true
          },
          "priceYuan": {
            "type": "number",
            "description": "实付价（元）"
          }
        }
      },
      "V1MediaListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1MediaItem"
                }
              },
              "pagination": {
                "type": "object",
                "properties": {
                  "page": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "total": {
                    "type": "integer"
                  },
                  "hasMore": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "V1MediaMatchDomainsRequest": {
        "type": "object",
        "required": [
          "domains"
        ],
        "properties": {
          "domains": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          },
          "perDomain": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 5
          },
          "priceMax": {
            "type": "number"
          },
          "industries": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "sort": {
            "type": "string",
            "enum": [
              "default",
              "price_asc",
              "price_desc"
            ]
          }
        }
      },
      "V1MediaMatchDomainsResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "matches": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/V1MediaItem"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "V1MediaQuoteRequest": {
        "type": "object",
        "required": [
          "mediaIds"
        ],
        "properties": {
          "mediaIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "integer"
            }
          },
          "articleId": {
            "type": "integer",
            "nullable": true
          },
          "article": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "content": {
                "type": "string"
              },
              "contentFormat": {
                "type": "string",
                "enum": [
                  "markdown",
                  "html"
                ],
                "default": "markdown"
              }
            }
          }
        }
      },
      "V1MediaQuoteResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "mediaId": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "available": {
                      "type": "boolean"
                    },
                    "priceYuan": {
                      "type": "number",
                      "nullable": true
                    },
                    "reason": {
                      "type": "string"
                    }
                  }
                }
              },
              "totalYuan": {
                "type": "number"
              },
              "preflightOk": {
                "type": "boolean"
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "level": {
                      "type": "string",
                      "enum": [
                        "error",
                        "warning"
                      ]
                    },
                    "code": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "V1MediaOrderCreateRequest": {
        "type": "object",
        "required": [
          "mediaIds"
        ],
        "properties": {
          "mediaIds": {
            "type": "array",
            "minItems": 1,
            "maxItems": 20,
            "items": {
              "type": "integer"
            }
          },
          "articleId": {
            "type": "integer",
            "nullable": true
          },
          "article": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "content": {
                "type": "string"
              },
              "contentFormat": {
                "type": "string",
                "enum": [
                  "markdown",
                  "html"
                ],
                "default": "markdown"
              },
              "author": {
                "type": "string"
              },
              "keywords": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "maxTotalYuan": {
            "type": "number",
            "description": "价格滑点上限（元）"
          },
          "projectId": {
            "type": "integer",
            "nullable": true
          },
          "autoTrack": {
            "type": "boolean",
            "default": true
          },
          "clientOrderRef": {
            "type": "string",
            "maxLength": 128
          },
          "dryRun": {
            "type": "boolean",
            "default": false
          }
        }
      },
      "V1MediaOrderCreateResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "batchNo": {
                "type": "string"
              },
              "chargedYuan": {
                "type": "number"
              },
              "balanceAfterYuan": {
                "type": "number"
              },
              "orders": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "orderNo": {
                      "type": "string",
                      "nullable": true
                    },
                    "mediaId": {
                      "type": "integer"
                    },
                    "mediaName": {
                      "type": "string"
                    },
                    "priceYuan": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending_accept",
                        "publishing",
                        "duplicate"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "V1MediaOrder": {
        "type": "object",
        "properties": {
          "orderNo": {
            "type": "string"
          },
          "batchNo": {
            "type": "string",
            "nullable": true
          },
          "clientOrderRef": {
            "type": "string",
            "nullable": true
          },
          "mediaId": {
            "type": "integer",
            "nullable": true
          },
          "mediaName": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending_accept",
              "publishing",
              "published",
              "rejected",
              "cancelled"
            ]
          },
          "priceYuan": {
            "type": "number",
            "nullable": true
          },
          "publishedUrl": {
            "type": "string",
            "nullable": true
          },
          "rejectReason": {
            "type": "string",
            "nullable": true
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "V1MediaOrderListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/V1MediaOrder"
                }
              },
              "pagination": {
                "type": "object",
                "properties": {
                  "page": {
                    "type": "integer"
                  },
                  "limit": {
                    "type": "integer"
                  },
                  "total": {
                    "type": "integer"
                  },
                  "hasMore": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        }
      },
      "V1MediaOrderDetailResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "$ref": "#/components/schemas/V1MediaOrder"
          }
        }
      },
      "V1MediaBalanceResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "availableYuan": {
                "type": "number"
              },
              "dailyLimitYuan": {
                "type": "number"
              },
              "todaySpentYuan": {
                "type": "number"
              }
            }
          }
        }
      },
      "SearchReference": {
        "type": "object",
        "description": "AI 回答返回的联网引用来源。模型或供应商未返回结构化信源时，对应数组为空。",
        "properties": {
          "title": {
            "type": "string",
            "description": "来源标题"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "来源 URL"
          },
          "snippet": {
            "type": "string",
            "description": "来源摘要或片段"
          },
          "source": {
            "type": "string",
            "description": "来源解析通道或供应商标识"
          },
          "sourceLabel": {
            "type": "string",
            "description": "实际链接站点中文显示名，例如“知乎”“微信公众号”“百度百科”；未知站点返回主域名"
          },
          "sourceChannelLabel": {
            "type": "string",
            "description": "搜索解析通道中文显示名，例如“豆包搜索”“千问联网搜索”“博查搜索”"
          },
          "sourceDomain": {
            "type": "string",
            "description": "实际链接主域名，例如 zhihu.com、mp.weixin.qq.com"
          }
        }
      },
      "BrowserEvidenceRequest": {
        "type": "object",
        "description": "关键词轮询/关键词渗透的可选浏览器证据采集配置。当前仅 DeepSeek、豆包、文心和通义千问支持；截图与录屏可独立开启。",
        "properties": {
          "screenshot": {
            "type": "boolean",
            "default": false,
            "description": "是否返回 AI 对话长截图。普通次数配额按每次支持模型检测额外 +1 AI call；企业 API 预付费按固定模型价格结算。"
          },
          "video": {
            "type": "boolean",
            "default": false,
            "description": "是否返回 AI 对话录屏。普通次数配额按每次支持模型检测额外 +2 AI calls；企业 API 预付费按固定模型价格结算。"
          },
          "shareUrl": {
            "type": "boolean",
            "default": false,
            "description": "是否返回 AI 对话的公开分享链接（可在浏览器直接打开的完整对话快照）。不额外计费；生成失败或平台不支持时返回 null。"
          }
        },
        "example": {
          "screenshot": true,
          "video": false,
          "shareUrl": true
        }
      },
      "BrowserEvidenceResponse": {
        "type": "object",
        "description": "关键词轮询/关键词渗透的浏览器证据采集结果。未请求时 status=not_requested；任务执行中可能为 queued/running；采集失败但主任务可用时为 needs_attention。",
        "properties": {
          "requested": {
            "$ref": "#/components/schemas/BrowserEvidenceRequest"
          },
          "status": {
            "type": "string",
            "enum": [
              "not_requested",
              "queued",
              "running",
              "completed",
              "needs_attention"
            ]
          },
          "jobId": {
            "type": "string",
            "nullable": true
          },
          "provider": {
            "type": "string",
            "enum": [
              "mita",
              "zhipu",
              "ernie",
              "hunyuan",
              "deepseek",
              "kimi",
              "spark",
              "doubao_app",
              "doubao",
              "qianwen",
              "other"
            ],
            "nullable": true,
            "description": "执行取证的模型，使用开发者公共模型 ID（与 modelId 一致）；无法归类时为 other。"
          },
          "screenshots": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "截图 URL 列表；最后一张通常是对话长截图。"
          },
          "screenshotUrl": {
            "type": "string",
            "nullable": true,
            "description": "推荐展示的截图 URL，通常指向最新长截图。"
          },
          "videoUrl": {
            "type": "string",
            "nullable": true,
            "description": "录屏 URL，仅请求 video=true 且采集完成后返回。"
          },
          "shareUrl": {
            "type": "string",
            "nullable": true,
            "description": "AI 对话公开分享链接，仅请求 shareUrl=true 且生成成功后返回；平台不支持或生成失败时为 null。"
          },
          "responseTimeMs": {
            "type": "integer",
            "nullable": true
          },
          "error": {
            "type": "string",
            "nullable": true
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "证据文件预计过期时间。默认保留 24 小时，具体以服务端配置为准。"
          }
        }
      },
      "AnalyzeRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "要分析的网站 URL",
            "example": "https://example.com"
          },
          "options": {
            "type": "object",
            "properties": {
              "depth": {
                "type": "integer",
                "minimum": 1,
                "maximum": 5,
                "default": 2,
                "description": "爬取深度"
              },
              "includeSubpages": {
                "type": "boolean",
                "default": true,
                "description": "是否包含子页面"
              }
            }
          }
        }
      },
      "AiVisibilityRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "要检测的网站 URL 或品牌名称"
          },
          "inputType": {
            "type": "string",
            "enum": [
              "url",
              "brand"
            ],
            "default": "url",
            "description": "输入类型。传 brand 时按品牌名称校验；不传时服务端会优先按 URL 解析，失败后尝试品牌名。"
          },
          "models": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "指定检测的 AI 模型列表（可选）。推荐使用开发者公共模型 ID：mita, zhipu, ernie, hunyuan, deepseek, kimi, spark, doubao, qianwen。为兼容旧版本，也接受历史内部 model_id。每个模型消耗 1 次 AI 调用。",
            "example": [
              "deepseek",
              "doubao",
              "kimi"
            ]
          }
        }
      },
      "KeywordPollingRequest": {
        "type": "object",
        "required": [
          "brandName"
        ],
        "anyOf": [
          {
            "required": [
              "keyword"
            ]
          },
          {
            "required": [
              "existingQueries"
            ]
          }
        ],
        "properties": {
          "keyword": {
            "type": "string",
            "description": "核心关键词。自动生成模式必填；导入自定义查询词时可选。",
            "example": "五粮液"
          },
          "brandName": {
            "type": "string",
            "description": "品牌名称，用于计算渗透率",
            "example": "五粮液"
          },
          "queriesPerModel": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10,
            "default": 3,
            "description": "每个 AI 生成的轮询词数量。建议先用 3 做轻量试跑，确认轮询词后再增加。"
          },
          "description": {
            "type": "string",
            "description": "任务描述/场景描述"
          },
          "existingQueries": {
            "type": "array",
            "minItems": 1,
            "description": "自定义查询词列表。传入后跳过 AI 生成阶段，直接进入检测；此时 keyword 可选，deepPenetration 会被视为 true。",
            "items": {
              "oneOf": [
                {
                  "type": "string",
                  "description": "直接写查询词文本"
                },
                {
                  "type": "object",
                  "required": [
                    "text"
                  ],
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "查询词文本"
                    },
                    "modelId": {
                      "type": "string",
                      "description": "可选，记录该查询词的来源模型 ID"
                    },
                    "modelName": {
                      "type": "string",
                      "description": "可选，记录该查询词的来源模型名称"
                    }
                  }
                }
              ]
            },
            "example": [
              "高端白酒品牌推荐",
              "商务送礼白酒选什么"
            ]
          },
          "targetUrl": {
            "type": "string",
            "format": "uri",
            "description": "目标网站 URL（可选）"
          },
          "selectedModels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "参与关键词轮询的模型 ID 列表。推荐使用开发者公共模型 ID：mita, zhipu, ernie, hunyuan, deepseek, kimi, spark, doubao_app, doubao, qianwen（其中 doubao_app 为豆包 App 手机端独立渠道，需显式指定且需传入 existingQueries 或搭配可生成词模型完成完整检测）。同一请求传多个模型会让每个查询词分别执行所有模型，不是负载均衡；批量任务需要保持固定总次数时，请每个请求只传 1 个模型并由调用方轮转。不传则使用全部可用模型，配额消耗会明显增加。",
            "example": [
              "deepseek",
              "doubao",
              "qianwen"
            ]
          },
          "deepPenetration": {
            "type": "boolean",
            "default": false,
            "description": "是否开启完整交叉检测。默认 false，先生成轮询词节省配额；确认查询词后再开启。导入自定义查询词时会自动按 true 处理。"
          },
          "brandRecognition": {
            "type": "boolean",
            "default": true,
            "description": "是否在检测后自动识别 AI 回答中的品牌并生成品牌榜。默认 true。仅生成轮询词（deepPenetration=false 且未导入查询词）时没有检测回答，会被强制按 false 处理。"
          },
          "freshness": {
            "type": "string",
            "enum": [
              "noLimit",
              "oneDay",
              "oneWeek",
              "oneMonth",
              "halfYear"
            ],
            "default": "oneWeek",
            "description": "时效性范围"
          },
          "evidence": {
            "$ref": "#/components/schemas/BrowserEvidenceRequest",
            "description": "可选。仅完整检测阶段支持，请设置 deepPenetration=true 或传入 existingQueries；当前仅 DeepSeek/豆包/文心/通义千问检测会返回截图或录屏。文心在 selectedModels 中推荐使用公共模型 ID ernie。"
          }
        }
      },
      "PrecisionSamplingRequest": {
        "type": "object",
        "required": [
          "query",
          "brandName",
          "selectedModels",
          "repetitionCount"
        ],
        "properties": {
          "query": {
            "type": "string",
            "description": "要重复询问 AI 的固定问题",
            "example": "推荐适合企业做 GEO 优化的平台"
          },
          "brandName": {
            "type": "string",
            "description": "要追踪的目标品牌",
            "example": "SheepGeo"
          },
          "selectedModels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "参与重复检测的模型 ID 列表。推荐使用开发者公共模型 ID：mita, zhipu, ernie, hunyuan, deepseek, kimi, spark, doubao, qianwen。",
            "example": [
              "doubao",
              "deepseek",
              "qianwen"
            ]
          },
          "repetitionCount": {
            "type": "integer",
            "minimum": 2,
            "maximum": 50,
            "description": "每个模型重复询问次数",
            "example": 8
          },
          "targetUrl": {
            "type": "string",
            "format": "uri",
            "description": "目标网站 URL（可选）"
          },
          "description": {
            "type": "string",
            "description": "任务描述"
          }
        }
      },
      "CompetitorAnalysisRequest": {
        "type": "object",
        "required": [
          "targetBrand",
          "competitors",
          "dimensions"
        ],
        "properties": {
          "targetBrand": {
            "type": "string",
            "description": "目标品牌名称",
            "example": "SheepGeo"
          },
          "competitors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "竞品名称列表",
            "example": [
              "竞品A",
              "竞品B"
            ]
          },
          "dimensions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "用于生成问题的分析维度",
            "example": [
              "品牌认知",
              "效果追踪",
              "AI 可见性"
            ]
          },
          "queriesPerDimension": {
            "type": "integer",
            "minimum": 1,
            "maximum": 5,
            "default": 3,
            "description": "每个维度、每类题型的样本数；最终查询数会随品牌配对数量变化"
          },
          "selectedModels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "参与分析的模型 ID 列表。推荐使用开发者公共模型 ID：mita, zhipu, ernie, hunyuan, deepseek, kimi, spark, doubao, qianwen。"
          },
          "region": {
            "type": "string",
            "description": "区域信息（可选）"
          },
          "industry": {
            "type": "string",
            "description": "行业信息（可选）"
          },
          "description": {
            "type": "string",
            "description": "任务描述"
          }
        }
      },
      "BrandMonitoringRequest": {
        "type": "object",
        "required": [
          "keyword",
          "targetBrand"
        ],
        "properties": {
          "keyword": {
            "type": "string",
            "description": "监控关键词",
            "example": "推荐最好的 GEO 优化工具"
          },
          "targetBrand": {
            "type": "string",
            "description": "目标品牌名称",
            "example": "SheepGeo"
          },
          "brandAliases": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "品牌别名数组",
            "example": [
              "SheepGeo",
              "SheepGeo"
            ]
          },
          "description": {
            "type": "string",
            "description": "业务场景描述"
          },
          "monitoringFrequency": {
            "type": "string",
            "enum": [
              "hourly",
              "daily",
              "weekly"
            ],
            "default": "daily",
            "description": "监控频率"
          },
          "runImmediately": {
            "type": "boolean",
            "default": true,
            "description": "创建后是否立即加入首轮执行队列"
          }
        }
      },
      "AnalyzeResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string",
                "description": "分析任务 ID"
              },
              "url": {
                "type": "string"
              },
              "gemScore": {
                "type": "number",
                "description": "GEM 综合评分 (0-100)"
              },
              "sheepScores": {
                "type": "object",
                "properties": {
                  "semantic": {
                    "type": "number",
                    "description": "S - 语义覆盖"
                  },
                  "credibility": {
                    "type": "number",
                    "description": "H - 人类可信度"
                  },
                  "structuring": {
                    "type": "number",
                    "description": "E - 证据结构化"
                  },
                  "integration": {
                    "type": "number",
                    "description": "E - 生态集成"
                  },
                  "performance": {
                    "type": "number",
                    "description": "P - 性能监测"
                  }
                }
              },
              "grade": {
                "type": "string",
                "enum": [
                  "A+",
                  "A",
                  "B+",
                  "B",
                  "C+",
                  "C",
                  "D",
                  "F"
                ],
                "description": "评级"
              },
              "recommendations": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "优化建议"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "AiVisibilityResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string",
                "description": "任务 ID。创建任务后用于轮询查询结果。"
              },
              "url": {
                "type": "string"
              },
              "inputType": {
                "type": "string",
                "enum": [
                  "url",
                  "brand"
                ],
                "description": "输入类型"
              },
              "status": {
                "type": "string",
                "description": "任务状态。running/pending 表示仍在执行，completed 表示结果已可读取，failed 表示失败。"
              },
              "models": {
                "type": "array",
                "description": "本次任务选择的开发者公共模型 ID。创建任务响应中返回。",
                "items": {
                  "type": "string"
                }
              },
              "message": {
                "type": "string",
                "description": "任务创建提示信息"
              },
              "queryUrl": {
                "type": "string",
                "description": "任务查询路径"
              },
              "results": {
                "type": "array",
                "description": "任务完成后的逐模型检测结果。创建任务或任务未完成时可能为空或不存在。",
                "items": {
                  "type": "object",
                  "properties": {
                    "modelId": {
                      "type": "string",
                      "description": "开发者公共模型 ID"
                    },
                    "visible": {
                      "type": "boolean"
                    },
                    "confidence": {
                      "type": "number"
                    },
                    "description": {
                      "type": "string"
                    },
                    "recommendations": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "rawResponse": {
                      "type": "string",
                      "description": "模型原始回答文本"
                    },
                    "searchReferences": {
                      "type": "array",
                      "description": "该模型回答返回的联网引用来源；模型或供应商未返回结构化信源时为空数组。",
                      "items": {
                        "$ref": "#/components/schemas/SearchReference"
                      }
                    }
                  }
                }
              },
              "summary": {
                "type": "object",
                "properties": {
                  "total": {
                    "type": "integer"
                  },
                  "visible": {
                    "type": "integer"
                  },
                  "recognitionRate": {
                    "type": "number"
                  },
                  "errorCount": {
                    "type": "integer"
                  }
                }
              },
              "recommendation": {
                "type": "object",
                "nullable": true,
                "description": "推荐分析结果；没有推荐分析时为 null。若明细包含 targetBrandRank/rank/position 等排名字段，会额外返回 top3Rate、firstRecommendationRate、recommendationQualityScore。"
              },
              "creditsConsumed": {
                "type": "integer",
                "description": "创建任务时消耗的开发者 AI calls。AI 可见性按模型数计费，每个模型 1 次调用。"
              },
              "quotaRemaining": {
                "type": "integer",
                "description": "创建任务后剩余开发者 AI calls"
              },
              "billingMode": {
                "type": "string",
                "enum": [
                  "quota",
                  "api_prepaid"
                ],
                "description": "扣费模式。quota 表示次数配额；api_prepaid 表示企业 API 预付费。"
              },
              "amountYuan": {
                "type": "number",
                "nullable": true,
                "description": "企业 API 预付费本次扣费金额；按客户固定模型价格计算。"
              },
              "balanceRemainingYuan": {
                "type": "number",
                "nullable": true,
                "description": "企业 API 预付费扣费后余额。"
              },
              "pricing": {
                "type": "array",
                "description": "企业 API 预付费逐模型价格明细。",
                "items": {
                  "type": "object"
                }
              },
              "createdAt": {
                "type": "string",
                "format": "date-time"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "KeywordPollingResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string"
              },
              "keyword": {
                "type": "string"
              },
              "brandName": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "pending",
                  "generating",
                  "detecting",
                  "executing",
                  "completed",
                  "failed",
                  "cancelled"
                ],
                "description": "任务状态。浏览器取证、品牌识别和报告收尾未全部结束时保持非 completed 状态。"
              },
              "progress": {
                "type": "integer"
              },
              "phase": {
                "type": "string",
                "enum": [
                  "queued",
                  "preparing",
                  "generating_queries",
                  "detecting",
                  "waiting_device",
                  "waiting_retry",
                  "analyzing",
                  "cancelling",
                  "completed",
                  "failed",
                  "cancelled"
                ],
                "description": "更细的进度阶段（建议用它展示进度，status 保持原样兼容老接入）：queued 排队中 / preparing 准备中 / generating_queries 生成问题 / detecting 向 AI 提问中 / waiting_device 等检测设备空闲 / waiting_retry 等待自动重试 / analyzing 识别品牌并汇总 / cancelling 取消中 / completed / failed / cancelled。"
              },
              "phaseText": {
                "type": "string",
                "description": "给人看的一句进度说明，如「排队中，前面约 37 个任务」「正在向 AI 提问，已完成 2/4」「等待自动重试，预计 14:30（北京时间）开始（第 2/3 次）」。"
              },
              "queue": {
                "type": "object",
                "nullable": true,
                "description": "仅 phase=queued 时有值；按优先级与建单时间估算，实际可能有小幅出入。",
                "properties": {
                  "position": {
                    "type": "integer"
                  },
                  "ahead": {
                    "type": "integer"
                  }
                }
              },
              "progressDetail": {
                "type": "object",
                "nullable": true,
                "description": "按「问题 × 模型」格子计数；仅深度检测任务有值。",
                "properties": {
                  "totalCells": {
                    "type": "integer"
                  },
                  "answeredCells": {
                    "type": "integer",
                    "description": "已拿到有效回答"
                  },
                  "unavailableCells": {
                    "type": "integer",
                    "description": "没拿到有效回答（不收费 / 会退回）"
                  },
                  "pendingCells": {
                    "type": "integer",
                    "description": "还没完成"
                  },
                  "askingCells": {
                    "type": "integer",
                    "description": "待完成里正在提问的"
                  },
                  "waitingDeviceCells": {
                    "type": "integer",
                    "description": "待完成里排队等检测设备的"
                  },
                  "models": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "modelId": {
                          "type": "string"
                        },
                        "modelName": {
                          "type": "string"
                        },
                        "total": {
                          "type": "integer"
                        },
                        "answered": {
                          "type": "integer"
                        },
                        "unavailable": {
                          "type": "integer"
                        },
                        "pending": {
                          "type": "integer"
                        },
                        "asking": {
                          "type": "integer"
                        },
                        "waitingDevice": {
                          "type": "integer"
                        }
                      }
                    }
                  }
                }
              },
              "timing": {
                "type": "object",
                "properties": {
                  "startedAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "开始执行时间"
                  },
                  "lastAnswerAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "最近一次拿到回答的时间，可用来判断任务是否还在推进"
                  },
                  "retryAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "下次自动重试时间（phase=waiting_retry）"
                  }
                }
              },
              "refund": {
                "type": "object",
                "nullable": true,
                "description": "任务结束（completed / failed / cancelled）后才有值：没拿到回答或被取消的部分已退回多少。",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "refunded",
                      "none"
                    ]
                  },
                  "amountYuan": {
                    "type": "number"
                  },
                  "credits": {
                    "type": "integer"
                  }
                }
              },
              "queries": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "modelId": {
                      "type": "string"
                    },
                    "query": {
                      "type": "string"
                    },
                    "order": {
                      "type": "integer"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "queryId": {
                      "type": "integer"
                    },
                    "modelId": {
                      "type": "string"
                    },
                    "modelName": {
                      "type": "string",
                      "description": "模型显示名称"
                    },
                    "queryText": {
                      "type": "string"
                    },
                    "fullResponse": {
                      "type": "string",
                      "description": "模型完整回答正文。任务完成后返回；可用于客户侧复核、展示和二次品牌提取。"
                    },
                    "responseLength": {
                      "type": "integer",
                      "description": "模型回答正文长度"
                    },
                    "detectionStatus": {
                      "type": "string",
                      "description": "本次检测状态，success 表示纳入统计；unavailable/failed 表示本次未形成有效回答。"
                    },
                    "unavailableReason": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "temporarily_unavailable",
                        "not_supported",
                        "no_valid_answer"
                      ],
                      "description": "检测不可用的粗粒度原因；成功时为 null。temporarily_unavailable=该模型通道暂时不可用（可稍后重试），not_supported=当前请求或能力不支持，no_valid_answer=未获得有效回答。"
                    },
                    "errorMessage": {
                      "type": "string",
                      "nullable": true,
                      "description": "检测失败的固定对外提示文案（不含内部细节）；成功时为 null。"
                    },
                    "mentionedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedEntities": {
                      "type": "object"
                    },
                    "brandRecognition": {
                      "type": "object",
                      "nullable": true,
                      "description": "该回答的品牌识别账本，包含 status、evidence_by_brand 等字段；未开启或未生成时为 null。"
                    },
                    "brandRecognitionStatus": {
                      "type": "string",
                      "nullable": true,
                      "description": "该回答的品牌识别状态，常见值为 completed/partial_failed/failed/skipped。"
                    },
                    "targetBrandMentioned": {
                      "type": "boolean"
                    },
                    "targetBrandRank": {
                      "type": "integer",
                      "nullable": true
                    },
                    "brandRankings": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "searchReferences": {
                      "type": "array",
                      "description": "AI 回答返回的联网引用来源；模型或供应商未返回结构化信源时为空数组。",
                      "items": {
                        "$ref": "#/components/schemas/SearchReference"
                      }
                    },
                    "videoRefs": {
                      "type": "array",
                      "description": "部分模型返回的视频引用；没有时为空数组。",
                      "items": {
                        "type": "object"
                      }
                    },
                    "evidence": {
                      "$ref": "#/components/schemas/BrowserEvidenceResponse",
                      "description": "该次检测的浏览器证据。仅 DeepSeek/豆包/文心/通义千问且请求 evidence 后可能返回截图或录屏。"
                    },
                    "responseTimeMs": {
                      "type": "integer"
                    },
                    "detectedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "summary": {
                "type": "object",
                "properties": {
                  "totalQueries": {
                    "type": "integer"
                  },
                  "totalDetections": {
                    "type": "integer",
                    "description": "总检测次数；展示“X/Y 次提及”时应使用该字段作为分母。"
                  },
                  "total_detections": {
                    "type": "integer",
                    "description": "总检测次数，下划线兼容字段。"
                  },
                  "effectiveDetections": {
                    "type": "integer",
                    "description": "有效检测次数，仅 success 行计入。"
                  },
                  "effective_detections": {
                    "type": "integer",
                    "description": "有效检测次数，下划线兼容字段。"
                  },
                  "unavailableDetections": {
                    "type": "integer",
                    "description": "不可用检测次数。"
                  },
                  "unavailable_detections": {
                    "type": "integer",
                    "description": "不可用检测次数，下划线兼容字段。"
                  },
                  "totalRecommendations": {
                    "type": "integer",
                    "description": "目标品牌命中次数；展示“X/Y 次提及”时应使用该字段作为分子。"
                  },
                  "total_recommendations": {
                    "type": "integer",
                    "description": "目标品牌命中次数，下划线兼容字段。"
                  },
                  "recommendationRate": {
                    "type": "number",
                    "description": "目标品牌推荐率，等同于命中次数 / 有效检测次数。"
                  },
                  "recommendation_rate": {
                    "type": "number",
                    "description": "目标品牌推荐率，下划线兼容字段。"
                  },
                  "hasRankData": {
                    "type": "boolean",
                    "description": "是否存在可用于计算 TOP3 率和首推率的排名数据。"
                  },
                  "rankedCount": {
                    "type": "integer",
                    "description": "有目标品牌排名的有效检测条数。"
                  },
                  "top3Count": {
                    "type": "integer",
                    "description": "目标品牌进入推荐排名前三的次数。"
                  },
                  "top3Rate": {
                    "type": "number",
                    "nullable": true,
                    "description": "TOP3 推荐率；没有排名数据时为 null。"
                  },
                  "top3_rate": {
                    "type": "number",
                    "nullable": true,
                    "description": "TOP3 推荐率，下划线兼容字段。"
                  },
                  "firstRecommendationCount": {
                    "type": "integer",
                    "description": "目标品牌排名第一的次数。"
                  },
                  "firstRecommendationRate": {
                    "type": "number",
                    "nullable": true,
                    "description": "首推率；没有排名数据时为 null。"
                  },
                  "first_recommendation_rate": {
                    "type": "number",
                    "nullable": true,
                    "description": "首推率，下划线兼容字段。"
                  },
                  "bestRank": {
                    "type": "integer",
                    "nullable": true,
                    "description": "目标品牌最佳推荐排名。"
                  },
                  "avgRank": {
                    "type": "number",
                    "nullable": true,
                    "description": "目标品牌平均推荐排名。"
                  },
                  "recommendationQualityScore": {
                    "type": "number",
                    "nullable": true,
                    "description": "推荐质量分，按推荐率 20%、TOP3 率 30%、首推率 50% 加权；没有排名数据时为 null。"
                  },
                  "brandRecognitionStatus": {
                    "type": "string",
                    "nullable": true,
                    "description": "任务级品牌识别状态。"
                  },
                  "brandRecognitionProgress": {
                    "type": "integer",
                    "description": "任务级品牌识别进度。"
                  },
                  "brandRecognitionError": {
                    "type": "string",
                    "nullable": true,
                    "description": "任务级品牌识别错误；没有错误时为 null。"
                  },
                  "brandRankings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "brand": {
                          "type": "string"
                        },
                        "mentionCount": {
                          "type": "integer"
                        },
                        "percentage": {
                          "type": "number"
                        }
                      }
                    }
                  }
                }
              },
              "evidence": {
                "$ref": "#/components/schemas/BrowserEvidenceResponse",
                "description": "任务级 evidence 状态汇总。逐检测证据见 results[].evidence。"
              },
              "evidenceExtraCredits": {
                "type": "integer",
                "description": "因 evidence 对普通次数配额增加的额外 AI calls。企业 API 预付费不会用该值放大模型单价或 amountYuan。"
              },
              "creditsConsumed": {
                "type": "integer",
                "description": "创建任务时消耗的开发者 AI calls。普通次数配额会包含 evidence 额外次数；企业 API 预付费仅作等效次数展示，实际金额按固定模型价格结算。"
              },
              "quotaRemaining": {
                "type": "integer",
                "description": "创建任务后剩余开发者 AI calls"
              },
              "billingMode": {
                "type": "string",
                "enum": [
                  "quota",
                  "api_prepaid"
                ],
                "description": "扣费模式。quota 表示次数配额；api_prepaid 表示企业 API 预付费。"
              },
              "amountYuan": {
                "type": "number",
                "nullable": true,
                "description": "企业 API 预付费本次扣费金额；按客户固定模型价格计算，不因 evidence 动态翻倍。"
              },
              "balanceRemainingYuan": {
                "type": "number",
                "nullable": true,
                "description": "企业 API 预付费扣费后余额。"
              },
              "pricing": {
                "type": "array",
                "description": "企业 API 预付费逐模型价格明细。",
                "items": {
                  "type": "object"
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "PrecisionSamplingResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string"
              },
              "analysisType": {
                "type": "string",
                "example": "precision_sampling"
              },
              "query": {
                "type": "string"
              },
              "brandName": {
                "type": "string"
              },
              "repetitionCount": {
                "type": "integer"
              },
              "status": {
                "type": "string"
              },
              "progress": {
                "type": "integer"
              },
              "modelCount": {
                "type": "integer"
              },
              "totalDetections": {
                "type": "integer"
              },
              "summary": {
                "type": "object"
              },
              "samplingStats": {
                "type": "object"
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "queryId": {
                      "type": "integer"
                    },
                    "modelId": {
                      "type": "string"
                    },
                    "queryText": {
                      "type": "string"
                    },
                    "mentionedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedEntities": {
                      "type": "object"
                    },
                    "targetBrandMentioned": {
                      "type": "boolean"
                    },
                    "brandRankings": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "searchReferences": {
                      "type": "array",
                      "description": "该次重复检测中 AI 回答返回的联网引用来源；模型或供应商未返回结构化信源时为空数组。",
                      "items": {
                        "$ref": "#/components/schemas/SearchReference"
                      }
                    },
                    "responseTimeMs": {
                      "type": "integer"
                    },
                    "responseLength": {
                      "type": "integer"
                    },
                    "fullResponse": {
                      "type": "string",
                      "nullable": true,
                      "description": "模型完整回答文本"
                    },
                    "detectedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "CompetitorAnalysisResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string"
              },
              "analysisType": {
                "type": "string",
                "example": "competitor_analysis"
              },
              "analysisVersion": {
                "type": "string",
                "enum": [
                  "v1",
                  "v2"
                ],
                "example": "v2"
              },
              "targetBrand": {
                "type": "string"
              },
              "competitors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "dimensions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "queriesPerDimension": {
                "type": "integer"
              },
              "status": {
                "type": "string"
              },
              "progress": {
                "type": "integer"
              },
              "modelCount": {
                "type": "integer"
              },
              "queryCount": {
                "type": "integer"
              },
              "totalGeneratedQueries": {
                "type": "integer"
              },
              "totalDetections": {
                "type": "integer"
              },
              "summary": {
                "type": "object",
                "description": "V2 分轨汇总；旧任务可能返回 V1 字段。",
                "properties": {
                  "analysis_version": {
                    "type": "string",
                    "example": "v2"
                  },
                  "data_quality": {
                    "type": "object",
                    "description": "计划、成功、失败、缺失检测数，完整度和可排名状态。"
                  },
                  "organic_recommendation": {
                    "type": "object",
                    "description": "无品牌开放问题中的模型宏平均自然推荐率与提及率。"
                  },
                  "multi_brand_scorecard": {
                    "type": "object",
                    "description": "仅按实际曝光品牌计算的模型宏平均偏好率。"
                  },
                  "pairwise_matrix": {
                    "type": "object",
                    "description": "两两比较中的胜出、并列、条件性与无结论统计。"
                  }
                }
              },
              "results": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "queryId": {
                      "type": "integer"
                    },
                    "modelId": {
                      "type": "string"
                    },
                    "queryText": {
                      "type": "string"
                    },
                    "queryType": {
                      "type": "string",
                      "enum": [
                        "open_market",
                        "multi_brand",
                        "pairwise"
                      ]
                    },
                    "exposedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "recommendedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "verdictType": {
                      "type": "string",
                      "enum": [
                        "winner",
                        "tie",
                        "conditional",
                        "none"
                      ]
                    },
                    "winnerBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "verdictReason": {
                      "type": "string",
                      "nullable": true
                    },
                    "verdictEvidence": {
                      "type": "string",
                      "nullable": true
                    },
                    "mentionedUrls": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "mentionedEntities": {
                      "type": "object"
                    },
                    "targetBrandMentioned": {
                      "type": "boolean"
                    },
                    "competitorMatches": {
                      "type": "object",
                      "description": "兼容字段：比较题中各曝光品牌是否进入 winnerBrands；开放市场题为空对象。"
                    },
                    "brandRankings": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "searchReferences": {
                      "type": "array",
                      "description": "该次竞品分析中 AI 回答返回的联网引用来源；模型或供应商未返回结构化信源时为空数组。",
                      "items": {
                        "$ref": "#/components/schemas/SearchReference"
                      }
                    },
                    "responseTimeMs": {
                      "type": "integer"
                    },
                    "responseLength": {
                      "type": "integer"
                    },
                    "detectionStatus": {
                      "type": "string"
                    },
                    "unavailableReason": {
                      "type": "string",
                      "nullable": true,
                      "enum": [
                        "temporarily_unavailable",
                        "not_supported",
                        "no_valid_answer"
                      ],
                      "description": "检测不可用的粗粒度原因；成功时为 null。"
                    },
                    "errorMessage": {
                      "type": "string",
                      "nullable": true
                    },
                    "fullResponse": {
                      "type": "string",
                      "nullable": true,
                      "description": "模型完整回答文本"
                    },
                    "detectedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "BrandMonitoringLatestStats": {
        "type": "object",
        "properties": {
          "mentionRate": {
            "type": "integer"
          },
          "avgRank": {
            "type": "string",
            "nullable": true
          },
          "bestRank": {
            "type": "integer",
            "nullable": true
          },
          "mentionedCount": {
            "type": "integer"
          },
          "totalModels": {
            "type": "integer"
          },
          "hasRankData": {
            "type": "boolean",
            "description": "是否存在可用于计算 TOP3 率和首推率的排名数据。"
          },
          "rankedCount": {
            "type": "integer",
            "description": "有目标品牌排名的检测条数。"
          },
          "top3Count": {
            "type": "integer",
            "description": "目标品牌进入前三的次数。"
          },
          "top3Rate": {
            "type": "number",
            "nullable": true,
            "description": "TOP3 推荐率；没有排名数据时为 null。"
          },
          "firstRecommendationCount": {
            "type": "integer",
            "description": "目标品牌排名第一的次数。"
          },
          "firstRecommendationRate": {
            "type": "number",
            "nullable": true,
            "description": "首推率；没有排名数据时为 null。"
          },
          "recommendationQualityScore": {
            "type": "number",
            "nullable": true,
            "description": "推荐质量分，按推荐率 20%、TOP3 率 30%、首推率 50% 加权；没有排名数据时为 null。"
          }
        }
      },
      "BrandMonitoringListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "tasks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "taskId": {
                      "type": "string"
                    },
                    "keyword": {
                      "type": "string"
                    },
                    "targetBrand": {
                      "type": "string"
                    },
                    "monitoringFrequency": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "progress": {
                      "type": "integer"
                    },
                    "latestStats": {
                      "$ref": "#/components/schemas/BrandMonitoringLatestStats"
                    },
                    "estimatedCreditsPerRun": {
                      "type": "integer"
                    },
                    "nextRunAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "lastDetectedAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    }
                  }
                }
              },
              "count": {
                "type": "integer"
              },
              "estimatedCreditsPerRun": {
                "type": "integer"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "BrandMonitoringTaskResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "taskId": {
                "type": "string"
              },
              "keyword": {
                "type": "string"
              },
              "targetBrand": {
                "type": "string"
              },
              "monitoringFrequency": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "progress": {
                "type": "integer"
              },
              "estimatedCreditsPerRun": {
                "type": "integer"
              },
              "latestStats": {
                "$ref": "#/components/schemas/BrandMonitoringLatestStats"
              },
              "latestResults": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "modelId": {
                      "type": "string"
                    },
                    "targetBrandRank": {
                      "type": "integer",
                      "nullable": true
                    },
                    "targetBrandMentioned": {
                      "type": "boolean"
                    },
                    "brandRankings": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "searchReferences": {
                      "type": "array",
                      "description": "最近一轮品牌监控中该模型回答返回的联网引用来源；模型或供应商未返回结构化信源时为空数组。",
                      "items": {
                        "$ref": "#/components/schemas/SearchReference"
                      }
                    },
                    "fullResponse": {
                      "type": "string",
                      "nullable": true,
                      "description": "模型完整回答文本"
                    },
                    "mentionedBrands": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "brandAttitude": {
                      "type": "string",
                      "nullable": true
                    },
                    "brandAttitudeScore": {
                      "type": "number",
                      "nullable": true
                    },
                    "brandAttitudeKeywords": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "detectedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              },
              "trendData": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string"
                    },
                    "avgRank": {
                      "type": "number",
                      "nullable": true
                    },
                    "mentionRate": {
                      "type": "integer"
                    }
                  }
                }
              },
              "availableDates": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "EffectTrackingAssetRequest": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "已发布内容 URL",
            "example": "https://media.example.com/articles/sheepgeo-case-study"
          },
          "title": {
            "type": "string",
            "description": "内容标题；不传时会尝试自动抓取页面标题"
          },
          "platform": {
            "type": "string",
            "description": "内容平台或来源",
            "example": "media"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "发布时间"
          },
          "authorName": {
            "type": "string",
            "description": "作者或发布账号"
          },
          "campaignId": {
            "type": "string",
            "description": "客户侧活动 ID，会写入 metadata"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "内容标签数组，会写入 metadata"
          }
        }
      },
      "EffectTrackingAssetUpdateRequest": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "nullable": true
          },
          "platform": {
            "type": "string",
            "nullable": true
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "authorName": {
            "type": "string",
            "nullable": true
          },
          "assetStatus": {
            "type": "string",
            "enum": [
              "active",
              "archived"
            ],
            "description": "内容资产状态"
          }
        }
      },
      "EffectTrackingAsset": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "enterprise_id": {
            "type": "integer",
            "nullable": true
          },
          "owner_user_id": {
            "type": "string"
          },
          "source_type": {
            "type": "string"
          },
          "platform": {
            "type": "string",
            "nullable": true
          },
          "url": {
            "type": "string"
          },
          "normalized_url": {
            "type": "string"
          },
          "canonical_url": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "author_name": {
            "type": "string",
            "nullable": true
          },
          "published_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "excerpt": {
            "type": "string",
            "nullable": true
          },
          "asset_status": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          },
          "citation_count": {
            "type": "integer"
          },
          "strong_citation_count": {
            "type": "integer"
          },
          "last_cited_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "cited_models": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "EffectTrackingMatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "source_type": {
            "type": "string"
          },
          "task_id": {
            "type": "integer",
            "nullable": true
          },
          "model_id": {
            "type": "string",
            "nullable": true
          },
          "model_name": {
            "type": "string",
            "nullable": true
          },
          "query_text": {
            "type": "string",
            "nullable": true
          },
          "reference_title": {
            "type": "string",
            "nullable": true
          },
          "reference_url": {
            "type": "string",
            "nullable": true
          },
          "match_type": {
            "type": "string"
          },
          "match_score": {
            "type": "number"
          },
          "evidence": {
            "type": "object"
          },
          "matched_at": {
            "type": "string",
            "format": "date-time"
          },
          "asset_id": {
            "type": "integer"
          },
          "asset_title": {
            "type": "string",
            "nullable": true
          },
          "asset_platform": {
            "type": "string",
            "nullable": true
          },
          "asset_url": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "EffectTrackingAssetResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "asset": {
                "$ref": "#/components/schemas/EffectTrackingAsset"
              },
              "matches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EffectTrackingMatch"
                }
              },
              "queryUrl": {
                "type": "string"
              },
              "matchesUrl": {
                "type": "string"
              },
              "archived": {
                "type": "boolean"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "EffectTrackingAssetListResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "assets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EffectTrackingAsset"
                }
              },
              "count": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              },
              "offset": {
                "type": "integer"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "EffectTrackingBulkImportRequest": {
        "type": "object",
        "properties": {
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EffectTrackingAssetRequest"
            },
            "description": "要导入的内容资产数组"
          },
          "rawText": {
            "type": "string",
            "description": "按行导入 URL，或配合 format=csv 使用 CSV 文本"
          },
          "format": {
            "type": "string",
            "enum": [
              "urls",
              "csv"
            ],
            "default": "urls"
          }
        }
      },
      "EffectTrackingBulkImportResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "created": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EffectTrackingAsset"
                }
              },
              "failed": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              },
              "total": {
                "type": "integer"
              },
              "successCount": {
                "type": "integer"
              },
              "failureCount": {
                "type": "integer"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "EffectTrackingMatchesResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "assetId": {
                "type": "integer"
              },
              "matches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EffectTrackingMatch"
                }
              },
              "count": {
                "type": "integer"
              },
              "total": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "EffectTrackingSummaryResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "totals": {
                "type": "object",
                "properties": {
                  "totalAssets": {
                    "type": "integer"
                  },
                  "citedAssets": {
                    "type": "integer"
                  },
                  "totalCitations": {
                    "type": "integer"
                  },
                  "recentCitedAssets": {
                    "type": "integer"
                  },
                  "citationRate": {
                    "type": "integer"
                  }
                }
              },
              "topAssets": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "modelDistribution": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "platformDistribution": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "sourceDistribution": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "citationTrend": {
                "type": "array",
                "items": {
                  "type": "object"
                }
              },
              "recentMatches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EffectTrackingMatch"
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "BalanceResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "data": {
            "type": "object",
            "properties": {
              "balance": {
                "type": "object",
                "properties": {
                  "availableAiCalls": {
                    "type": "integer"
                  },
                  "totalPurchased": {
                    "type": "integer"
                  },
                  "totalGranted": {
                    "type": "integer"
                  },
                  "totalUsed": {
                    "type": "integer"
                  },
                  "nextExpiryAt": {
                    "type": "string",
                    "format": "date-time",
                    "nullable": true,
                    "description": "若存在临期的试用/活动赠送额度，返回最近到期时间；已购配额默认返回 null。"
                  },
                  "lowBalance": {
                    "type": "boolean"
                  }
                }
              },
              "currentKey": {
                "type": "object",
                "properties": {
                  "keyId": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "rateLimitPerMinute": {
                    "type": "integer"
                  },
                  "rateLimitPerDay": {
                    "type": "integer"
                  }
                }
              },
              "packages": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "integer"
                    },
                    "orderNo": {
                      "type": "string",
                      "nullable": true
                    },
                    "packageId": {
                      "type": "string",
                      "nullable": true
                    },
                    "packageName": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    },
                    "sourceLabel": {
                      "type": "string"
                    },
                    "addedAiCalls": {
                      "type": "integer"
                    },
                    "usedAiCalls": {
                      "type": "integer"
                    },
                    "remainingAiCalls": {
                      "type": "integer"
                    },
                    "validUntil": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true,
                      "description": "仅对带有效期的赠送/试用额度返回；已购配额默认返回 null。"
                    },
                    "expiresInDays": {
                      "type": "integer",
                      "nullable": true,
                      "description": "仅对带有效期的赠送/试用额度返回；已购配额默认返回 null。"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      },
      "ResponseMeta": {
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "creditsConsumed": {
            "type": "integer"
          },
          "remainingCredits": {
            "type": "integer"
          },
          "billingMode": {
            "type": "string",
            "enum": [
              "quota",
              "api_prepaid"
            ]
          },
          "amountYuan": {
            "type": "number",
            "nullable": true,
            "description": "企业 API 预付费本次扣费金额；按固定模型价格结算。"
          },
          "balanceRemainingYuan": {
            "type": "number",
            "nullable": true,
            "description": "企业 API 预付费扣费后余额。"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/ResponseMeta"
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "请求参数错误",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "VALIDATION_ERROR",
                "message": "参数验证失败"
              }
            }
          }
        }
      },
      "Unauthorized": {
        "description": "API Key 无效或缺失",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "UNAUTHORIZED",
                "message": "无效的 API Key"
              }
            }
          }
        }
      },
      "InsufficientCredits": {
        "description": "AI 调用配额不足",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "NO_CREDITS",
                "message": "配额不足，请购买套餐"
              }
            }
          }
        }
      },
      "RateLimitExceeded": {
        "description": "请求频率超限",
        "headers": {
          "X-RateLimit-Limit": {
            "description": "请求频率上限",
            "schema": {
              "type": "integer"
            }
          },
          "X-RateLimit-Remaining": {
            "description": "剩余请求次数",
            "schema": {
              "type": "integer"
            }
          },
          "Retry-After": {
            "description": "重试等待时间（秒）",
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "RATE_LIMIT_EXCEEDED",
                "message": "每分钟请求次数超限"
              }
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "服务暂不可用",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            },
            "example": {
              "success": false,
              "error": {
                "code": "SERVICE_UNAVAILABLE",
                "message": "品牌监控功能正在临时维护中，暂不可用。"
              }
            }
          }
        }
      },
      "InternalError": {
        "description": "服务器内部错误",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorResponse"
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ]
}