How It Works

Three steps. Full governance.

Install the SDK or point at the gateway. Define your policies. Every request evaluated, every decision logged.

// 001

Install. Define. Enforce.

  1. 01

    Install

    Install the SDK or point your API base URL at the gateway. One package, one line of config. No infrastructure changes. Works with OpenAI, Anthropic, Google, LangChain, CrewAI, AutoGen, MCP, and more.

  2. 02

    Define Policies

    Set rules from the dashboard, via API, or in a local JSON file. Model allowlists, cost caps, tool restrictions, PII filters. Policies are cryptographically signed and cached locally.

  3. 03

    Enforce and Audit

    Every request evaluated before it executes. Allow, deny, or warn on every call, and run the gateway in shadow mode to log decisions without enforcing them. Full audit trail on every decision. Searchable, exportable, compliance-ready.

// 002

Code Examples

Wrap your existing client. Everything else stays the same.

Python

python
# 1. Install: pip install controlzero
import controlzero
from controlzero.integrations.openai import wrap_openai
import openai
# 2. Initialize with your project key
cz = controlzero.init(api_key="cz_live_...")
# 3. Wrap your client; governance is automatic
client = wrap_openai(openai.OpenAI(), cz)
# Use as normal. Every call is governed + audited.
response = client.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}]
)

Node.js

javascript
// 1. Setup once: npm config set @controlzero:registry https://npm.controlzero.ai
// 1b. Install: npm install @controlzero/sdk
import { Client } from '@controlzero/sdk';
import { wrapOpenAI } from '@controlzero/sdk/integrations';
import OpenAI from 'openai';
// 2. Initialize with your project key
const cz = await Client.create({ apiKey: 'cz_live_...' });
// 3. Wrap your client; governance is automatic
const client = wrapOpenAI(new OpenAI(), cz);
// Use as normal. Every call is governed + audited.
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: prompt }],
});

// 003

Policies from the Dashboard

Define policies in the Control Zero dashboard or via the API. No code changes required. Policies are cryptographically signed and synced to the SDK in real time.

  • >Model allowlists and blocklists
  • >Per-request token and cost limits
  • >Tool and resource restrictions
  • >Role-based and time-based conditions

controlzero.yaml

yaml
version: '1'
rules:
# Allow read-style actions on any tool
- allow: 'read_*'
# Block a destructive filesystem action outright
- deny: 'filesystem:delete_file'
reason: 'No destructive file operations'
# Restrict model calls to an approved model
- effect: allow
action: 'llm:generate'
resource: 'model/gpt-5.4'
reason: 'Approved model only'
# Default deny
- deny: '*'

The same rules can be authored in the dashboard, sent via the API, or kept in a local policy file. JSON is also supported.

// 004

Request Flow

Every request follows this path. Most steps evaluate locally, with no per-call network round trip.

01

Your App

Agent makes an LLM call through the wrapped client.

02

SDK Policy Check

Policies evaluated locally from cache. No network call for valid requests.

03

Provider Call

In SDK and Local modes the request goes straight from your process to the LLM provider -- we are not in that path. Audit records are sent to your Control Zero backend, and prompt and response capture is an opt-in that is off by default. Gateway mode is a proxy, so traffic passes through the gateway you point at.

04

Audit Log

Decision and metadata are written to a durable local log, then delivered to the backend asynchronously.

Ready to get started?

Free tier available. No credit card required. Up and running in under 5 minutes.