Skip to content

Sidecar Configuration

This page documents all configuration options for GLACIS sidecars.

Configuration File

Create a glacis.config.ts (or .js) file in your project:

import { defineConfig } from '@glacis/sidecar';
export default defineConfig({
// Required
orgId: process.env.GLACIS_ORG_ID!,
apiKey: process.env.GLACIS_API_KEY!,
// Provider configuration
provider: {
type: 'openai',
apiKey: process.env.OPENAI_API_KEY!,
baseUrl: 'https://api.openai.com/v1', // Optional
},
// Sampling configuration
sampling: {
rate: 100, // 1 in N requests get L2 attestation
policies: ['toxicity', 'pii', 'bias'],
rules: [], // Adaptive sampling rules
},
// Service endpoints
services: {
witness: 'https://witness.glacis.io',
receipt: 'https://receipts.glacis.io',
},
// Logging
logging: {
level: 'info', // 'debug' | 'info' | 'warn' | 'error'
format: 'json', // 'json' | 'text'
},
});

Environment Variables

VariableRequiredDescription
GLACIS_ORG_IDYesYour organization ID (org_...)
GLACIS_API_KEYYesYour API key (glc_...)
OPENAI_API_KEYDependsRequired for OpenAI provider
ANTHROPIC_API_KEYDependsRequired for Anthropic provider
SAMPLING_RATENoOverride sampling rate

Provider Configuration

OpenAI

provider: {
type: 'openai',
apiKey: process.env.OPENAI_API_KEY!,
organization: 'org-abc123', // Optional
}

Anthropic

provider: {
type: 'anthropic',
apiKey: process.env.ANTHROPIC_API_KEY!,
}

Azure OpenAI

provider: {
type: 'azure-openai',
apiKey: process.env.AZURE_OPENAI_KEY!,
endpoint: 'https://your-resource.openai.azure.com',
deploymentId: 'gpt-4',
}

Sampling Configuration

Basic Sampling

sampling: {
rate: 100, // 1 in 100 requests get L2 attestation
}

Policy Checks

sampling: {
rate: 100,
policies: [
'toxicity', // Harmful content detection
'pii', // PII detection
'bias', // Bias detection
'prompt_injection', // Prompt injection detection
],
}

Adaptive Rules

sampling: {
rate: 100,
rules: [
// Sample all GPT-4 requests
{
condition: { field: 'model', operator: 'eq', value: 'gpt-4' },
rate: 1,
},
// Sample more for long prompts
{
condition: { field: 'content_length', operator: 'gt', value: 2000 },
rate: 10,
},
// Sample specific users
{
condition: { field: 'user', operator: 'eq', value: 'admin' },
rate: 1,
},
],
}

Logging Configuration

logging: {
level: 'info', // Minimum log level
format: 'json', // Output format
includeRequestId: true, // Include request ID in logs
redactSecrets: true, // Redact API keys in logs
}

Advanced Options

Request Batching

batching: {
enabled: true,
maxSize: 100, // Max attestations per batch
maxWaitMs: 1000, // Max wait before flush
}

Retry Configuration

retry: {
maxAttempts: 3,
initialDelayMs: 100,
maxDelayMs: 5000,
backoffMultiplier: 2,
}

Custom Headers

headers: {
'X-Custom-Header': 'value',
}

Validation

The sidecar validates configuration at startup:

Terminal window
npx glacis-sidecar validate

Next Steps