# AI Gateway

Source: https://www.orthalon.com/en/docs/environments/ai-gateway

Deploy, configure, and route LLM traffic through the unified Orthalon Desktop Suite local gateway or dedicated server reverse proxy.

> **Plan requirement:** Monitoring and discovery are included in all plans. Protect, Business, and Enterprise can enforce active policies (Redact, Coach, Require Approval, Block).

The Orthalon AI Gateway is a zero-retention reverse proxy that intercepts requests before they reach upstream providers (OpenAI, Anthropic, Gemini), evaluates data loss prevention rules, and logs security audit metadata.

---

## 1. Option A: Built-in Local Gateway (Recommended for Developers)

If you have installed the [Orthalon Desktop Suite](/docs/environments/desktop-protection), the Local AI Gateway runs **automatically in the background on `http://127.0.0.1:4130`**—no Docker, Node.js installation, or server setup is required.

### Point Local Code & SDKs to `:4130`

#### OpenAI (Python / Node.js SDK)
```python
from openai import OpenAI

client = OpenAI(
    api_key="your_upstream_openai_key",
    base_url="http://127.0.0.1:4130/v1" # Built-in Orthalon Gateway
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Analyze user transaction..."}]
)
```

#### Anthropic (Python / TypeScript SDK)
```typescript
import Anthropic from "@anthropic-ai/sdk";

const anthropic = new Anthropic({
  apiKey: "your_upstream_anthropic_key",
  baseURL: "http://127.0.0.1:4130", // Built-in Orthalon Gateway
});
```

---

## 2. Option B: Standalone Production Gateway (Docker / Server)

For production cloud backends, microservices clusters, and automated backend pipelines:


### Download the Server Package
[Download Orthalon AI Gateway (.tar.gz)](/downloads/orthalon-ai-gateway-0.1.0.tar.gz) · [Download (.zip)](/downloads/orthalon-ai-gateway-0.1.0.zip)

### Configure Environment Variables
In `gateway.env`:
```bash
ORTHALON_SENSOR_KEY=sk_orthalon_your_gateway_key_here
ORTHALON_ORGANIZATION_ID=org_your_organization_id
PORT=4000
```

### Launch with Docker Compose
```bash
docker compose --env-file gateway.env up -d
```


---

## 3. Test and Validate Protection

1. **Verify Gateway Health**:
   ```bash
   curl http://127.0.0.1:4130/health
   ```
   *Expected response: `{"status":"ok","sensor":"connected"}`*

2. **Send Test API Call with DLP Inspection**:
   ```bash
   curl http://127.0.0.1:4130/v1/chat/completions \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer sk-openai-test-key" \
     -d '{
       "model": "gpt-4o",
       "messages": [{"role": "user", "content": "Secret API key: AKIAIOSFODNN7EXAMPLE"}]
     }'
   ```
3. **Verify Central Telemetry**: Open **Discovery → Violations** in your dashboard to view the intercepted and sanitized request.
