# AI Council - Provider Configuration
# File: config/providers.yaml

# =============================================================================
# PROVIDER DEFINITIONS
# =============================================================================

providers:
  # ---------------------------------------------------------------------------
  # ANTHROPIC (Claude) - Quality Control & Synthesis
  # ---------------------------------------------------------------------------
  anthropic:
    name: "Anthropic Claude"
    api_base: "https://api.anthropic.com/v1"
    api_type: "anthropic"  # Uses Anthropic SDK
    models:
      claude-sonnet-4:
        id: "claude-sonnet-4-20250514"
        context_length: 200000
        pricing:
          input: 3.00      # per million tokens
          output: 15.00
        strengths:
          - "Best reasoning"
          - "Highest quality output"
          - "Complex synthesis"
        use_for:
          - "Final synthesis"
          - "Quality validation"
          - "Client-facing content"
          - "Complex reasoning"
      claude-haiku-3.5:
        id: "claude-3-5-haiku-20241022"
        context_length: 200000
        pricing:
          input: 1.00
          output: 5.00
        strengths:
          - "Fast"
          - "Cheaper"
        use_for:
          - "Simple classification"
          - "Quick validation"

  # ---------------------------------------------------------------------------
  # DEEPSEEK - Primary Workhorse (Very Cheap)
  # ---------------------------------------------------------------------------
  deepseek:
    name: "DeepSeek"
    api_base: "https://api.deepseek.com/v1"
    api_type: "openai"  # OpenAI-compatible
    models:
      deepseek-chat:
        id: "deepseek-chat"
        context_length: 128000
        pricing:
          input_cache_hit: 0.028
          input_cache_miss: 0.28
          output: 0.42
        strengths:
          - "Extremely cheap"
          - "Good reasoning"
          - "128K context"
          - "Auto-caching"
        use_for:
          - "Initial brainstorming"
          - "Document extraction"
          - "Bulk processing"
          - "First-pass analysis"
      deepseek-reasoner:
        id: "deepseek-reasoner"
        context_length: 128000
        pricing:
          input_cache_hit: 0.028
          input_cache_miss: 0.28
          output: 0.42
        strengths:
          - "Chain-of-thought"
          - "Complex reasoning"
        use_for:
          - "Math problems"
          - "Logic puzzles"
          - "Step-by-step analysis"

  # ---------------------------------------------------------------------------
  # SILICONFLOW - Comprehensive Model Platform
  # Docs: https://docs.siliconflow.com
  # ---------------------------------------------------------------------------
  siliconflow:
    name: "SiliconFlow"
    api_base: "https://api.siliconflow.com/v1"
    api_type: "openai"  # OpenAI-compatible
    models:
      # === DeepSeek Models ===
      deepseek-v3.2:
        id: "deepseek-ai/DeepSeek-V3.2"
        context_length: 164000
        pricing:
          input: 0.27
          output: 0.42
        strengths:
          - "Latest DeepSeek"
          - "Reasoning + tool use"
          - "164K context"
        use_for:
          - "Complex reasoning"
          - "Agentic tasks"
          - "Primary workhorse"
      deepseek-v3.1-terminus:
        id: "deepseek-ai/DeepSeek-V3.1-Terminus"
        context_length: 164000
        pricing:
          input: 0.27
          output: 1.00
        strengths:
          - "Stable production version"
        use_for:
          - "Production workloads"
      deepseek-v3:
        id: "deepseek-ai/DeepSeek-V3"
        context_length: 164000
        pricing:
          input: 0.25
          output: 1.00
        strengths:
          - "Proven stable"
        use_for:
          - "Backup"
      deepseek-r1:
        id: "deepseek-ai/DeepSeek-R1"
        context_length: 164000
        pricing:
          input: 0.50
          output: 2.18
        strengths:
          - "Chain-of-thought reasoning"
          - "Math & code"
        use_for:
          - "Complex math"
          - "Step-by-step reasoning"
      deepseek-r1-distill-qwen-32b:
        id: "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B"
        context_length: 131072
        pricing:
          input: 0.25
          output: 0.25
        strengths:
          - "R1 reasoning distilled"
          - "Cheaper than full R1"
        use_for:
          - "Cost-effective reasoning"
      deepseek-r1-distill-qwen-14b:
        id: "deepseek-ai/DeepSeek-R1-Distill-Qwen-14B"
        context_length: 131072
        pricing:
          input: 0.15
          output: 0.15
        strengths:
          - "Smaller, faster"
        use_for:
          - "Quick reasoning tasks"
      # FREE MODEL
      deepseek-v3.1-nex-n1:
        id: "Nex-AGI/DeepSeek-V3.1-Nex-N1"
        context_length: 131000
        pricing:
          input: 0.00
          output: 0.00
        strengths:
          - "FREE"
          - "131K context"
        use_for:
          - "Testing"
          - "High volume cheap tasks"
      
      # === Qwen Models ===
      qwen2.5-72b:
        id: "Qwen/Qwen2.5-72B-Instruct"
        context_length: 131072
        pricing:
          input: 0.50
          output: 0.50
        strengths:
          - "Large model"
          - "Good Chinese"
        use_for:
          - "Chinese documents"
          - "Complex tasks"
      qwen2.5-32b:
        id: "Qwen/Qwen2.5-32B-Instruct"
        context_length: 131072
        pricing:
          input: 0.25
          output: 0.25
        strengths:
          - "Good balance"
        use_for:
          - "General tasks"
      qwen2.5-14b:
        id: "Qwen/Qwen2.5-14B-Instruct"
        context_length: 131072
        pricing:
          input: 0.15
          output: 0.15
        strengths:
          - "Fast, cheap"
        use_for:
          - "Simple tasks"
      qwen2.5-coder-32b:
        id: "Qwen/Qwen2.5-Coder-32B-Instruct"
        context_length: 131072
        pricing:
          input: 0.25
          output: 0.25
        strengths:
          - "Code specialized"
          - "GPT-4 level coding"
        use_for:
          - "Code generation"
          - "Code review"
      qwen3-coder-480b:
        id: "Qwen/Qwen3-Coder-480B-A35B-Instruct"
        context_length: 262144
        pricing:
          input: 0.50
          output: 1.50
        strengths:
          - "Best Qwen coder"
          - "256K context"
          - "Agentic coding"
        use_for:
          - "Complex code tasks"
          - "Repository-scale"
      
      # === Vision Models ===
      qwen3-vl-32b:
        id: "Qwen/Qwen3-VL-32B-Instruct"
        context_length: 262144
        pricing:
          input: 0.20
          output: 0.60
        strengths:
          - "Vision + text"
          - "262K context"
        use_for:
          - "Document analysis"
          - "Image understanding"
      deepseek-vl2:
        id: "deepseek-ai/DeepSeek-VL2"
        context_length: 131072
        pricing:
          input: 0.20
          output: 0.60
        strengths:
          - "OCR"
          - "Chart/table understanding"
        use_for:
          - "Document OCR validation"
          - "Visual QA"
      glm-4.6v:
        id: "THUDM/GLM-4.6V"
        context_length: 131000
        pricing:
          input: 0.30
          output: 0.90
        strengths:
          - "Multimodal tool use"
          - "Visual intelligence"
        use_for:
          - "Vision tasks"
          - "Tool calling with images"
      
      # === Other Models ===
      minimax-m2:
        id: "MiniMaxAI/MiniMax-M2"
        context_length: 197000
        pricing:
          input: 0.30
          output: 1.20
        strengths:
          - "197K context"
          - "Coding & agents"
        use_for:
          - "Long context tasks"

  # ---------------------------------------------------------------------------
  # TOGETHER.AI - Open Source Models
  # ---------------------------------------------------------------------------
  together:
    name: "Together AI"
    api_base: "https://api.together.xyz/v1"
    api_type: "openai"  # OpenAI-compatible
    models:
      llama-70b:
        id: "meta-llama/Llama-3.3-70B-Instruct-Turbo"
        context_length: 131072
        pricing:
          input: 0.88
          output: 0.88
        strengths:
          - "Open source"
          - "Good general performance"
        use_for:
          - "Diverse perspective"
          - "Backup"
      qwen-72b:
        id: "Qwen/Qwen2.5-72B-Instruct-Turbo"
        context_length: 131072
        pricing:
          input: 1.20
          output: 1.20
        strengths:
          - "Turbo version"
          - "Fast"
        use_for:
          - "When speed matters"

  # ---------------------------------------------------------------------------
  # VOLCENGINE (ByteDance Doubao) - Chinese Market
  # ---------------------------------------------------------------------------
  volcengine:
    name: "Volcengine Doubao"
    api_base: "https://ark.cn-beijing.volces.com/api/v3"
    api_type: "openai"  # OpenAI-compatible
    models:
      doubao-pro-32k:
        id: "doubao-pro-32k"
        context_length: 32000
        pricing:
          input: 0.80
          output: 2.00
        strengths:
          - "ByteDance model"
          - "Good Chinese"
        use_for:
          - "Chinese content"
          - "Alternative perspective"

