curl
curl https://api.naga.ac/v1/moderations \
-H "Authorization: Bearer $NAGA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-moderation-latest",
"input": "I want to hurt them."
}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["NAGA_API_KEY"],
base_url="https://api.naga.ac/v1",
)
result = client.moderations.create(
model="omni-moderation-latest",
input="I want to hurt them.",
)
print(result)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NAGA_API_KEY,
baseURL: "https://api.naga.ac/v1",
});
const result = await client.moderations.create({
model: "omni-moderation-latest",
input: "I want to hurt them.",
});
console.log(result);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/moderations"
payload := strings.NewReader("{\n \"model\": \"omni-moderation-latest\",\n \"input\": \"I want to hurt them.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "mdr-4tKq7Zc1Nb9Wx2Ry8Vd3Ms6Ph0Q",
"model": "omni-moderation-latest",
"results": [
{
"flagged": true,
"categories": {
"violence": true,
"harassment": false
},
"category_scores": {
"violence": 0.9124,
"harassment": 0.0217
}
}
]
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_api_key",
"message": "The provided API key is invalid. Please ensure your API key is correct and active. You can find more information about obtaining a key on our website: https://naga.ac If you just created this key, wait a few minutes and try again."
}
}{
"error": {
"type": "insufficient_quota",
"message": "More credits required to process this request. Visit https://naga.ac/dashboard/credits to add credits."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "rate_limit_exceeded",
"message": "Rate limit reached. Please try again in 3s."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Moderations
Classify content
Classifies text and images against a moderation model’s categories and charges the account for the tokens it counted. Requires an API key.
POST
/
v1
/
moderations
curl
curl https://api.naga.ac/v1/moderations \
-H "Authorization: Bearer $NAGA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "omni-moderation-latest",
"input": "I want to hurt them."
}'import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["NAGA_API_KEY"],
base_url="https://api.naga.ac/v1",
)
result = client.moderations.create(
model="omni-moderation-latest",
input="I want to hurt them.",
)
print(result)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.NAGA_API_KEY,
baseURL: "https://api.naga.ac/v1",
});
const result = await client.moderations.create({
model: "omni-moderation-latest",
input: "I want to hurt them.",
});
console.log(result);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.naga.ac/v1/moderations"
payload := strings.NewReader("{\n \"model\": \"omni-moderation-latest\",\n \"input\": \"I want to hurt them.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"id": "mdr-4tKq7Zc1Nb9Wx2Ry8Vd3Ms6Ph0Q",
"model": "omni-moderation-latest",
"results": [
{
"flagged": true,
"categories": {
"violence": true,
"harassment": false
},
"category_scores": {
"violence": 0.9124,
"harassment": 0.0217
}
}
]
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_api_key",
"message": "The provided API key is invalid. Please ensure your API key is correct and active. You can find more information about obtaining a key on our website: https://naga.ac If you just created this key, wait a few minutes and try again."
}
}{
"error": {
"type": "insufficient_quota",
"message": "More credits required to process this request. Visit https://naga.ac/dashboard/credits to add credits."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "rate_limit_exceeded",
"message": "Rate limit reached. Please try again in 3s."
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
bearerAuthxApiKeyAuth
An account API key. Send it as Authorization: Bearer <key>.
Body
application/json
Response
The verdict. results carries one entry per input, each with the flag, the per-category verdicts and the scores behind them.
The body of a successful POST /v1/moderations, without usage.
The identifier of this moderation, minted by the gateway.
The model that moderated, as the catalog id the request resolved to.
The verdicts, in the order the model returned them.
Hide child attributes
Hide child attributes
Whether this input tripped any category.