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

# 创建审核

> 判断文本是否违反 OpenAI 的使用政策。

此端点会根据提供商的审核策略评估文本输入，并返回由网关规范化的安全评分。完整的请求和响应架构请参阅 OpenAPI 规范。


## OpenAPI

````yaml zh-Hans/openapi/v1/openapi.localized.yaml POST /moderations
openapi: 3.0.3
info:
  title: Phaseo Gateway API
  description: 通过兼容 OpenAI 的端点访问各种 AI 模型的网关 API。
  version: 1.0.0
  contact:
    name: Phaseo
    url: https://phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
    description: 全球路由
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core Phaseo Gateway operations.
paths:
  /moderations:
    post:
      tags:
        - Gateway
      summary: 执行审核
      description: 判断文本是否违反 OpenAI 的使用政策。
      operationId: createModeration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModerationsRequest'
      responses:
        '200':
          description: 审核响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ModerationsResponse'
components:
  schemas:
    ModerationsRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
        meta:
          type: boolean
          default: false
        debug:
          $ref: '#/components/schemas/DebugOptions'
        input:
          oneOf:
            - type: string
            - type: array
              items:
                oneOf:
                  - $ref: '#/components/schemas/TextModerationInput'
                  - $ref: '#/components/schemas/ImageModerationInput'
        provider:
          $ref: '#/components/schemas/ProviderRoutingOptions'
    ModerationsResponse:
      type: object
      properties:
        id:
          type: string
        model:
          type: string
        results:
          type: array
          items:
            $ref: '#/components/schemas/ModerationResult'
        meta:
          type: object
          description: 当请求将 `meta` 设为 `true` 时包含。
          properties:
            latency_ms:
              type: number
              description: 从发送到上游到收到首个响应字节所经历的毫秒数。
            generation_ms:
              type: number
              description: 提供商报告的处理时间（毫秒）；未报告时则为观测到的上游延迟。
          additionalProperties: true
    DebugOptions:
      type: object
      description: 网关调试控制项。这些标志绝不会转发给提供商。
      properties:
        enabled:
          type: boolean
        return_upstream_request:
          type: boolean
        return_upstream_response:
          type: boolean
        trace:
          type: boolean
        trace_level:
          type: string
          enum:
            - summary
            - full
    TextModerationInput:
      type: object
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
    ImageModerationInput:
      type: object
      required:
        - type
        - image_url
      properties:
        type:
          type: string
          enum:
            - image_url
        image_url:
          type: object
          properties:
            url:
              type: string
              format: uri
    ProviderRoutingOptions:
      type: object
      description: 用于网关选择的提供商路由偏好设置。
      properties:
        order:
          type: array
          items:
            type: string
        only:
          type: array
          items:
            type: string
        ignore:
          type: array
          items:
            type: string
        include_alpha:
          type: boolean
          description: 在路由中包含 alpha 提供商（默认关闭）。
        allow_fallbacks:
          type: boolean
          nullable: true
          description: 失败后允许回退到其他符合条件的提供商。
        require_parameters:
          type: boolean
          nullable: true
          description: 路由前要求提供商支持所请求的参数。
        required_execution_region:
          type: string
          nullable: true
          description: 将路由限制为具有所需执行区域的提供商。
        required_data_region:
          type: string
          nullable: true
          description: 将路由限制为具有所需数据区域的提供商。
        require_zero_data_retention:
          type: boolean
          nullable: true
          description: 将路由限制为支持零数据保留的提供商。
        data_collection:
          type: string
          nullable: true
          enum:
            - allow
            - deny
        zdr:
          type: boolean
          nullable: true
        enforce_distillable_text:
          type: boolean
          nullable: true
        quantizations:
          type: array
          nullable: true
          items:
            type: string
        sort:
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
          description: 为此请求排列提供商，例如按价格、延迟或吞吐量排序。
        max_price:
          type: object
          properties:
            prompt:
              oneOf:
                - type: number
                - type: string
            completion:
              oneOf:
                - type: number
                - type: string
            image:
              oneOf:
                - type: number
                - type: string
            audio:
              oneOf:
                - type: number
                - type: string
            request:
              oneOf:
                - type: number
                - type: string
        preferred_min_throughput:
          oneOf:
            - type: number
            - type: object
              additionalProperties:
                type: number
        preferred_max_latency:
          oneOf:
            - type: number
            - type: object
              additionalProperties:
                type: number
    ModerationResult:
      type: object
      properties:
        flagged:
          type: boolean
        categories:
          $ref: '#/components/schemas/ModerationCategories'
        category_scores:
          $ref: '#/components/schemas/ModerationCategoryScores'
    ModerationCategories:
      type: object
      properties:
        hate:
          type: boolean
        hate/threatening:
          type: boolean
        harassment:
          type: boolean
        harassment/threatening:
          type: boolean
        self-harm:
          type: boolean
        self-harm/intent:
          type: boolean
        self-harm/instructions:
          type: boolean
        sexual:
          type: boolean
        sexual/minors:
          type: boolean
        violence:
          type: boolean
        violence/graphic:
          type: boolean
    ModerationCategoryScores:
      type: object
      properties:
        hate:
          type: number
        hate/threatening:
          type: number
        harassment:
          type: number
        harassment/threatening:
          type: number
        self-harm:
          type: number
        self-harm/intent:
          type: number
        self-harm/instructions:
          type: number
        sexual:
          type: number
        sexual/minors:
          type: number
        violence:
          type: number
        violence/graphic:
          type: number
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer 令牌身份验证

````

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