Integration Guide

Guardrails is a drop-in proxy. Your existing AI code doesn't change — you add one URL and three headers.

New to this? Not an engineer?

We wrote a plain-English setup guide that explains everything step by step — including a copy-paste prompt you can give to Claude, ChatGPT, or Copilot and let the AI make the change for you. If anything goes wrong, removing one line instantly puts your app back the way it was.

Download the Easy Setup Guide

Let your AI assistant install it

Using Claude, ChatGPT, Cursor, or Copilot? Paste this prompt and replace the two keys — the assistant finds the right file and makes the change:

Find where this project creates its Anthropic or OpenAI client.
Add a baseURL option pointing to https://aegisguardrails.com/anthropic
(or /openai for OpenAI) and add these default headers:
  X-Audit-Key: <my Guardrails key>
  X-Provider-Key: <my existing AI key>
Don't change anything else.

1. Get your API key

Sign up at aegisguardrails.com/signup. Your GUARDRAILS_API_KEY will be shown in your dashboard.

2. Update your client

// Anthropic
const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
  baseURL: 'https://aegisguardrails.com/anthropic',
  defaultHeaders: {
    'X-Audit-Key':    process.env.GUARDRAILS_API_KEY,
    'X-Provider-Key': process.env.ANTHROPIC_API_KEY,
    'X-Actor-Id':     getCurrentUserId(),     // optional
    'X-Session-Id':   getSessionId(),         // optional
  },
})

// OpenAI
const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: 'https://aegisguardrails.com/openai',
  defaultHeaders: {
    'X-Audit-Key':    process.env.GUARDRAILS_API_KEY,
    'X-Provider-Key': process.env.OPENAI_API_KEY,
  },
})

3. Read the audit metadata

Every response includes a _audit field:

const response = await client.messages.create({ ... })
console.log(response._audit)
// {
//   event_id: 'a3f8b21c-...',
//   hash: '3a7bd3e2...',
//   ledger_status: 'pending'  // → 'committed' after ~30s
// }

4. Verify a record

Any record can be publicly verified — no login required:

GET https://aegisguardrails.com/verify/{event_id}

// Response
{
  "eventId": "a3f8b21c-...",
  "hash": "3a7bd3e2...",
  "platformSigValid": true,
  "customerSigValid": true,
  "onChain": true,
  "blockHeight": 41823,
  "tampered": false
}

Headers reference

HeaderRequiredDescription
X-Audit-KeyYesYour Guardrails API key
X-Provider-KeyYesYour Anthropic or OpenAI API key — forwarded to the provider
X-Actor-IdNoUser or service account ID — appears in audit log
X-Session-IdNoGroups a multi-turn conversation together