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

# Moderations (Beta)

> Classifies if text violates OpenAI's usage policies.

This endpoint evaluates text input against provider moderation policies and returns gateway-normalised safety scores. See the OpenAPI spec for full request/response schemas.


## OpenAPI

````yaml POST /moderations
openapi: 3.0.3
info:
  title: AI Stats Gateway API
  description: >-
    A gateway API for accessing various AI models with OpenAI-compatible
    endpoints.
  version: 1.0.0
  contact:
    name: AI Stats
    url: https://docs.ai-stats.phaseo.app
    email: danielbutler500@gmail.com
servers:
  - url: https://api.phaseo.app/v1
security:
  - BearerAuth: []
tags:
  - name: Gateway
    description: Core AI Stats Gateway operations.
paths:
  /moderations:
    post:
      tags:
        - Gateway
      summary: Create moderation
      description: Classifies if text violates OpenAI's usage policies.
      operationId: createModeration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ModerationsRequest'
      responses:
        '200':
          description: Moderation response
          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'
    DebugOptions:
      type: object
      description: Gateway debug controls. These flags are never forwarded upstream.
      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: Provider routing preferences for gateway selection.
      properties:
        order:
          type: array
          items:
            type: string
        only:
          type: array
          items:
            type: string
        ignore:
          type: array
          items:
            type: string
        include_alpha:
          type: boolean
          description: Include alpha providers in routing (off by default).
    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 token authentication

````