infergo supports API key authentication via Bearer tokens.
# Set API key on server
infergo serve --model models/llama3-8b-q4.gguf --api-key YOUR_SECRET_KEY
# Or via environment variable
export INFERGO_API_KEY=YOUR_SECRET_KEY
infergo serve --model models/llama3-8b-q4.ggufcurl http://localhost:9090/v1/chat/completions \
-H "Authorization: Bearer YOUR_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"llm","messages":[{"role":"user","content":"Hello"}]}'apiVersion: v1
kind: Secret
metadata:
name: infergo-api-key
type: Opaque
stringData:
api-key: "your-production-key-here"
---
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- name: infergo
env:
- name: INFERGO_API_KEY
valueFrom:
secretKeyRef:
name: infergo-api-key
key: api-keyPrevent abuse with per-key and global rate limits.
infergo serve --model models/llama3-8b-q4.gguf \
--api-key YOUR_KEY \
--rate-limit 100 # 100 requests/minute global
--rate-limit-per-key 20 # 20 requests/minute per API keyRate-limited responses return HTTP 429 with Retry-After header.
Three built-in roles control endpoint access:
| Role | Permissions |
|---|---|
admin |
All endpoints including /v1/admin/*, hot reload, tenant management |
user |
Inference endpoints: chat, embed, detect, search, RAG, NER, etc. |
readonly |
Read-only: /v1/models, /health/*, /metrics |
# In server config
infergo serve --model llm:model.gguf \
--api-key admin:ADMIN_KEY \
--api-key user:USER_KEY \
--api-key readonly:READONLY_KEYUnauthenticated requests (no API key set) default to user role.
Restrict access to specific IP addresses or CIDR ranges.
infergo serve --model models/llama3-8b-q4.gguf \
--allow-ip 10.0.0.0/8 \
--allow-ip 192.168.1.0/24 \
--allow-ip 203.0.113.42When enabled, requests from non-allowed IPs receive HTTP 403.
infergo can detect and redact personally identifiable information in inputs and outputs:
- Email addresses
- Phone numbers
- Social Security Numbers
- Credit card numbers
- IP addresses
Enable via server config or per-request with "redact_pii": true.
Block harmful content categories:
- Violence
- Hate speech
- Self-harm
- Explicit content
All requests are logged in JSONL format with cryptographic hash chains for tamper evidence.
infergo serve --model models/llama3-8b-q4.gguf \
--audit-log /var/log/infergo/audit.jsonlEach log entry contains:
- Timestamp, request ID, client IP
- Model used, endpoint, response status
- SHA-256 hash linking to previous entry (tamper-evident chain)
Hash-only mode (no request/response bodies) available for sensitive environments:
--audit-log-mode hash-onlyDelete all stored data for a specific user:
curl -X DELETE http://localhost:9090/v1/admin/gdpr/user123 \
-H "Authorization: Bearer ADMIN_KEY"This purges:
- Conversation memory
- Vector DB entries with matching user metadata
- Feedback records
- Audit log entries (marked as deleted)
Encrypt model files at rest with AES-256-GCM:
# Encrypt
infergo convert --input model.gguf --encrypt --key-file model.key
# Serve encrypted model
infergo serve --model models/model.gguf.enc --key-file model.keyUse a reverse proxy (nginx, Caddy, Traefik) for TLS termination:
server {
listen 443 ssl;
ssl_certificate /etc/ssl/cert.pem;
ssl_certificate_key /etc/ssl/key.pem;
location / {
proxy_pass http://127.0.0.1:9090;
proxy_set_header X-Real-IP $remote_addr;
}
}For same-machine clients, use UDS to avoid network exposure entirely:
infergo serve --model models/llama3-8b-q4.gguf --uds /tmp/infergo.sockFor maximum security and performance on same machine:
infergo serve --model models/llama3-8b-q4.gguf --shm infergo_shmNo network interface exposed. Communication via kernel-managed shared memory.
Webhooks are signed with HMAC-SHA256:
infergo serve --model models/llama3-8b-q4.gguf \
--webhook-url https://your-service.com/hook \
--webhook-secret YOUR_WEBHOOK_SECRETVerify webhook signatures in your handler:
import hmac, hashlib
def verify(body, signature, secret):
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)| Item | Action |
|---|---|
| Set API key | --api-key or INFERGO_API_KEY env var |
| Enable TLS | Reverse proxy with SSL certificate |
| Restrict IPs | --allow-ip for internal networks |
| Set rate limits | --rate-limit and --rate-limit-per-key |
| Enable audit log | --audit-log /path/to/audit.jsonl |
| Use RBAC | Assign admin:/user:/readonly: key prefixes |
| Redact PII | Enable PII detection in config |
| Secure models | --encrypt for model files at rest |
| Use UDS/SHM | Avoid TCP when client is on same machine |