feat(ift): EventHub AI Router stack for Zed
CI / build-gateway (push) Successful in 27s
CI / sync-config (push) Successful in 1s

FastAPI gateway with A/B/C lane orchestration, LiteLLM proxy config,
Swarm stack (postgres, redis, VPN off-by-default), deploy/smoke/audit scripts.
This commit is contained in:
2026-08-07 22:06:41 +03:00
commit 83d516afa1
29 changed files with 2005 additions and 0 deletions
+105
View File
@@ -0,0 +1,105 @@
# tier × lane (A/B/C) → Novita model id + LiteLLM fallbacks
lanes:
A: economy
B: balanced
C: max
models:
a-simple:
novita: novita/qwen/qwen3-4b-fp8
fallbacks: [b-simple, groq-llama-8b]
rpm: 60
b-simple:
novita: novita/meta-llama/llama-3.1-8b-instruct
fallbacks: [a-simple, groq-llama-8b]
rpm: 60
c-simple:
novita: novita/qwen/qwen3-8b-fp8
fallbacks: [b-simple]
rpm: 60
a-medium-ops:
novita: novita/qwen/qwen3-8b-fp8
fallbacks: [a-medium-code, b-medium-ops]
rpm: 40
b-medium-ops:
novita: novita/deepseek/deepseek-v3.2
fallbacks: [a-medium-code, c-medium-ops]
rpm: 40
c-medium-ops:
novita: novita/deepseek/deepseek-v3.2
fallbacks: [b-medium-ops]
rpm: 40
a-medium-code:
novita: novita/qwen/qwen3-coder-30b-a3b-instruct
fallbacks: [a-medium-ops, groq-qwen-coder]
rpm: 40
b-medium-code:
novita: novita/qwen/qwen3-coder-30b-a3b-instruct
fallbacks: [b-medium-ops, c-medium-code]
rpm: 40
c-medium-code:
novita: novita/qwen/qwen3-coder-30b-a3b-instruct
fallbacks: [b-medium-code, c-medium-ops]
rpm: 30
a-complex:
novita: novita/deepseek/deepseek-v3.2
fallbacks: [b-complex, a-reasoning]
rpm: 30
b-complex:
novita: novita/deepseek/deepseek-r1-0528
fallbacks: [a-complex, c-complex]
rpm: 20
c-complex:
novita: novita/deepseek/deepseek-r1-turbo
fallbacks: [b-complex]
rpm: 15
a-reasoning:
novita: novita/deepseek/deepseek-r1-0528-qwen3-8b
fallbacks: [b-reasoning, gemini-flash]
rpm: 30
b-reasoning:
novita: novita/deepseek/deepseek-r1-0528
fallbacks: [a-reasoning, c-reasoning]
rpm: 20
c-reasoning:
novita: novita/deepseek/deepseek-r1-turbo
fallbacks: [b-reasoning, gemini-flash]
rpm: 15
a-vision-ocr:
novita: novita/paddlepaddle/paddleocr-vl
fallbacks: [a-vision]
rpm: 30
no_escalation: true
a-vision:
novita: novita/qwen/qwen3-vl-30b-a3b-instruct
fallbacks: [a-vision-ocr]
rpm: 20
b-vision:
novita: novita/qwen/qwen2.5-vl-72b-instruct
fallbacks: [a-vision, c-vision]
rpm: 15
c-vision:
novita: novita/qwen/qwen3-vl-235b-a22b-instruct
fallbacks: [b-vision]
rpm: 10
optional_providers:
groq-llama-8b:
model: groq/llama-3.1-8b-instant
api_key: os.environ/GROQ_API_KEY
groq-qwen-coder:
model: groq/qwen-qwen-2.5-coder-32b
api_key: os.environ/GROQ_API_KEY
gemini-flash:
model: gemini/gemini-2.0-flash
api_key: os.environ/GEMINI_API_KEY
audit:
price_drift_threshold_pct: 10
cheaper_alternative_pct: 15
+32
View File
@@ -0,0 +1,32 @@
default_quality_mode: auto
start_lanes:
SIMPLE: A
MEDIUM_OPS: A
MEDIUM_CODE: A
COMPLEX: B
REASONING: B
VISION_OCR: A
VISION_UI: A
quality_mode_map:
economy: A
balanced: B
max: C
lane_order: [A, B, C]
budget_caps:
warn_pct: 80
hard_pct: 95
warn_max_lane: B
hard_max_lane: A
escalation:
repeat_prompt_window_sec: 300
context_tokens_min_lane_b: 32000
session_ttl_sec: 1800
redis:
key_prefix: "ai-router:session:"
ttl_sec: 1800
+77
View File
@@ -0,0 +1,77 @@
# Tier classification — single source for gateway + LiteLLM keyword rules
gateway:
simple_patterns:
- "^(привет|hello|hi|hey|спасибо|thanks|что такое|what is|define)\\b"
complex_keywords:
- рефакторинг
- refactor
- архитектур
- architecture
- спроектируй
- design system
- microservice
- distributed
- migration plan
- deep refactor
reasoning_keywords:
- step by step
- prove
- analyze deeply
- think through
- reasoning
medium_ops_keywords:
- bash
- docker
- swarm
- ci/cd
- gitea
- rebar
- erlang
- devops
- kubectl
- terraform
- playwright
- npm
- wsl
- litellm
- novita
- traefik
- mnesia
ocr_keywords:
- ocr
- прочитай текст
- extract text
- распознай текст
- read text from
escalation_keywords:
- не подходит
- лучше
- качественнее
- retry
- попробуй ещё
word_thresholds:
simple_max_words: 12
simple_question_max_words: 25
complex_min_words: 400
medium_code_min_lines: 200
confidence:
low_threshold: 0.6
litellm:
keyword_tier_rules:
- keywords: ["привет", "hello", "hi", "thanks", "спасибо", "что такое", "what is", "define"]
tier: SIMPLE
- keywords: ["bash", "docker", "swarm", "ci/cd", "gitea", "rebar", "erlang", "devops", "kubectl", "terraform", "playwright", "npm", "wsl"]
tier: MEDIUM
- keywords: ["рефакторинг", "refactor", "архитектура", "architecture", "спроектируй", "design system", "microservice", "distributed", "migration plan"]
tier: COMPLEX
- keywords: ["step by step", "reasoning", "prove", "analyze deeply", "think through"]
tier: REASONING
custom_technical_keywords:
- erlang
- rebar3
- traefik
- mnesia
- litellm
- novita