SoterAI documentation
Guard the full request path
Check prompts, model responses, retrieved context, and agent actions. Learn where each check belongs—and what remains your application’s responsibility.
Start with one guarded request
Recommended path
Install the SDK on your server, connect an API key, and test both sides of a model call.
Open the quickstartUnderstand the request path
- 01 Inspect input
- 02 Call your model
- 03 Inspect output
Server-side pattern, not a complete route. You supply userMessage, your callYourLLM function, authentication, and error handling. Keep the key on the server. If a check fails or is unavailable, stop; never fall back to releasing unchecked text.
// Server-side only. This key must never reach a browser bundle.
import { Soter } from "@soterai/core";
const soter = new Soter(); // Reads SOTER_API_KEY from the server environment.
// Only an explicit permission and a usable payload can continue.
function checkedText(result: {
allowed: boolean; action: string; safeText?: string; redactedText?: string;
}, original: string): string | null {
if (result.allowed !== true) return null;
if (result.action === "ALLOW") {
return result.safeText ?? result.redactedText ?? original;
}
if (result.action === "ALLOW_WITH_REDACTION" || result.action === "REWRITE") {
const cleaned = result.safeText ?? result.redactedText;
return typeof cleaned === "string" && cleaned.trim() ? cleaned : null;
}
return null; // BLOCK, HUMAN_REVIEW, or an unknown action.
}
const input = await soter.protect({ input: userMessage });
const safeInput = checkedText(input, userMessage);
if (safeInput === null) return { blocked: true, reply: "Request blocked." };
const reply = await callYourLLM(safeInput);
const output = await soter.guardOutput({ aiResponse: reply });
const safeOutput = checkedText(output, reply);
if (safeOutput === null) return { blocked: true, reply: "Response blocked." };
return { blocked: false, reply: safeOutput };Every guide
Choose your stack or inspect a specific control. Each guide states its scope before the examples.
Get started
From zero to a guarded request
SDKs & API
Pick your language
- JavaScript / TypeScriptNode.js, Deno, and Bun with typed results and framework snippets.
- PythonSync and async clients for Django, Flask, and plain scripts.
- REST APIAny language that can make an HTTPS request — Go, Java, PHP, C#, Ruby, Rust.
- API referenceEvery endpoint, request field, response shape, error code, and webhook event.
- CLIDetect your framework and scaffold the integration from the terminal.
Frameworks
Drop-in patterns for your stack
- Next.jsApp Router route handlers, server actions, and streaming chat endpoints.
- Express.jsInput and output guard middleware for existing Express chat routes.
- FastAPIAsync Python routes with Pydantic request and response models.
- RAG, LangChain & LlamaIndexInspect retrieved context and citations before they reach the model.
- Any chatbot or agentThe universal pattern for when no framework-specific guide applies.
Platforms
No-code and hosted tools
- WordPressPlugin settings, shortcodes, and a local REST proxy that keeps the key server-side.
- WhatsAppIndia-specific PII redaction for WhatsApp Business chat flows.
- IntercomGuard AI support replies and redact customer PII before it is stored.
- ZendeskProtect ticket messages and AI-drafted agent responses.
- BotpressPre- and post-processing HTTP steps inside a Botpress workflow.
Operate securely
Run it properly in production
Common questions
Where should the API key live?
Server-side only, in an environment variable. A key in client JavaScript is publicly readable. Browser apps should call your own backend route, which then calls SoterAI.
Can I use SoterAI without an SDK?
Yes. The documented REST endpoints accept HTTPS requests, so you can integrate from Go, Java, PHP, C#, Ruby, Rust, or another language with an HTTP client. Check the API reference for each endpoint’s authentication requirements.
Do I need both the input guard and the output guard?
They check different boundaries. Input checks inspect text before the model runs; output checks inspect the generated reply before you release it. Neither check guarantees detection, and RAG context and agent tool calls need additional controls.
How long does integration take?
It depends on your stack, authentication, error handling, and test coverage. Begin with a single chat turn, then verify blocked, redacted, allowed, and unavailable paths before extending the integration. Guide times are estimates, not a completion promise.
Does SoterAI guarantee my AI is secure?
No. SoterAI is a defense-in-depth layer that reduces risk. It complements secure design, identity controls, monitoring, and human review; it does not replace them. No configuration makes an AI system completely secure.
Still stuck? Contact support or try the guard without signing up.