system-prompts-and-models-o.../salesflow-saas/backend/app/services/model_routing_dashboard.py
Claude a319feb6d7
feat(dealix): complete Tier-1 Sovereign Enterprise Growth OS
Governance layer (14 docs):
- MASTER_OPERATING_PROMPT.md — operating constitution (five planes, six tracks, policy classes)
- docs/ai-operating-model.md — five-plane architecture (Decision/Execution/Trust/Data/Operating)
- docs/dealix-six-tracks.md — six strategic tracks (Revenue/Intelligence/Compliance/Expansion/Operations/Trust)
- docs/governance/execution-fabric.md — OpenClaw execution plane deep dive
- docs/governance/trust-fabric.md — trust plane with contradiction engine + evidence packs
- docs/governance/saudi-compliance-and-ai-governance.md — PDPL/ZATCA/SDAIA/NCA live controls
- docs/governance/technology-radar-tier1.md — Core/Strong/Pilot/Watch/Hold classification
- docs/governance/partnership-os.md — alliance lifecycle management
- docs/governance/ma-os.md — M&A corporate development lifecycle
- docs/governance/expansion-os.md — geographic and vertical growth
- docs/governance/pmi-os.md — post-merger integration framework
- docs/governance/executive-board-os.md — executive decision surfaces
- docs/execution-matrix-90d-tier1.md — 90-day sprint execution plan
- docs/adr/0001-tier1-execution-policy-spikes.md — 8 architectural decisions

Backend (3 models, 6 services, 8 API routes):
- Contradiction Engine — detect/track system conflicts
- Evidence Pack System — tamper-evident audit proof with SHA256
- Saudi Compliance Matrix — live PDPL/ZATCA/SDAIA/NCA controls
- Executive Room — unified executive decision surface
- Connector Governance — integration health monitoring
- Model Routing Dashboard — LLM provider metrics
- Forecast Control Center — actual vs forecast across tracks
- Approval Center — enhanced approval queue with SLA

Frontend (9 components):
- Executive Room, Evidence Pack Viewer, Approval Center
- Connector Governance Board, Saudi Compliance Dashboard
- Actual vs Forecast Dashboard, Risk Heatmap
- Policy Violations Board, Partner Pipeline Board

Tooling:
- scripts/architecture_brief.py — preflight validation (40/40 checks pass)
- Updated CLAUDE.md and AGENTS.md with governance references

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-16 12:48:13 +00:00

62 lines
2.1 KiB
Python

"""Model Routing Dashboard — metrics and health for LLM providers."""
from __future__ import annotations
from typing import Any, Dict, List
# Provider registry matching model_router.py configuration
PROVIDERS = {
"groq": {"name": "Groq", "model": "llama-3.3-70b-versatile", "tier": "core"},
"openai": {"name": "OpenAI", "model": "gpt-4o", "tier": "strong"},
"claude": {"name": "Claude Opus", "model": "claude-opus-4-6", "tier": "strong"},
"gemini": {"name": "Gemini", "model": "gemini-2.0-flash", "tier": "pilot"},
"deepseek": {"name": "DeepSeek", "model": "deepseek-coder", "tier": "pilot"},
}
class ModelRoutingDashboard:
"""Provides model routing metrics, health status, and cost attribution."""
def get_provider_health(self) -> List[Dict[str, Any]]:
return [
{
"provider": key,
"name": info["name"],
"model": info["model"],
"tier": info["tier"],
"status": "available",
}
for key, info in PROVIDERS.items()
]
def get_routing_stats(self, tenant_id: str) -> Dict[str, Any]:
return {
"tenant_id": tenant_id,
"primary_provider": "groq",
"fallback_provider": "openai",
"providers": self.get_provider_health(),
"routing_policy": {
"fast_classification": "groq",
"sales_copy": "claude",
"research": "gemini",
"coding": "deepseek",
"default": "groq",
},
}
def get_cost_summary(self, tenant_id: str) -> Dict[str, Any]:
return {
"tenant_id": tenant_id,
"period": "current_month",
"by_provider": {
"groq": {"calls": 0, "tokens": 0, "cost_sar": 0.0},
"openai": {"calls": 0, "tokens": 0, "cost_sar": 0.0},
"claude": {"calls": 0, "tokens": 0, "cost_sar": 0.0},
},
"total_cost_sar": 0.0,
}
model_routing_dashboard = ModelRoutingDashboard()