POST /api/moderateCheck text for harmful content using OpenAI moderation (omni-moderation-latest). Returns flagged status, category breakdown (harassment, hate, self-harm, sexual, violence, etc.), and confidence scores. No API key needed; pay per call via x402. Text capped at 10k chars.
| Field | Type | Description |
|---|---|---|
text * | string | Text to check for policy violations (max 10,000 chars) |
{
"model": "omni-moderation-latest",
"flagged": false,
"categories": {
"harassment": false,
"harassment/threatening": false,
"hate": false,
"hate/threatening": false,
"self-harm": false,
"sexual": false,
"violence": false
},
"category_scores": {
"harassment": 0.00012,
"hate": 0.00003
}
}
curl -i -X POST https://agent402.tools/api/moderate \
-H "Content-Type: application/json" \
-d '{"text":"This is a perfectly normal sentence about cooking pasta."}'
The response is HTTP 402 Payment Required with exact payment requirements. Any x402 v2 client pays automatically and retries:
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const res = await payFetch("https://agent402.tools/api/moderate", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"text": "This is a perfectly normal sentence about cooking pasta."
}),
});
POST /api/llmLLM inference proxy — send an OpenAI-format chat/completions request and get a response from GPT-4o-mini. Supports visio…
POST /api/llm-proLLM inference proxy (Pro tier) — GPT-4o or GPT-4.1. Supports vision (up to 2 image URLs) and structured output (response…
POST /api/llm-premiumLLM inference proxy (Premium tier) — o3 or o3-mini reasoning models. Supports vision (up to 2 image URLs) and structured…