# 检测 AI 风格的文本 (/zh/api/admin/deslop)

<!-- agent-signals: reading_time_min: 2 · est_tokens: 1812 · updated: 2026-07-30 -->
Related: [触发自动化](/zh/api/automations/trigger.md), [创建 assistant 消息](/zh/api/assistant/create-assistant-message-v2.md)

此端点分析文档页面中是否存在 AI 生成的文本，并返回被标记的段落以及建议的人类风格改写。

使用[管理员 API 密钥](/zh/api/introduction#admin-api-key)进行身份验证。

<div id="credits">
  ## 积分 [#积分]
</div>

* 每检查一个页面消耗 1 个 AI 积分。
* 少于 50 个词的页面会被跳过，不计费。响应中会返回 `skipped: "too_short"`，且 `creditsCharged: 0`。
* 如果检测暂时不可用，端点会返回 `503`，不扣除积分。
* 该端点针对每个客户端 IP 地址每分钟最多接受 30 个请求。

<div id="response">
  ## 响应 [#响应]
</div>

已检查的页面会返回判定结果（`predictionShort`）、AI 撰写和人类撰写的比例，以及包含被标记段落的 `windows` 数组。每个 window 包含一个行号范围，并可包含一到三条建议的改写。

<div id="usage">
  ## 用法 [#用法]
</div>

```bash
curl -X POST https://api.mintlify.com/v1/deslop/{projectId} \
  -H "Authorization: Bearer mint_xxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "guides/quickstart.mdx",
    "content": "# Quickstart\n\nWelcome to our comprehensive documentation..."
  }'
```

`POST /v1/deslop/{projectId}`

分析页面中是否存在 AI 生成的文本，并返回被标记的段落以及建议的改写。每检查一个页面消耗 1 个 AI 积分。少于 50 个词的页面会被跳过。针对每个客户端 IP 地址每分钟最多 30 个请求。

## OpenAPI

```json
{
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "parameters": [
    {
      "name": "projectId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      },
      "description": "你的项目 ID。可从你的控制台中的 [API keys](https://app.mintlify.com/settings/organization/api-keys) 页面复制。"
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "path",
            "content"
          ],
          "properties": {
            "path": {
              "type": "string",
              "minLength": 1,
              "description": "页面的仓库相对路径，仅用于报告。"
            },
            "content": {
              "type": "string",
              "maxLength": 1000000,
              "description": "要检查的页面的原始 MDX 或 Markdown 内容。"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "页面已被检查，或因过短而被跳过。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "path",
              "skipped",
              "creditsCharged"
            ],
            "properties": {
              "path": {
                "type": "string",
                "description": "请求中传入的 path。"
              },
              "skipped": {
                "type": "string",
                "nullable": true,
                "enum": [
                  "too_short",
                  null
                ],
                "description": "页面被跳过的原因；如果页面已被检查则为 null。`too_short` 表示页面正文少于 50 个词，且未被计费。"
              },
              "predictionShort": {
                "type": "string",
                "enum": [
                  "AI",
                  "AI-Assisted",
                  "Human",
                  "Mixed"
                ],
                "description": "页面的整体判定结果。仅在页面已被检查时出现。"
              },
              "fractionAi": {
                "type": "number",
                "description": "被识别为 AI 生成的页面比例（0-1）。"
              },
              "fractionAiAssisted": {
                "type": "number",
                "description": "被识别为 AI 辅助的比例（0-1）。"
              },
              "fractionHuman": {
                "type": "number",
                "description": "被识别为人类撰写的比例（0-1）。"
              },
              "windows": {
                "type": "array",
                "description": "被标记的（非人类）段落。仅在页面已被检查时出现。",
                "items": {
                  "type": "object",
                  "required": [
                    "text",
                    "label",
                    "aiAssistanceScore",
                    "startLine",
                    "endLine"
                  ],
                  "properties": {
                    "text": {
                      "type": "string",
                      "description": "被标记的段落文本。"
                    },
                    "label": {
                      "type": "string",
                      "description": "段落的检测标签，例如 `AI-Generated`。"
                    },
                    "aiAssistanceScore": {
                      "type": "number",
                      "description": "段落的 AI 辅助评分（0-1）。"
                    },
                    "confidence": {
                      "description": "检测置信度，返回值可能为 `High` 之类的标签或数值。",
                      "oneOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "startLine": {
                      "type": "integer",
                      "description": "段落在原始内容中的起始行号（从 1 开始）。"
                    },
                    "endLine": {
                      "type": "integer",
                      "description": "段落在原始内容中的结束行号（从 1 开始）。"
                    },
                    "rewrites": {
                      "type": "array",
                      "description": "建议的人类风格改写。",
                      "items": {
                        "type": "object",
                        "required": [
                          "text",
                          "rationale"
                        ],
                        "properties": {
                          "text": {
                            "type": "string",
                            "description": "改写后的段落。"
                          },
                          "rationale": {
                            "type": "string",
                            "description": "该改写更贴近人类风格的原因。"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "creditsCharged": {
                "type": "integer",
                "description": "本次请求扣除的 AI 积分数（被跳过时为 0）。"
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "请求体无效。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "错误消息。"
              }
            }
          }
        }
      }
    },
    "402": {
      "description": "AI 积分不足。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "错误消息。"
              }
            }
          }
        }
      }
    },
    "429": {
      "description": "超出速率限制。",
      "content": {
        "text/plain": {
          "schema": {
            "type": "string",
            "example": "请求过多，请稍后再试。"
          }
        }
      }
    },
    "500": {
      "description": "处理页面时发生了意外错误。"
    },
    "503": {
      "description": "检测暂时不可用。不扣除积分。",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "error": {
                "type": "string",
                "description": "错误消息。"
              }
            }
          }
        }
      }
    }
  }
}
```
