# =========================================================================
# AETHONEX LITELLM DEMO COGNITIVE GATEWAY CONFIGURATION
# =========================================================================
# Purpose: APIs router & model routing blueprint for agency credibility.
# Architecture: LiteLLM serves as the cognitive switchboard. All team tools
# (n8n, Next.js client portal, chat surfaces) call this single endpoint.
# Benefits: Enables instant, runtime model switching, automatic fallback,
# full token costing tracking, and local/cloud redundancy.
# =========================================================================

model_list:
  # -----------------------------------------------------------------------
  # 1. PRIMARY LOCAL INFERENCE COGNITIVE TIERS
  # -----------------------------------------------------------------------
  # Standard drafting and reasoning. Deployed locally on your own server.
  # Zero marginal cost per query. 100% Zero-Egress.
  - model_name: aethonex-cognitive-core
    litellm_params:
      model: ollama/llama3:8b
      api_base: http://ollama:11434 # Internal Docker bridge DNS resolution
      tpm: 100000                   # Tokens Per Minute throughput limit
      rpm: 1000                     # Requests Per Minute limit

  # High-speed copywriting and rapid parsing tier. Deployed locally.
  - model_name: aethonex-drafting-engine
    litellm_params:
      model: ollama/mistral:7b
      api_base: http://ollama:11434
      tpm: 150000
      rpm: 1500

  # Local vector embeddings layer for custom PDF/brief context matching.
  - model_name: aethonex-memory-embeddings
    litellm_params:
      model: ollama/nomic-embed-text
      api_base: http://ollama:11434

  # -----------------------------------------------------------------------
  # 2. REDUNDANCY & ENTERPRISE FALLBACK TIERS (CLOUD BACKUP)
  # -----------------------------------------------------------------------
  # Deployed only as a hot-fallback. Activated only if the local bare-metal
  # GPU is occupied, or if an advanced multi-step reasoning task exceeds 
  # local context parameters.
  - model_name: aethonex-cognitive-fallback
    litellm_params:
      model: openai/gpt-4o
      api_key: "os.environ/OPENAI_API_KEY" # Secure runtime injection
      fallback_policy: "overload-only"    # Triggers only on local failure

# =========================================================================
# GATEWAY ROUTING SETTINGS
# =========================================================================
router_settings:
  routing_strategy: "latency-based-routing" # Routes to fastest healthy instance
  enable_fallbacks: true                    # Auto-fallback from local to cloud
  set_verbose: false                        # Telemetry disabled (privacy Gate)

# =========================================================================
# FALLBACK REDUNDANCY DECORATORS
# =========================================================================
# This block instructs the Aethonex core that if a local container drops or
# encounters an out-of-memory exception (OOM), it will dynamically re-route 
# the client's execution context to the secure cloud fallback.
fallbacks:
  - - aethonex-cognitive-core
    - aethonex-cognitive-fallback
  - - aethonex-drafting-engine
    - aethonex-cognitive-fallback

# =========================================================================
# PERFORMANCE CACHING CONFIG (DRAGONFLY CACHE BACKEND)
# =========================================================================
# Saves tokens by caching duplicate semantic queries in-memory. If an agency
# team member runs the same brief check twice, the response is served instantly
# in 0.2ms without hitting the GPU or LLM.
cache_settings:
  type: "redis"
  host: "dragonfly" # Fast Caching Layer
  port: 6379
  ttl: 3600         # Cache valid for 1 hour
