Kagami — Multi-provider LLM Gateway
Kagami — Multi-provider LLM Gateway
An internal LLM gateway that fronts multiple providers behind one unified API, with PII redaction, cost-aware routing, rate limiting, and audit logging. Built on a Go control plane, a Rust data plane, Envoy ext_authz, and Microsoft Presidio with Japanese-language recognizers.
Live Demo
Preview the actual application interface
Cost-routing decisions
liveThroughput
Latency p50 / p95 per provider
PII redaction log
last 1h · internal benchmarkChallenge
When apps call OpenAI, Anthropic, Bedrock, and local vLLM directly, API-key management, cost rollups, PII-leak risk, and rate limits scatter across teams — making audit and governance painful.
Solution
Envoy ext_authz aggregates traffic; the Go control plane evaluates per-tenant rules and budget caps; the Rust data plane redacts PII inline on streaming responses. Presidio gained Japanese recognizers (names, addresses, My Number), and weighted routing balances per-token cost against latency.
Results
- Consolidated API-key management surface from 12 apps to 1
- 96.5% PII-detection rate on test documents (internal evaluation)
- Estimated -22% monthly token spend via cost-aware routing (internal simulation)
- Every request stamped with trace_id and audit log, wired into SIEM
Measured Impact
PII検出率(社内テスト)
96.5%
内部評価
APIキー集約
1拠点
12→1
トークン消費
-22%
社内シミュレーション
p95レイテンシ追加
+8ms
Envoy経由
What it does
ガバナンス
PII赤字
日本語氏名・住所・マイナンバーをストリーム中に検出。
監査ログ
全リクエストにtrace_idと入出力ハッシュを記録。
ルーティング
コスト加重
トークン単価とSLOで最適プロバイダを選択。
フォールバック
障害時に代替プロバイダへ自動切替。
System Layers
Layered architecture showing components, responsibilities, and data flow.
Layer
エッジ層
全LLMトラフィックをEnvoyで集約。
Layer
コントロールプレーン
Tenant/予算/ルートを管理。
Layer
データプレーン
ストリーミング中にPIIを逐次赤字。
Layer
観測層
コスト・レイテンシ・検出数をダッシュボード化。
How we built it
API設計
OpenAI互換+拡張ヘッダを定義。
Deliverables
- OpenAPI
- Protobuf
PII検出
Presidio JA認識器の精度評価。
Deliverables
- 評価レポート
- パターン辞書
ルーティング戦略
加重/フォールバック/サーキットブレーカ。
Deliverables
- ルールDSL
- シミュレータ
運用基盤
Helmチャートとランブック整備。
Deliverables
- Helm
- Runbook
Delivery Timeline
- Phase 1Done2026-04
ルーティング基盤
Envoy+Go control planeでプロバイダ振り分け。
- Phase 2In Progress2026-05
PII赤字
PresidioのJA拡張とストリーミング対応。
- Phase 3Planned2026-06
コスト最適化
トークン予算とSLOベースの加重ルーティング。
- Phase 4Planned2026-07
監査ログ統合
SIEM連携と長期保管ポリシー。
Who built it
Roles
- プラットフォームエンジニア (リード)
- Rustエンジニア
- セキュリティエンジニア
Tools & Platforms
Backend
Data
Infrastructure
Other
Considering a similar project?
We will propose the best solution for your business needs.
Discuss Your Project