Example configurations demonstrating Zentinel features and patterns.
Example
Description
basic.kdl
Minimal configuration for getting started
https-upstream.kdl
Proxying to an HTTPS backend with upstream TLS
Inference Features Covered
Token Rate Limiting - Per-minute token limits with burst
Token Budgets - Cumulative tracking per period (daily/monthly)
Cost Attribution - Per-model pricing for billing
Model Routing - Route requests based on model name
Provider Support - OpenAI, Anthropic, and generic providers
Fallback Routing - Cross-provider failover with model mapping
Guardrails - Prompt injection detection, PII detection/redaction
Percentage-based sampling (1%, 10%, 50%, 100%)
Header-based sampling triggers
Request body buffering for POST/PUT
Fire-and-forget with configurable timeout
Gradual rollout patterns
Local - In-memory, single instance
Redis - Distributed with connection pooling
Memcached - Distributed with TTL control
Fallback to local on backend failure
Delay action (instead of hard reject)
Tiered limits by user type
Memory, disk, and hybrid backends
Per-route TTL configuration
Vary by headers
Stale-while-revalidate
Stale-if-error
Cache-Control header respect
Built-in purge and stats endpoints
Example
Description
namespaces.kdl
Hierarchical resource organization for multi-tenant setups
Namespace-scoped resources (routes, upstreams, agents, filters)
Services within namespaces
Resource exports for sharing across namespaces
Hierarchical scope resolution (service → namespace → global)
Per-namespace and per-service limits
Copy an example as a starting point:
cp config/examples/basic.kdl my-config.kdl
zentinel --config my-config.kdl
Validate without starting:
zentinel --config my-config.kdl --dry-run
All examples use these standard blocks:
Block
Purpose
server
Worker threads, connections, shutdown
listeners
Listen addresses, TLS, protocols
upstreams
Backend pools, load balancing, health checks
routes
Request matching, policies, filters
filters
Named filter configurations
agents
External processing agents
observability
Metrics, logging, tracing
limits
Header, body, connection limits
cache
Global cache storage settings
namespaces
Resource organization