# OpenAI-Compatible API Integration

> Canonical page: https://saig.terraxon.eu/docs/openai-compatible-api/
> Last updated: 2026-06-16

## Drop-in integration

SAIG exposes an OpenAI-compatible `/v1/chat/completions` endpoint. Integrate by changing only the base URL and API key — no SDK changes, no code rewrite.

## Python example

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.your-domain.eu/v1",
    api_key="your-saig-api-key",
)

response = client.chat.completions.create(
    model="saig-default",
    messages=[{"role": "user", "content": "Summarize this report."}],
)
print(response.choices[0].message.content)
```

## TypeScript example

```typescript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.your-domain.eu/v1",
  apiKey: "your-saig-api-key",
});

const response = await client.chat.completions.create({
  model: "saig-default",
  messages: [{ role: "user", content: "Summarize this report." }],
});
console.log(response.choices[0].message.content);
```

## cURL example

```bash
curl https://api.your-domain.eu/v1/chat/completions \
  -H "Authorization: Bearer your-saig-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "saig-default", "messages": [{"role": "user", "content": "Summarize this report."}]}'
```

## Model aliases

| Alias | Purpose |
|-------|---------|
| `saig-default` | Balanced quality and cost |
| `saig-fast` | Low latency for interactive use |
| `saig-sensitive-data` | Routes to EU-resident providers with stricter sovereignty |
| `saig-low-cost` | Cost-optimized for batch and background tasks |

## Governance response headers

| Header | Description |
|--------|-------------|
| `X-SAIG-Request-Id` | Unique governance request identifier |
| `X-SAIG-Policy-Action` | Governance decision: ALLOW, ANONYMIZE, DENY, SYNTHETIC_ONLY |
| `X-SAIG-Risk-Level` | Risk assessment: NONE, LOW, MEDIUM, HIGH, CRITICAL |
| `X-SAIG-Provider` | LLM provider that served the request |
| `X-SAIG-Model-Alias` | SAIG model alias used |
| `X-SAIG-Audit-Receipt-Id` | Audit trail receipt reference |

## Discovery endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/v1/models` | List available model aliases |
| `GET` | `/v1/capabilities` | Machine-readable capability matrix |
| `GET` | `/version` | Version and build information |
| `GET` | `/health` | Health check (no auth required) |

## OpenAPI spec

Download: https://saig.terraxon.eu/openapi-public.json