# =============================================================================
# TASK ROUTING
# =============================================================================

routing:
  # Document extraction - cheap & good enough
  document_extraction:
    primary: "deepseek:deepseek-chat"
    fallback: 
      - "siliconflow:deepseek-v3.2"
      - "siliconflow:qwen2.5-32b"
  
  # Quality validation - best quality
  quality_validation:
    primary: "anthropic:claude-sonnet-4"
    fallback:
      - "deepseek:deepseek-chat"
  
  # Brainstorming - multiple perspectives
  brainstorming:
    participants:
      - "deepseek:deepseek-chat"
      - "siliconflow:deepseek-v3.2"
      - "siliconflow:qwen2.5-72b"
    synthesis: "anthropic:claude-sonnet-4"
  
  # Chinese documents
  chinese_documents:
    primary: "siliconflow:qwen2.5-72b"
    fallback:
      - "siliconflow:qwen2.5-32b"
      - "deepseek:deepseek-chat"
  
  # Cost-sensitive bulk processing
  bulk_processing:
    primary: "siliconflow:deepseek-v3.1-nex-n1"  # FREE
    fallback:
      - "deepseek:deepseek-chat"
      - "siliconflow:qwen2.5-14b"
  
  # Complex reasoning
  reasoning:
    primary: "siliconflow:deepseek-r1"
    fallback:
      - "siliconflow:deepseek-r1-distill-qwen-32b"
      - "deepseek:deepseek-reasoner"
  
  # Code generation
  coding:
    primary: "siliconflow:qwen2.5-coder-32b"
    fallback:
      - "siliconflow:qwen3-coder-480b"
      - "deepseek:deepseek-chat"
  
  # Vision / OCR validation
  vision:
    primary: "siliconflow:deepseek-vl2"
    fallback:
      - "siliconflow:qwen3-vl-32b"
      - "siliconflow:glm-4.6v"
  
  # Long context (>100K tokens)
  long_context:
    primary: "siliconflow:minimax-m2"  # 197K
    fallback:
      - "siliconflow:qwen3-vl-32b"  # 262K
      - "siliconflow:deepseek-v3.2"  # 164K

# =============================================================================
# COST OPTIMIZATION RULES
# =============================================================================

cost_rules:
  # Use Claude only for final 20% of work
  claude_max_percentage: 20
  
  # Prefer DeepSeek for tasks under this complexity
  deepseek_complexity_threshold: "medium"
  
  # Use caching aggressively
  enable_prompt_caching: true
  
  # Batch similar requests
  batch_window_seconds: 5

# =============================================================================
# RATE LIMITS (requests per minute)
# =============================================================================

rate_limits:
  anthropic: 50
  deepseek: 100
  siliconflow: 100
  together: 60
  volcengine: 50