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

# Moderations

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

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

## 请求示例

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

## 使用建议

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

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


## OpenAPI

````yaml POST /v1/moderations
openapi: 3.0.3
info:
  title: PhanEdge Core API
  version: '1.0'
  description: >-
    Core OpenAI-compatible and model-family endpoints used by the PhanEdge user
    docs.
servers:
  - url: https://models.phanedge.cloud
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>'

````