Create Averta runtime credentials, attach policies, and use them from SDK wrappers.
API keys connect your application to Averta’s runtime decision API. Every SDK wrapper call uses one Averta API key, and that key determines which policy applies.
Provider wrappers read this environment variable automatically. Use explicit wrapper key options only for unusual cases, such as selecting a different key for one client in the same process.OpenAI:
import OpenAI from "openai";import { wrapOpenAI } from "@averta-security/sdk-openai";let client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY!,});client = wrapOpenAI(client);
Anthropic:
import Anthropic from "@anthropic-ai/sdk";import { wrapAnthropic } from "@averta-security/sdk-anthropic";let client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY!,});client = wrapAnthropic(client);
A key without a policy is not ready for normal runtime enforcement.Attach a policy before using the key in an SDK integration. You can change the attached policy without changing application code, which is the reason policy attaches to the key instead of being hardcoded in the app.