Moderation

Check a Prompt

Run a prompt or conversation through the same screen the generation endpoints use, without generating.

Use it to check your end users' prompts before you spend credits, or to power a live indicator in your own UI. Blocked prompts are never charged at generation time either; this endpoint exists so you can tell users *why* before they hit submit.

Flat price of $0.001 per call. Free when called from the SpicyAPI playground.

The screen runs three layers: a keyword blocklist, contextual pattern rules, and a semantic classifier that returns per-category probabilities. outcome is allow, review (uncertain; would be declined at generation with a request to reword) or block.

POST/v1/moderationsTry it

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your SpicyAPI key (sk-spicy-…). Create one in the dashboard under API Keys.

Body

application/json

Provide exactly one of input or messages.

inputstring

A generation prompt (optionally with the negative prompt appended). Up to 8000 characters.

messagesobject[]

An OpenAI-style message array (system, user, assistant). The whole conversation is screened, including the system prompt.

Response

200application/json

Successful Response

flaggedbooleanrequired

true when outcome is not allow.

outcomestringrequired

allow, review or block.

categorystring | nullrequired

The category driving the outcome: minor, real_person, non_consent, bestiality, gore, injection, keyword, or a contextual rule code.

categoriesobjectrequired

Per-category probabilities from the semantic layer (0 to 1). Empty when a deterministic layer decided.

layerstringrequired

keyword, contextual or jev.

cost_usdnumberrequired

What this call cost.

Was this page helpful?

Check a Prompt
cURL
curl --request POST \
  --url https://api.spicyapi.com/v1/moderations \
  --header 'Authorization: Bearer $SPICYAPI_KEY' \
  --header 'Content-Type: application/json' \
  --data '{ "input": "a woman in her 30s sunbathing topless on a private beach" }'
200
JSON
{
  "object": "moderation",
  "flagged": false,
  "outcome": "allow",
  "category": null,
  "categories": {
    "minor": 0.03,
    "real_person": 0.01,
    "non_consent": 0.02,
    "bestiality": 0.0,
    "gore": 0.0,
    "injection": 0.01
  },
  "layer": "jev",
  "cost_usd": 0.001
}