Skip to main content
Skip documentation navigation
Developer docs

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 quickstart

Understand the request path

  1. 01 Inspect input
  2. 02 Call your model
  3. 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.

guarded-chat.ts · server patternTypeScript
// 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 };

Add request handling and verification Key-handling guidance

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

Frameworks

Drop-in patterns for your stack

Platforms

No-code and hosted tools

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.

Optional analytics

Google Analytics, when configured, and Cloudflare Web Analytics load only if you allow them. Sign-in cookies and product audit records are separate. Privacy policy

Optional analytics is off.