> ## Documentation Index
> Fetch the complete documentation index at: https://docs.continum.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Configure the Continum SDK for your use case

## SDK Version

**Current Version**: 0.6.4

## Configuration Methods

### Global Configuration (Recommended)

Configure once and use everywhere:

```typescript theme={null}
import { continum } from '@continum/sdk';

continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  comply: ['GDPR', 'SOC2'],
  alerts: {
    slack: process.env.SLACK_WEBHOOK_URL,
    pagerduty: process.env.PAGERDUTY_KEY
  }
});

// Now use protect() without passing config every time
const response = await continum.protect(
  () => openai.chat.completions.create({...})
);
```

### Per-Call Configuration

Pass configuration to each `protect()` call:

```typescript theme={null}
import { protect } from '@continum/sdk';

const response = await protect(
  () => openai.chat.completions.create({...}),
  {
    apiKey: process.env.CONTINUM_API_KEY!
  },
  {
    preset: 'customer-support',
    comply: ['GDPR', 'SOC2']
  }
);
```

## Configuration Options

```typescript theme={null}
interface ContinumConfig {
  // Required
  apiKey: string;
  
  // Automatic configuration
  preset?: Preset;
  comply?: ComplianceFramework[];
  
  // Manual sandbox configuration
  sandbox?: {
    types?: SandboxType[];
    frameworks?: ComplianceFramework[];
    customRules?: string[];
    region?: string;
    blockOn?: RiskLevel;
  };
  
  // Custom rules
  customRules?: string[];
  
  // Environment
  environment?: 'production' | 'staging' | 'development';
  region?: string;
  
  // Blocking mode
  blockOn?: RiskLevel;
  
  // Alerts
  alerts?: {
    slack?: string;
    pagerduty?: string;
    discord?: string;
    webhook?: string;
  };
  
  // Violation handlers
  onViolation?: Partial<Record<ViolationCode, ViolationHandler>>;
  onRiskLevel?: Partial<Record<RiskLevel, ViolationHandler>>;
  
  // Error handling
  onError?: (error: Error) => void;
  
  // Custom endpoint
  baseUrl?: string;
}
```

## Required Configuration

### apiKey

Your Continum API key:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!
}
```

Get your API key from the [dashboard](https://app.continum.co).

## Automatic Configuration

### preset

Automatically configure detection types for your use case:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support'
}
```

**Available presets:**

* `customer-support` - PII, content policy, bias
* `legal-ai` - PII, legal compliance, hallucination, bias
* `fintech-ai` - PII, financial compliance, security, bias
* `healthcare-ai` - PII, content policy, bias, hallucination
* `coding-assistant` - Security, supply chain, prompt injection
* `agent` - Agent safety, prompt injection, data exfiltration
* `content-generation` - Content policy, bias, hallucination
* `internal-tool` - PII, security audit
* `data-pipeline` - PII, data exfiltration, security
* `education-ai` - Content policy, bias, hallucination

[Learn more about presets →](/sdk/presets)

### comply

Specify compliance frameworks:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  comply: ['GDPR', 'SOC2', 'HIPAA']
}
```

**Supported frameworks:**

* `GDPR`, `CCPA`, `HIPAA`, `SOC2`, `ISO_27001`
* `EU_AI_ACT`, `FINRA`, `PCI_DSS`, `NIST_AI_RMF`
* `FCA`, `PDPA`, `PIPEDA`, `UK_DPA_2018`

[Learn more about compliance →](/sdk/presets)

## Manual Sandbox Configuration

For advanced use cases, configure sandboxes directly:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  sandbox: {
    types: ['PII_DETECTION', 'SECURITY_AUDIT', 'PROMPT_INJECTION'],
    frameworks: ['GDPR', 'SOC2'],
    customRules: ['CUSTOM_RULE_1'],
    region: 'eu-west-1',
    blockOn: 'HIGH'
  }
}
```

**Available detection types:**

* `PII_DETECTION`, `BIAS_DETECTION`, `SECURITY_AUDIT`
* `PROMPT_INJECTION`, `DATA_EXFILTRATION`, `AGENT_SAFETY`
* `HALLUCINATION_DETECTION`, `CONTENT_POLICY`
* `FINANCIAL_COMPLIANCE`, `LEGAL_COMPLIANCE`
* `MULTI_TURN_ATTACK`, `SUPPLY_CHAIN_INTEGRITY`
* `FULL_SPECTRUM`, `CUSTOM`

## Environment Configuration

### environment

Specify the environment:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  environment: 'production'  // 'production' | 'staging' | 'development'
}
```

### region

Specify the region for data residency:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  region: 'eu-west-1'  // EU data residency
}
```

