Skip to main content

1. Get an API key

Sign in to the Averta Dashboard and navigate to API Keys. Click Create key, give it a name, and copy the secret. You’ll only see it once.
Store your API key securely. It cannot be retrieved after creation.

2. Install the SDK

npm install @averta/sdk

3. Initialize the client

import { Averta } from "@averta/sdk";

const averta = new Averta({
  apiKey: process.env.AVERTA_API_KEY,
});

4. Screen a request

Before your AI agent processes a user message, pass it through the Averta checkpoint:
const decision = await averta.decisions.create({
  provider: {
    name: "openai",
    model: "gpt-4o",
    operation: "chat",
  },
  messages: [
    { role: "user", content: userMessage },
  ],
});

if (decision.action === "block") {
  // The request was flagged — don't forward it to the LLM
  console.log("Blocked:", decision.reasons);
} else {
  // Safe to proceed
  const response = await openai.chat.completions.create({ ... });
}

5. Attach a policy (optional)

Policies let you configure the risk threshold and enforcement behavior per API key. Create one in the Dashboard and attach it to your key — no code changes needed.

Next steps

Core concepts

Learn how checkpoints, policies, and scoring work.

SDK configuration

Advanced client options, timeouts, and retry behavior.