Built for Speed
Raptor is written in Rust using the Axum web framework and Tokio async runtime. Every component is optimized for minimal latency.Request Flow
Latency Breakdown
Why This Matters
A typical GPT-4 request takes 500-2000ms. Adding 50-100ms of proxy overhead (common with Python/Node) is noticeable. Adding 5ms is not.Three-Tier Caching
Semantic Cache vs Exact Match
Traditional caches require exact matches. Raptor uses semantic hashing:Firewall Architecture
The firewall runs before forwarding to upstream:- Extract text from request body (messages, prompt, etc.)
- Compute embedding using local ONNX model (~1ms)
- Compare against threat patterns via cosine similarity
- Block/warn/log based on configured thresholds
Evidence Pipeline
All requests are logged asynchronously:Tech Stack
Resilience
- Rate limiting: Per API key, configurable
- Circuit breakers: Automatic failover on upstream errors
- Connection pooling: Efficient database/Redis connections
- Graceful shutdown: In-flight requests complete
Raptor is designed to be invisible. If we add latency you notice, that’s a bug.