## Blocking Mode

Wait for audit results before returning response:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  blockOn: 'HIGH'  // Block if risk level is HIGH or CRITICAL
}
```

**Risk levels:**

* `LOW` - Block all violations
* `MEDIUM` - Block MEDIUM, HIGH, CRITICAL
* `HIGH` - Block HIGH, CRITICAL
* `CRITICAL` - Block only CRITICAL

[Learn more about blocking mode →](/sdk/blocking-mode)

## Alerts

Configure real-time alerts:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  alerts: {
    slack: process.env.SLACK_WEBHOOK_URL,      // HIGH/CRITICAL
    pagerduty: process.env.PAGERDUTY_KEY,      // CRITICAL only
    discord: process.env.DISCORD_WEBHOOK_URL,  // MEDIUM/LOW
    webhook: process.env.CUSTOM_WEBHOOK_URL    // All violations
  }
}
```

[Learn more about alerts →](/sdk/alerts)

## Violation Handlers

React to specific violations in code:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  onViolation: {
    PII_LEAK: async (signal) => {
      await sendAlert('PII detected', signal);
    },
    PROMPT_INJECTION: async (signal) => {
      await logSecurityIncident(signal);
    }
  },
  onRiskLevel: {
    CRITICAL: async (signal) => {
      await notifySecurityTeam(signal);
    }
  }
}
```

[Learn more about violation handlers →](/sdk/violation-handlers)

## Error Handling

Handle audit errors:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  onError: (error) => {
    console.error('Audit error:', error);
    // Never throws — audit failures don't break your app
  }
}
```

## Custom Endpoint

For self-hosted deployments:

```typescript theme={null}
{
  apiKey: process.env.CONTINUM_API_KEY!,
  baseUrl: 'https://your-continum-instance.com'
}
```

## Per-Call Overrides

Override global configuration for specific calls:

```typescript theme={null}
continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  blockOn: 'HIGH'
});

// Override for this call
const response = await continum.protect(
  () => openai.chat.completions.create({...}),
  {
    blockOn: 'CRITICAL',  // Only block CRITICAL for this call
    userId: 'user_123',
    sessionId: 'session_456',
    metadata: { feature: 'chat' }
  }
);
```

## Environment-Specific Configuration

### Development

```typescript theme={null}
continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  environment: 'development'
});
```

### Staging

```typescript theme={null}
continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  environment: 'staging',
  alerts: {
    slack: process.env.SLACK_WEBHOOK_URL
  }
});
```

### Production

```typescript theme={null}
continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  comply: ['GDPR', 'SOC2'],
  environment: 'production',
  blockOn: 'HIGH',
  alerts: {
    slack: process.env.SLACK_WEBHOOK_URL,
    pagerduty: process.env.PAGERDUTY_KEY
  }
});
```

## Configuration Best Practices

### 1. Use Environment Variables

Never hardcode API keys:

```typescript theme={null}
// ❌ Bad
{ apiKey: 'co_abc123...' }

// ✅ Good
{ apiKey: process.env.CONTINUM_API_KEY! }
```

### 2. Start with Presets

Use presets instead of manual configuration:

```typescript theme={null}
// ✅ Good
{ preset: 'customer-support', comply: ['GDPR'] }

// ❌ Avoid (unless you have specific requirements)
{ sandbox: { types: ['PII_DETECTION', 'BIAS_DETECTION', ...] } }
```

### 3. Validate Configuration

Check configuration at startup:

```typescript theme={null}
if (!process.env.CONTINUM_API_KEY) {
  throw new Error('CONTINUM_API_KEY is required');
}

continum.configure({
  apiKey: process.env.CONTINUM_API_KEY,
  preset: 'customer-support'
});
```

### 4. Use Global Configuration

Configure once, use everywhere:

```typescript theme={null}
// continum.ts
import { continum } from '@continum/sdk';

continum.configure({
  apiKey: process.env.CONTINUM_API_KEY!,
  preset: 'customer-support',
  comply: ['GDPR', 'SOC2']
});

export { continum };

// app.ts
import { continum } from './continum';

const response = await continum.protect(
  () => openai.chat.completions.create({...})
);
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Presets" icon="shield-check" href="/sdk/presets">
    Explore presets and compliance frameworks
  </Card>

  <Card title="Alerts" icon="bell" href="/sdk/alerts">
    Set up real-time alerts
  </Card>

  <Card title="Blocking Mode" icon="hand" href="/sdk/blocking-mode">
    Block requests based on violations
  </Card>

  <Card title="Configuration" icon="gear" href="/sdk/configuration">
    Advanced SDK configuration
  </Card>
</CardGroup>
