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

# Create Moderation

> Classifies if text and/or image inputs are potentially harmful. Learn
more in the [moderation guide](https://developers.openai.com/api/docs/guides/moderation).



## OpenAPI

````yaml /openapi.json post /v1/moderations
openapi: 3.1.0
info:
  title: AIHubMix Gateway API
  description: |
    Unified multi-protocol gateway. Exposes three native shapes side-by-side:
      - OpenAI (`/v1/chat/completions`, `/v1/responses`, ...)
      - Anthropic (`/v1/messages`)
      - Gemini (`/v1beta/models/{model}:generateContent`)
    Each vendor's native SDK connects directly. Gateway-only fields are
    marked with `x-source.authority: gateway`.
  contact:
    name: AIHubMix Team
  version: 2.1.1
  x-upstream:
    vendorSpecs:
      packageVersion: 0.1.1
      installedFrom: npm
    sources:
      openai/official:
        version: '2026-05-31'
        hash: >-
          sha256:a203971a0bc0cd3b903b9488e3ac40eaa161a274dfaf172c1da73eee029147a8
      anthropic/official:
        version: '2026-05-31'
        hash: >-
          sha256:f9d488f9290d78a081bed62fa0c040476b5d009f3db92c06c8e279e69df73fc9
    layers:
      - role: L0-base
        source: avs://openai/official
        protocol: openai
        authority: official
      - role: L0-base
        source: avs://anthropic/official
        protocol: anthropic
        authority: official
      - role: gateway-other
        source: gateway/anthropic-mappings.yml
        protocol: all
        authority: gateway
      - role: horizontal-auth
        source: gateway/auth.yml
        protocol: all
        authority: gateway
      - role: horizontal-errors
        source: gateway/errors.yml
        protocol: all
        authority: gateway
      - role: L3-gateway
        source: gateway/openai-gateway.yml
        protocol: openai
        authority: gateway
      - role: gateway-other
        source: gateway/openai-image-mappings.yml
        protocol: all
        authority: gateway
      - role: gateway-other
        source: gateway/openai-mappings.yml
        protocol: all
        authority: gateway
      - role: L2-passthrough
        source: gateway/openai-passthrough.yml
        protocol: openai
        authority: gateway
servers:
  - url: https://aihubmix.com
    description: Production
  - url: https://api.inferera.com
    description: Backup (use when the primary domain is unreachable)
security:
  - gatewayBearer: []
tags:
  - name: OpenAI Compatible
    description: >-
      OpenAI-compatible endpoints (chat, completions, embeddings, images, audio,
      videos, moderations).
  - name: Anthropic Compatible
    description: Anthropic-native endpoints (messages with Anthropic protocol).
  - name: Google Vertex AI Compatible
    description: Google Gemini / Vertex AI endpoints.
paths:
  /v1/moderations:
    post:
      tags:
        - OpenAI Compatible
      summary: Create Moderation
      description: >-
        Classifies if text and/or image inputs are potentially harmful. Learn

        more in the [moderation
        guide](https://developers.openai.com/api/docs/guides/moderation).
      operationId: createModeration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateModerationRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateModerationResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
        5XX:
          description: Server / upstream error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayError'
components:
  schemas:
    CreateModerationRequest:
      type: object
      properties:
        input:
          description: >
            Input (or inputs) to classify. Can be a single string, an array of
            strings, or

            an array of multi-modal input objects similar to other models.
          oneOf:
            - type: string
              description: A string of text to classify for moderation.
              default: ''
              example: I want to kill them.
            - type: array
              description: An array of strings to classify for moderation.
              items:
                type: string
                default: ''
                example: I want to kill them.
            - type: array
              description: An array of multi-modal inputs to the moderation model.
              items:
                oneOf:
                  - type: object
                    description: An object describing an image to classify.
                    properties:
                      type:
                        description: Always `image_url`.
                        type: string
                        enum:
                          - image_url
                      image_url:
                        type: object
                        description: >-
                          Contains either an image URL or a data URL for a
                          base64 encoded image.
                        properties:
                          url:
                            type: string
                            description: >-
                              Either a URL of the image or the base64 encoded
                              image data.
                            format: uri
                            example: https://example.com/image.jpg
                        required:
                          - url
                    required:
                      - type
                      - image_url
                  - type: object
                    description: An object describing text to classify.
                    properties:
                      type:
                        description: Always `text`.
                        type: string
                        enum:
                          - text
                      text:
                        description: A string of text to classify.
                        type: string
                        example: I want to kill them
                    required:
                      - type
                      - text
        model:
          description: >
            The content moderation model you would like to use. Learn more in

            [the moderation
            guide](https://developers.openai.com/api/docs/guides/moderation),
            and learn about

            available models
            [here](https://developers.openai.com/api/docs/models#moderation).
          nullable: false
          default: omni-moderation-latest
          example: omni-moderation-2024-09-26
          anyOf:
            - type: string
            - type: string
              enum:
                - omni-moderation-latest
                - omni-moderation-2024-09-26
                - text-moderation-latest
                - text-moderation-stable
      required:
        - input
      x-source:
        from: avs://openai/official
        authority: official
    CreateModerationResponse:
      type: object
      description: Represents if a given text input is potentially harmful.
      properties:
        id:
          type: string
          description: The unique identifier for the moderation request.
        model:
          type: string
          description: The model used to generate the moderation results.
        results:
          type: array
          description: A list of moderation objects.
          items:
            type: object
            properties:
              flagged:
                type: boolean
                description: Whether any of the below categories are flagged.
              categories:
                type: object
                description: A list of the categories, and whether they are flagged or not.
                properties:
                  hate:
                    type: boolean
                    description: >-
                      Content that expresses, incites, or promotes hate based on
                      race, gender, ethnicity, religion, nationality, sexual
                      orientation, disability status, or caste. Hateful content
                      aimed at non-protected groups (e.g., chess players) is
                      harassment.
                  hate/threatening:
                    type: boolean
                    description: >-
                      Hateful content that also includes violence or serious
                      harm towards the targeted group based on race, gender,
                      ethnicity, religion, nationality, sexual orientation,
                      disability status, or caste.
                  harassment:
                    type: boolean
                    description: >-
                      Content that expresses, incites, or promotes harassing
                      language towards any target.
                  harassment/threatening:
                    type: boolean
                    description: >-
                      Harassment content that also includes violence or serious
                      harm towards any target.
                  illicit:
                    anyOf:
                      - type: boolean
                        description: >-
                          Content that includes instructions or advice that
                          facilitate the planning or execution of wrongdoing, or
                          that gives advice or instruction on how to commit
                          illicit acts. For example, "how to shoplift" would fit
                          this category.
                      - type: 'null'
                  illicit/violent:
                    anyOf:
                      - type: boolean
                        description: >-
                          Content that includes instructions or advice that
                          facilitate the planning or execution of wrongdoing
                          that also includes violence, or that gives advice or
                          instruction on the procurement of any weapon.
                      - type: 'null'
                  self-harm:
                    type: boolean
                    description: >-
                      Content that promotes, encourages, or depicts acts of
                      self-harm, such as suicide, cutting, and eating disorders.
                  self-harm/intent:
                    type: boolean
                    description: >-
                      Content where the speaker expresses that they are engaging
                      or intend to engage in acts of self-harm, such as suicide,
                      cutting, and eating disorders.
                  self-harm/instructions:
                    type: boolean
                    description: >-
                      Content that encourages performing acts of self-harm, such
                      as suicide, cutting, and eating disorders, or that gives
                      instructions or advice on how to commit such acts.
                  sexual:
                    type: boolean
                    description: >-
                      Content meant to arouse sexual excitement, such as the
                      description of sexual activity, or that promotes sexual
                      services (excluding sex education and wellness).
                  sexual/minors:
                    type: boolean
                    description: >-
                      Sexual content that includes an individual who is under 18
                      years old.
                  violence:
                    type: boolean
                    description: Content that depicts death, violence, or physical injury.
                  violence/graphic:
                    type: boolean
                    description: >-
                      Content that depicts death, violence, or physical injury
                      in graphic detail.
                required:
                  - hate
                  - hate/threatening
                  - harassment
                  - harassment/threatening
                  - illicit
                  - illicit/violent
                  - self-harm
                  - self-harm/intent
                  - self-harm/instructions
                  - sexual
                  - sexual/minors
                  - violence
                  - violence/graphic
              category_scores:
                type: object
                description: >-
                  A list of the categories along with their scores as predicted
                  by model.
                properties:
                  hate:
                    type: number
                    description: The score for the category 'hate'.
                  hate/threatening:
                    type: number
                    description: The score for the category 'hate/threatening'.
                  harassment:
                    type: number
                    description: The score for the category 'harassment'.
                  harassment/threatening:
                    type: number
                    description: The score for the category 'harassment/threatening'.
                  illicit:
                    type: number
                    description: The score for the category 'illicit'.
                  illicit/violent:
                    type: number
                    description: The score for the category 'illicit/violent'.
                  self-harm:
                    type: number
                    description: The score for the category 'self-harm'.
                  self-harm/intent:
                    type: number
                    description: The score for the category 'self-harm/intent'.
                  self-harm/instructions:
                    type: number
                    description: The score for the category 'self-harm/instructions'.
                  sexual:
                    type: number
                    description: The score for the category 'sexual'.
                  sexual/minors:
                    type: number
                    description: The score for the category 'sexual/minors'.
                  violence:
                    type: number
                    description: The score for the category 'violence'.
                  violence/graphic:
                    type: number
                    description: The score for the category 'violence/graphic'.
                required:
                  - hate
                  - hate/threatening
                  - harassment
                  - harassment/threatening
                  - illicit
                  - illicit/violent
                  - self-harm
                  - self-harm/intent
                  - self-harm/instructions
                  - sexual
                  - sexual/minors
                  - violence
                  - violence/graphic
              category_applied_input_types:
                type: object
                description: >-
                  A list of the categories along with the input type(s) that the
                  score applies to.
                properties:
                  hate:
                    type: array
                    description: The applied input type(s) for the category 'hate'.
                    items:
                      type: string
                      enum:
                        - text
                  hate/threatening:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'hate/threatening'.
                    items:
                      type: string
                      enum:
                        - text
                  harassment:
                    type: array
                    description: The applied input type(s) for the category 'harassment'.
                    items:
                      type: string
                      enum:
                        - text
                  harassment/threatening:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'harassment/threatening'.
                    items:
                      type: string
                      enum:
                        - text
                  illicit:
                    type: array
                    description: The applied input type(s) for the category 'illicit'.
                    items:
                      type: string
                      enum:
                        - text
                  illicit/violent:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'illicit/violent'.
                    items:
                      type: string
                      enum:
                        - text
                  self-harm:
                    type: array
                    description: The applied input type(s) for the category 'self-harm'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                  self-harm/intent:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'self-harm/intent'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                  self-harm/instructions:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'self-harm/instructions'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                  sexual:
                    type: array
                    description: The applied input type(s) for the category 'sexual'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                  sexual/minors:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'sexual/minors'.
                    items:
                      type: string
                      enum:
                        - text
                  violence:
                    type: array
                    description: The applied input type(s) for the category 'violence'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                  violence/graphic:
                    type: array
                    description: >-
                      The applied input type(s) for the category
                      'violence/graphic'.
                    items:
                      type: string
                      enum:
                        - text
                        - image
                required:
                  - hate
                  - hate/threatening
                  - harassment
                  - harassment/threatening
                  - illicit
                  - illicit/violent
                  - self-harm
                  - self-harm/intent
                  - self-harm/instructions
                  - sexual
                  - sexual/minors
                  - violence
                  - violence/graphic
            required:
              - flagged
              - categories
              - category_scores
              - category_applied_input_types
      required:
        - id
        - model
        - results
      x-source:
        from: avs://openai/official
        authority: official
    GatewayError:
      type: object
      description: |
        OpenAI-compatible error envelope. Top-level `error` object carrying
        `message` / `type` / `param` / `code`. `request_id` lives in the
        `X-Request-Id` response header, not in the body. The legacy `upstream`
        field is no longer emitted.
      x-source:
        from: gateway
        authority: gateway
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
          properties:
            message:
              type: string
              description: Human-readable error message.
            type:
              type: string
              nullable: true
              description: >
                Error category. OpenAI-compatible values include

                invalid_request_error / authentication_error / permission_error
                /

                not_found_error / rate_limit_error, etc. The upstream value is

                passed through verbatim; the enum is not fixed.
            param:
              type: string
              nullable: true
              description: Name of the offending field, when applicable.
            code:
              nullable: true
              description: |
                Sub-error code. May be a string or integer (the gateway treats
                `code` as an arbitrary type).
  securitySchemes:
    gatewayBearer:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: |
        Gateway-issued API key, formatted as `sk-gateway-xxxxxxxx`.
        Used by OpenAI-shaped endpoints (/v1/chat/completions, etc.).
      x-source:
        from: gateway
        authority: gateway

````