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

# 内容安全

> 可对文本、图片、音频、视频格式类型的内容进行检测，精准识别涉黄、涉暴、违法违规等风险内容，并输出结构化审核结果（包括内容类型、风险类型及具体风险内容片段），快速定位和处理违规信息。点击 **Try it** 按钮可快速试用。



## OpenAPI

````yaml /openapi/openapi.json post /paas/v4/moderations
openapi: 3.0.1
info:
  title: ZHIPU AI API
  description: ZHIPU AI 接口提供强大的 AI 能力，包括聊天对话、工具调用和视频生成。
  license:
    name: ZHIPU AI 开发者协议和政策
    url: https://chat.z.ai/legal-agreement/terms-of-service
  version: 1.0.0
  contact:
    name: Z.AI 开发者
    url: https://chat.z.ai/legal-agreement/privacy-policy
    email: user_feedback@z.ai
servers:
  - url: https://open.bigmodel.cn/api/
    description: 开放平台服务
security:
  - bearerAuth: []
tags:
  - name: 模型 API
    description: Chat API
  - name: 工具 API
    description: Web Search API
  - name: Agent API
    description: Agent API
  - name: 文件 API
    description: File API
  - name: 知识库 API
    description: Knowledge API
  - name: 实时 API
    description: Realtime API
  - name: 批处理 API
    description: Batch API
  - name: 助理 API
    description: Assistant API
  - name: 智能体 API（旧）
    description: QingLiu Agent API
paths:
  /paas/v4/moderations:
    post:
      tags:
        - 工具 API
      summary: 内容安全
      description: >-
        可对文本、图片、音频、视频格式类型的内容进行检测，精准识别涉黄、涉暴、违法违规等风险内容，并输出结构化审核结果（包括内容类型、风险类型及具体风险内容片段），快速定位和处理违规信息。点击
        **Try it** 按钮可快速试用。
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModerationRequest'
        required: true
      responses:
        '200':
          description: 业务处理成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModerationResponse'
        default:
          description: 请求失败。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ModerationRequest:
      type: object
      properties:
        model:
          type: string
          description: 安全模型
          enum:
            - moderation
          default: moderation
        input:
          description: |-
            需要审核的内容
             纯文本字符串（最大输入长度：`2000` 字符）
            多媒体对象(`type+url`)
             图片：图片小于 `10M`，最低分辨率 `20* 20`，不超过 `6000 * 6000`
            视频：推荐视频时长 `30` 秒
            音频：推荐音频时长 `60` 秒
          oneOf:
            - type: string
              description: 需要审核的文本内容
              example: 审核内容安全样例字符串。
            - type: object
              description: 单个多模态审核内容
              properties:
                type:
                  type: string
                  description: 内容类型，可以是文本、视频链接、音频链接或图片链接
                  enum:
                    - text
                    - image_url
                    - video_url
                    - audio_url
                text:
                  type: string
                  description: 当 `type` 为 `text` 时的文本内容
                  example: 待审核内容
                image_url:
                  type: object
                  description: 当 `type` 为 `image_url` 时的图片参数
                  properties:
                    url:
                      type: string
                      description: 当 `type` 为 `image_url` 时的图片链接地址
                video_url:
                  type: object
                  description: 当 `type` 为 `video_url` 时的视频参数
                  properties:
                    url:
                      type: string
                      description: 当 `type` 为 `video_url` 时的视频链接地址
                audio_url:
                  type: object
                  description: 当 `type` 为 `audio_url` 时的音频参数
                  properties:
                    url:
                      type: string
                      description: 当 `type` 为 `audio_url` 时的音频链接地址
              required:
                - type
            - type: array
              description: 审核多模态内容数组，支持文本、文件和图片
              items:
                type: object
                properties:
                  type:
                    type: string
                    description: 内容类型，可以是文本、视频链接、音频链接或图片链接
                    enum:
                      - text
                      - image_url
                      - video_url
                      - audio_url
                  text:
                    type: string
                    description: 当 `type` 为 `text` 时的文本内容
                    example: 待审核内容
                  image_url:
                    type: object
                    description: 当 `type` 为 `image_url` 时的图片参数
                    properties:
                      url:
                        type: string
                        description: 当 `type` 为 `image_url` 时的图片链接地址
                  video_url:
                    type: object
                    description: 当 `type` 为 `video_url` 时的视频参数
                    properties:
                      url:
                        type: string
                        description: 当 `type` 为 `video_url` 时的视频链接地址
                  audio_url:
                    type: object
                    description: 当 `type` 为 `audio_url` 时的音频参数
                    properties:
                      url:
                        type: string
                        description: 当 `type` 为 `audio_url` 时的音频链接地址
      required:
        - model
        - input
    ModerationResponse:
      type: object
      properties:
        id:
          description: 任务 `ID`
          type: string
        created:
          type: integer
          description: 请求创建时间，是以秒为单位的 `Unix` 时间戳
        request_id:
          type: string
          description: 请求标识符
        result_list:
          type: array
          items:
            type: object
            properties:
              content_type:
                description: 内容类型
                type: string
              risk_level:
                type: string
                enum:
                  - PASS
                  - REVIEW
                  - BLOCK
                  - REJECT
                  - HIGH
                description: |-
                  检测结果，处置建议，可能返回值：
                  PASS：正常，机审不拦截，建议直接放行
                  REVIEW：可疑，机审不拦截，建议人工后审
                  BLOCK：一般违规，建议机审拦截，但可以不终止本轮对话
                  REJECT：违规，建议机审拦截，并终止多轮对话
                  HIGH：高危，建议机审拦截，输入也要做回撤处理
              risk_type:
                type: array
                description: 风险类型列表
                items:
                  type: string
        usage:
          type: object
          properties:
            moderation_text:
              type: object
              properties:
                call_count:
                  type: number
    Error:
      type: object
      properties:
        error:
          required:
            - code
            - message
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        标准的 HTTP Bearer 认证方式，在 [API
        Keys](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) 页面获取密钥。

````