Quickstart
Add a 25-line fail-open pre-check in front of your OpenAI, Anthropic, or Gemini call to stop prompt theft, large text dumps, and off-topic abuse in under 1 millisecond.
How Gated Works
Gated checks incoming user messages right before your application calls its AI model (such as OpenAI, Anthropic, Google Gemini, or Lovable AI Gateway). Each message is checked in about 0.008 milliseconds before you pay for any AI input or output tokens.
- If the message is normal (
allow: true): Your backend calls your AI model as usual. - If the message is an attack or off-topic abuse (
allow: false): Your backend returns the politegate.messageright away and spends $0.00 on AI tokens. - If the network is slow or unreachable: The request times out after 400ms and lets the user message through automatically so your app never goes down.
Step 1: Add Your API Key to Your Environment
M6L_GATE_KEY="m6lg_live_YOUR_API_KEY"Step 2: Call POST https://getgated.ai/v1/check Before Your AI Model
const gateRes = await fetch("https://getgated.ai/v1/check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.M6L_GATE_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
user: userId || "anon",
input: userMessage,
feature: "chat"
}),
signal: AbortSignal.timeout(400) // Fail-open safety timeout
});
const gate = await gateRes.json();
if (!gate.allow) {
return Response.json({ reply: gate.message }, { status: 200 });
}Step 3: Verify in Your Console
Open /console and click TEST GATE in the top-right header to send a live test check and watch your Blocked Threats and Estimated Dollars Saved update in real time.