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

# 检测 AI 风格的文本

> 分析文档页面中是否存在 AI 生成的文本，并返回被标记的段落以及建议的人类风格改写。每检查一个页面消耗 1 个 AI 积分。少于 50 个词的页面会被跳过，不计费。

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

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

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

* 每检查一个页面消耗 1 个 AI 积分。
* 少于 50 个词的页面会被跳过，不计费。响应中会返回 `skipped: "too_short"`，且 `creditsCharged: 0`。
* 如果检测暂时不可用，端点会返回 `503`，不扣除积分。

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

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

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

```bash theme={null}
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..."
  }'
```


## OpenAPI

````yaml zh/admin-openapi.json POST /v1/deslop/{projectId}
openapi: 3.0.1
info:
  title: Mintlify Admin API
  description: 用于管理操作的 API，包括文档更新和代理管理。
  version: 2.0.0
servers:
  - url: https://api.mintlify.com
security:
  - bearerAuth: []
paths:
  /v1/deslop/{projectId}:
    post:
      summary: 检测页面中 AI 风格的文本
      description: >-
        分析文档页面中是否存在 AI 生成的文本，并返回被标记的段落以及建议的人类风格改写。每检查一个页面消耗 1 个 AI 积分。少于 50
        个词的页面会被跳过，不计费。
      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
                  minLength: 1
                  description: 要检查的页面的原始 MDX 或 Markdown 内容。
      responses:
        '200':
          description: 页面已被检查，或因过短而被跳过。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeslopResult'
        '400':
          description: 请求体无效。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: AI 积分不足。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 超出速率限制。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: 检测暂时不可用。不扣除积分。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DeslopResult:
      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:
            $ref: '#/components/schemas/DeslopWindow'
        creditsCharged:
          type: integer
          description: 本次请求扣除的 AI 积分数（被跳过时为 0）。
    Error:
      type: object
      properties:
        error:
          type: string
          description: 错误消息。
    DeslopWindow:
      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:
          type: string
          description: 检测置信度，例如 `High`。
        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: 该改写更贴近人类风格的原因。
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authorization 请求头需要使用 Bearer 令牌。请使用管理员 API 密钥。这是仅供服务端使用的机密密钥。你可以在控制台的
        [API
        密钥页面](https://dashboard.mintlify.com/settings/organization/api-keys)
        中生成一个。

````

## Related topics

- [命令参考](/docs/zh/cli/commands.md)
- [配置](/docs/zh/editor/configurations.md)
- [文本格式](/docs/zh/create/text.md)
