# Check a Prompt

`POST /v1/moderations`

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`.

Base URL: `https://api.spicyapi.com`

## Authorizations

- `Authorization` (string, header, required): 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`.

- `input` (string, optional): A generation prompt (optionally with the negative prompt appended). Up to 8000 characters.
- `messages` (object[], optional): An OpenAI-style message array (system, user, assistant). The whole conversation is screened, including the system prompt.

## Request

```bash
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" }'
```

## Response: 200 application/json

Successful Response

- `flagged` (boolean, required): `true` when `outcome` is not `allow`.
- `outcome` (string, required): `allow`, `review` or `block`.
- `category` (string | null, required): The category driving the outcome: `minor`, `real_person`, `non_consent`, `bestiality`, `gore`, `injection`, `keyword`, or a contextual rule code.
- `categories` (object, required): Per-category probabilities from the semantic layer (0 to 1). Empty when a deterministic layer decided.
- `layer` (string, required): `keyword`, `contextual` or `jev`.
- `cost_usd` (number, required): What this call cost.

```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
}
```
