Skip to content

Moderations ​

通过 OpenAI 兼容 /v1/moderations 做内容安全检测

POST /v1/moderations 用于对输入内容进行安全检测,适合在用户输入、公开发布、自动化生成链路中做前置或后置检查。

请求示例 ​

bash
curl -X POST "https://aiapi.fhddos.com/v1/moderations" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "omni-moderation-latest",
    "input": "需要检测的文本内容"
  }'

使用建议 ​

  • 对用户输入做前置检测,避免明显违规内容进入生成链路。
  • 对模型输出做后置检测,降低发布风险。
  • 不要只依赖自然语言 message 分支处理,优先读取结构化分类字段。

INFO

不同上游渠道的内容安全分类粒度可能不同;平台会尽量保留可程序化处理的结构化信息。

OpenAPI ​

yaml
openapi: 3.0.3
info:
  title: Fhddos Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the Fhddos user
    docs.
servers:
  - url: https://aiapi.fhddos.com
security:
  - BearerAuth: []
paths:
  /v1/moderations:
    post:
      tags:
        - OpenAI
      summary: Moderations
      requestBody:
        $ref: '#/components/requestBodies/JsonObject'
      responses:
        '200':
          $ref: '#/components/responses/JsonObject'
components:
  requestBodies:
    JsonObject:
      required: true
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  responses:
    JsonObject:
      description: OK
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/GenericObject'
  schemas:
    GenericObject:
      type: object
      additionalProperties: true
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: 'Authorization: Bearer <token>'

Fhddos AI 用户文档