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

# omni-moderation-latest Moderación de contenido

>  - Admite moderación de contenido de texto, imagen y mixto texto+imagen
- Compatible con entradas de texto único, arreglo de textos y arreglo de bloques de contenido
- Las imágenes admiten URL públicas y Data URI en base64 

Use `omni-moderation-latest` para realizar la moderación de seguridad sobre el contenido de entrada. Este modelo pertenece a la Serie de Moderación y no forma parte de las series de generación de imagen, video o audio.

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://gccai.heqingsong.uk/v1/moderations \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "model": "omni-moderation-latest",
      "input": [
        {
          "type": "text",
          "text": "Por favor, modere si esta imagen cumple las normas"
        },
        {
          "type": "image_url",
          "image_url": {
            "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
          }
        }
      ],
      "stream": false
    }'
  ```

  ```python Python theme={null}
  import requests

  url = "https://gccai.heqingsong.uk/v1/moderations"

  payload = {
      "model": "omni-moderation-latest",
      "input": [
          {
              "type": "text",
              "text": "Por favor, modere si esta imagen cumple las normas"
          },
          {
              "type": "image_url",
              "image_url": {
                  "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
              }
          }
      ],
      "stream": False
  }

  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }

  response = requests.post(url, json=payload, headers=headers)

  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gccai.heqingsong.uk/v1/moderations";

  const payload = {
    model: "omni-moderation-latest",
    input: [
      {
        type: "text",
        text: "Por favor, modere si esta imagen cumple las normas",
      },
      {
        type: "image_url",
        image_url: {
          url: "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg",
        },
      },
    ],
    stream: false,
  };

  const headers = {
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(payload),
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```
</RequestExample>

## Modelos compatibles

| Modelo                   | Descripción                               | Entradas admitidas                |
| ------------------------ | ----------------------------------------- | --------------------------------- |
| `omni-moderation-latest` | Modelo general de moderación de contenido | Texto, imagen, mixto texto+imagen |

## Authorizations

<ParamField header="Authorization" type="string" required>
  Todos los endpoints requieren autenticación mediante Bearer Token.

  Obtener una API Key:

  Visite la [página de gestión de API Key](https://gccai.heqingsong.uk/keys) para obtener su API Key.

  Añada la siguiente cabecera a la solicitud:

  ```
  Authorization: Bearer YOUR_API_KEY
  ```
</ParamField>

## Body

<ParamField body="model" type="string" required>
  Nombre del modelo de moderación.

  * `omni-moderation-latest` - Modelo general de moderación de contenido
</ParamField>

<ParamField body="input" type="string | string[] | object[]" required>
  Contenido a moderar. Admite texto simple, arreglo de textos o arreglo de bloques de contenido.

  Los bloques de contenido pueden incluir:

  * `text` - Bloque de contenido de texto
  * `image_url` - Bloque de contenido de URL de imagen
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  Indica si la respuesta se devuelve en streaming.

  * `false`: Respuesta no-streaming (predeterminado; único valor admitido actualmente, `true` no está soportado)
</ParamField>

## Modos de solicitud de input

### Mixto texto + imagen

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "text",
      "text": "Por favor, modere si esta imagen cumple las normas"
    },
    {
      "type": "image_url",
      "image_url": {
        "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
      }
    }
  ],
  "stream": false
}
```

### Texto simple (único)

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": "I want to kill someone",
  "stream": false
}
```

### Texto simple (arreglo)

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    "hello",
    "I hate you"
  ],
  "stream": false
}
```

### Solo imagen (URL de imagen)

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "image_url",
      "image_url": {
        "url": "https://gccai.heqingsong.uk/_gccai/cdn/files/1779955589195-wh950j4imqd.jpeg"
      }
    }
  ],
  "stream": false
}
```

### Solo imagen (Data URI base64)

```json theme={null}
{
  "model": "omni-moderation-latest",
  "input": [
    {
      "type": "image_url",
      "image_url": {
        "url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
      }
    }
  ],
  "stream": false
}
```

## Notas

1. Cuando `input` es un arreglo de bloques de contenido, cada elemento utiliza `type` para distinguir el tipo de contenido.
2. Para la moderación de imágenes, se recomienda usar URL accesibles públicamente. Si usa base64, siga el formato estándar Data URI: `data:image/{format};base64,{data}`.
3. Salvo necesidad específica, mantenga `stream: false` de forma consistente.
