282 lines
8.7 KiB
JSON
282 lines
8.7 KiB
JSON
{
|
||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||
"name": "OpenClaw AI Router Configuration",
|
||
"version": "2.0.0",
|
||
"description": "Global production route: GCP-A Ollama -> GCP-B Ollama -> host111 Ollama -> Gemini API; legacy providers are non-executable shadow metadata only",
|
||
"updated_at": "2026-07-14",
|
||
|
||
"default_provider": "ollama",
|
||
"fallback_order": ["ollama_gcp_a", "ollama_gcp_b", "ollama_local", "gemini"],
|
||
"tool_calling_fallback_order": ["ollama_gcp_a", "ollama_gcp_b", "ollama_local", "gemini"],
|
||
"production_route": {
|
||
"schema_version": "ai_provider_production_route_v1",
|
||
"provider_order": ["ollama_gcp_a", "ollama_gcp_b", "ollama_local", "gemini"],
|
||
"route_label": "GCP-A -> GCP-B -> host111 Ollama -> Gemini API",
|
||
"applies_to": ["all_risk_levels", "all_complexity_levels", "tool_calling", "background_jobs", "code_review", "runbook_generation"],
|
||
"paid_provider_policy": "gemini_final_only_with_atomic_cost_guard",
|
||
"disabled_provider_policy": "never_reinsert"
|
||
},
|
||
|
||
"providers": {
|
||
"ollama": {
|
||
"name": "Ollama (GCP-A Primary)",
|
||
"enabled": true,
|
||
"priority": 1,
|
||
"production_executable": true,
|
||
"production_identities": ["ollama_gcp_a", "ollama_gcp_b", "ollama_local"],
|
||
"endpoint": "http://34.143.170.20:11434",
|
||
"api_path": "/api/generate",
|
||
"models": {
|
||
"default": "qwen2.5:7b-instruct",
|
||
"rca": "qwen3:14b",
|
||
"summary": "gemma3:4b",
|
||
"drift_summary": "qwen3:14b",
|
||
"drift_intent": "qwen2.5:7b-instruct",
|
||
"log_anomaly": "deepseek-r1:14b",
|
||
"nemoclaw": "deepseek-r1:14b",
|
||
"playbook_draft": "qwen3:14b",
|
||
"code_review": "qwen2.5-coder:7b",
|
||
"embedding": "bge-m3:latest",
|
||
"rag_generate": "qwen3:14b",
|
||
"image_analysis": "minicpm-v:latest",
|
||
"trust_scoring": "hermes3:latest",
|
||
"alert_triage": "hermes3:latest",
|
||
"intent_classify": "qwen2.5:7b-instruct",
|
||
"governance": "deepseek-r1:14b"
|
||
},
|
||
"options": {
|
||
"temperature": 0.1,
|
||
"top_p": 0.9,
|
||
"num_predict": 1024,
|
||
"format": "json"
|
||
},
|
||
"timeout_seconds": 120,
|
||
"cost": {
|
||
"per_1k_tokens": 0,
|
||
"currency": "USD"
|
||
},
|
||
"health_check": {
|
||
"endpoint": "/api/tags",
|
||
"interval_seconds": 60
|
||
}
|
||
},
|
||
|
||
"gemini": {
|
||
"name": "Google Gemini",
|
||
"enabled": true,
|
||
"priority": 4,
|
||
"production_executable": true,
|
||
"execution_gate": "configured_and_enabled_and_atomic_cost_guard_reserved",
|
||
"endpoint": "https://generativelanguage.googleapis.com/v1beta",
|
||
"api_path": "/models/{model}:generateContent",
|
||
"models": {
|
||
"default": "gemini-2.5-flash-lite",
|
||
"rca": "gemini-2.5-flash-lite",
|
||
"summary": "gemini-2.5-flash-lite"
|
||
},
|
||
"options": {
|
||
"temperature": 0.1,
|
||
"maxOutputTokens": 2048,
|
||
"responseMimeType": "application/json"
|
||
},
|
||
"timeout_seconds": 30,
|
||
"cost": {
|
||
"input_usd_per_million": 0.1,
|
||
"output_usd_per_million": 0.4,
|
||
"conservative_per_1k_tokens": 0.0004,
|
||
"currency": "USD",
|
||
"pricing_source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.5-flash-lite",
|
||
"pricing_version": "google-ai-standard-text-2026-07-14",
|
||
"pricing_checked_at": "2026-07-14"
|
||
},
|
||
"auth": {
|
||
"type": "api_key",
|
||
"env_var": "GEMINI_API_KEY",
|
||
"header": "x-goog-api-key"
|
||
},
|
||
"rate_limits": {
|
||
"daily_requests": 500,
|
||
"daily_tokens": 100000,
|
||
"requests_per_minute": 10,
|
||
"daily_cost_limit_usd": 5.0,
|
||
"total_cost_limit_usd": 5.0,
|
||
"cost_alert_threshold_usd": 4.0
|
||
}
|
||
},
|
||
|
||
"claude": {
|
||
"name": "Anthropic Claude",
|
||
"enabled": false,
|
||
"priority": null,
|
||
"production_executable": false,
|
||
"mode": "non_executable_shadow_metadata_only",
|
||
"endpoint": "https://api.anthropic.com/v1",
|
||
"api_path": "/messages",
|
||
"models": {
|
||
"default": "claude-haiku-4-5-20251001",
|
||
"rca": "claude-haiku-4-5-20251001",
|
||
"summary": "claude-haiku-4-5-20251001"
|
||
},
|
||
"options": {
|
||
"max_tokens": 2048
|
||
},
|
||
"timeout_seconds": 30,
|
||
"cost": {
|
||
"per_1k_tokens": 0.005,
|
||
"currency": "USD"
|
||
},
|
||
"auth": {
|
||
"type": "header",
|
||
"env_var": "CLAUDE_API_KEY",
|
||
"header_name": "x-api-key"
|
||
},
|
||
"rate_limits": {
|
||
"daily_tokens": 35000,
|
||
"requests_per_minute": 50
|
||
},
|
||
"features": {
|
||
"tool_use": true,
|
||
"structured_output": true
|
||
}
|
||
},
|
||
|
||
"nvidia": {
|
||
"name": "NVIDIA Nemotron (ADR-036)",
|
||
"enabled": false,
|
||
"priority": null,
|
||
"production_executable": false,
|
||
"mode": "non_executable_shadow_metadata_only",
|
||
"endpoint": "https://integrate.api.nvidia.com/v1",
|
||
"api_path": "/chat/completions",
|
||
"models": {
|
||
"default": "nvidia/nemotron-mini-4b-instruct",
|
||
"tool_calling": "nvidia/nemotron-mini-4b-instruct",
|
||
"rca": "nvidia/nemotron-mini-4b-instruct"
|
||
},
|
||
"options": {
|
||
"temperature": 0.0,
|
||
"max_tokens": 1024
|
||
},
|
||
"timeout_seconds": 30,
|
||
"cost": {
|
||
"per_1k_tokens": 0,
|
||
"currency": "USD",
|
||
"notes": "Free tier (2026-03-29) - timeout 30s,失敗後轉 Gemini"
|
||
},
|
||
"auth": {
|
||
"type": "header",
|
||
"env_var": "NVIDIA_API_KEY",
|
||
"header_name": "Authorization",
|
||
"header_prefix": "Bearer "
|
||
},
|
||
"rate_limits": {
|
||
"daily_tokens": 50000,
|
||
"requests_per_minute": 5
|
||
},
|
||
"features": {
|
||
"tool_use": true,
|
||
"structured_output": true,
|
||
"tool_calling_accuracy": 0.833
|
||
},
|
||
"use_for": ["tool_calling"]
|
||
}
|
||
},
|
||
|
||
"adr067_ollama_applications": {
|
||
"description": "ADR-067 五大 Ollama 本地 AI 應用 (Phase 30-34),2026-05-04 ogt + Claude Sonnet 4.6: endpoint 升級至 GCP-A Primary",
|
||
"endpoint": "http://34.143.170.20:11434",
|
||
"applications": {
|
||
"drift_summary": {
|
||
"phase": 30,
|
||
"model": "qwen3:14b",
|
||
"timeout_seconds": 90,
|
||
"purpose": "Config Drift 報告中文摘要"
|
||
},
|
||
"log_anomaly_summary": {
|
||
"phase": 31,
|
||
"model": "deepseek-r1:14b",
|
||
"timeout_seconds": 120,
|
||
"purpose": "K8s log 異常摘要,告警後觸發"
|
||
},
|
||
"pr_code_review": {
|
||
"phase": 32,
|
||
"model": "qwen2.5-coder:7b",
|
||
"timeout_seconds": 120,
|
||
"purpose": "Gitea PR 自動審查"
|
||
},
|
||
"rag_embed": {
|
||
"phase": 33,
|
||
"model": "bge-m3:latest",
|
||
"dimensions": 1024,
|
||
"timeout_seconds": 30,
|
||
"purpose": "RAG 知識庫向量化,pgvector 儲存(bge-m3 多語言 1024 維)"
|
||
},
|
||
"rag_generate": {
|
||
"phase": 33,
|
||
"model": "qwen3:14b",
|
||
"timeout_seconds": 60,
|
||
"purpose": "RAG 查詢回答生成,top_k=5"
|
||
},
|
||
"image_analysis": {
|
||
"phase": 34,
|
||
"model": "minicpm-v:latest",
|
||
"timeout_seconds": 60,
|
||
"purpose": "Telegram 圖片分析(minicpm-v 多模態精度優於 llava)"
|
||
}
|
||
}
|
||
},
|
||
|
||
"use_cases": {
|
||
"rca_analysis": {
|
||
"description": "Root Cause Analysis for alerts",
|
||
"preferred_provider": "ollama_gcp_a",
|
||
"fallback_enabled": true,
|
||
"fallback_order": ["ollama_gcp_b", "ollama_local", "gemini"],
|
||
"required_features": ["json_output"]
|
||
},
|
||
"log_summary": {
|
||
"description": "Summarize K8s logs for context gathering",
|
||
"preferred_provider": "ollama_gcp_a",
|
||
"fallback_enabled": true,
|
||
"fallback_order": ["ollama_gcp_b", "ollama_local", "gemini"],
|
||
"max_input_tokens": 4096
|
||
},
|
||
"telegram_compose": {
|
||
"description": "Compose compressed Telegram messages",
|
||
"preferred_provider": "ollama_gcp_a",
|
||
"fallback_enabled": false,
|
||
"max_output_tokens": 500
|
||
},
|
||
"tool_calling": {
|
||
"description": "K8s Tool Calling operations on the global production route",
|
||
"preferred_provider": "ollama_gcp_a",
|
||
"fallback_enabled": true,
|
||
"fallback_order": ["ollama_gcp_b", "ollama_local", "gemini"],
|
||
"required_features": ["tool_use"],
|
||
"notes": "NVIDIA/Nemotron is non-executable shadow metadata only"
|
||
}
|
||
},
|
||
|
||
"monitoring": {
|
||
"enabled": true,
|
||
"metrics": {
|
||
"track_latency": true,
|
||
"track_tokens": true,
|
||
"track_cost": true,
|
||
"track_fallbacks": true
|
||
},
|
||
"alerts": {
|
||
"daily_cost_threshold_usd": 5,
|
||
"monthly_cost_threshold_usd": 5,
|
||
"fallback_rate_threshold_percent": 20
|
||
}
|
||
},
|
||
|
||
"circuit_breaker": {
|
||
"enabled": true,
|
||
"failure_threshold": 5,
|
||
"recovery_timeout_seconds": 60,
|
||
"half_open_requests": 3
|
||
}
|
||
}
|