curl --request POST \
--url https://api.apimart.ai/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://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/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://cdn.apimart.ai/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())
const url = "https://api.apimart.ai/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://cdn.apimart.ai/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));
omni-moderation-latest
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
POST
/
v1
/
moderations
curl --request POST \
--url https://api.apimart.ai/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://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/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://cdn.apimart.ai/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())
const url = "https://api.apimart.ai/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://cdn.apimart.ai/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));
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.
curl --request POST \
--url https://api.apimart.ai/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://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}'
import requests
url = "https://api.apimart.ai/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://cdn.apimart.ai/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())
const url = "https://api.apimart.ai/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://cdn.apimart.ai/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));
Modelos compatibles
| Modelo | Descripción | Entradas admitidas |
|---|---|---|
omni-moderation-latest | Modelo general de moderación de contenido | Texto, imagen, mixto texto+imagen |
Authorizations
string
requerido
Todos los endpoints requieren autenticación mediante Bearer Token.Obtener una API Key:Visite la página de gestión de API Key para obtener su API Key.Añada la siguiente cabecera a la solicitud:
Authorization: Bearer YOUR_API_KEY
Body
string
requerido
Nombre del modelo de moderación.
omni-moderation-latest- Modelo general de moderación de contenido
string | string[] | object[]
requerido
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 textoimage_url- Bloque de contenido de URL de imagen
boolean
predeterminado:"false"
Indica si la respuesta se devuelve en streaming.
false: Respuesta no-streaming (predeterminado; único valor admitido actualmente,trueno está soportado)
Modos de solicitud de input
Mixto texto + imagen
{
"model": "omni-moderation-latest",
"input": [
{
"type": "text",
"text": "Por favor, modere si esta imagen cumple las normas"
},
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
Texto simple (único)
{
"model": "omni-moderation-latest",
"input": "I want to kill someone",
"stream": false
}
Texto simple (arreglo)
{
"model": "omni-moderation-latest",
"input": [
"hello",
"I hate you"
],
"stream": false
}
Solo imagen (URL de imagen)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "https://cdn.apimart.ai/files/1779955589195-wh950j4imqd.jpeg"
}
}
],
"stream": false
}
Solo imagen (Data URI base64)
{
"model": "omni-moderation-latest",
"input": [
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
}
],
"stream": false
}
Notas
- Cuando
inputes un arreglo de bloques de contenido, cada elemento utilizatypepara distinguir el tipo de contenido. - 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}. - Salvo necesidad específica, mantenga
stream: falsede forma consistente.