model_list:
  # ── oO aliases (used by ml/serving; see oO/CLAUDE.md AI stack) ──────────
  - model_name: tip-generator
    litellm_params:
      model: ollama/qwen2.5:1.5b
      api_base: http://host.docker.internal:11434

  - model_name: embedder
    litellm_params:
      model: ollama/nomic-embed-text
      api_base: http://host.docker.internal:11434

  # kb#164: the ACTUAL embedder in use (§3a routing classifier for Auto
  # Router v2) is bge-m3 on 11436, not the `embedder` alias above (which
  # still points at nomic-embed-text on 11434 -- that alias is legacy/
  # unused by the current stack, left as-is per kb#164 scope: add bge-m3,
  # don't touch the mismatch beyond noting it). model-registry.yaml's
  # `bge-m3` entry's litellm_model_name now matches this model_name.
  - model_name: bge-m3
    litellm_params:
      model: ollama/bge-m3
      api_base: http://host.docker.internal:11436

  - model_name: judge
    litellm_params:
      model: anthropic/claude-haiku-4-5-20251001
      api_key: os.environ/ANTHROPIC_API_KEY

  # Kimi Code CLI agent (own container, own Moonshot/Kimi subscription via `kimi login`)
  - model_name: kimi-agent
    litellm_params:
      model: openai/kimi-agent
      api_base: http://kimi-agent:8000/v1
      api_key: dummy

  # ── raw model exposure ─────────────────────────────────────────────────
  - model_name: ollama/qwen3.5:4b
    litellm_params:
      model: ollama/qwen3.5:4b
      api_base: http://host.docker.internal:11436

  - model_name: ollama/qwen3:8b
    litellm_params:
      model: ollama/qwen3:8b
      api_base: http://host.docker.internal:11436

  - model_name: ollama/qwen2.5:1.5b
    litellm_params:
      model: ollama/qwen2.5:1.5b
      api_base: http://host.docker.internal:11436

  - model_name: ollama/qwen2.5:0.5b
    litellm_params:
      model: ollama/qwen2.5:0.5b
      api_base: http://host.docker.internal:11436

  - model_name: ollama/gemma3:4b
    litellm_params:
      model: ollama/gemma3:4b
      api_base: http://host.docker.internal:11436

  - model_name: ollama/gemma3:1b
    litellm_params:
      model: ollama/gemma3:1b
      api_base: http://host.docker.internal:11435

  - model_name: ollama/nomic-embed-text
    litellm_params:
      model: ollama/nomic-embed-text
      api_base: http://host.docker.internal:11435

  # OpenRouter free-tier models
  - model_name: meta-llama/llama-3.3-70b-instruct:free
    litellm_params:
      model: openrouter/meta-llama/llama-3.3-70b-instruct:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: meta-llama/llama-3.2-3b-instruct:free
    litellm_params:
      model: openrouter/meta-llama/llama-3.2-3b-instruct:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: deepseek/deepseek-r1:free
    litellm_params:
      model: openrouter/deepseek/deepseek-r1:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: qwen/qwen3-4b:free
    litellm_params:
      model: openrouter/qwen/qwen3-4b:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: qwen/qwen3-coder:free
    litellm_params:
      model: openrouter/qwen/qwen3-coder:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: google/gemma-3-27b-it:free
    litellm_params:
      model: openrouter/google/gemma-3-27b-it:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: google/gemma-3-12b-it:free
    litellm_params:
      model: openrouter/google/gemma-3-12b-it:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: mistralai/mistral-small-3.1-24b-instruct:free
    litellm_params:
      model: openrouter/mistralai/mistral-small-3.1-24b-instruct:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: nvidia/nemotron-3-super-120b-a12b:free
    litellm_params:
      model: openrouter/nvidia/nemotron-3-super-120b-a12b:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: openai/gpt-oss-120b:free
    litellm_params:
      model: openrouter/openai/gpt-oss-120b:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: minimax/minimax-m2.5:free
    litellm_params:
      model: openrouter/minimax/minimax-m2.5:free
      api_key: os.environ/OPENROUTER_API_KEY

  - model_name: nousresearch/hermes-3-llama-3.1-405b:free
    litellm_params:
      model: openrouter/nousresearch/hermes-3-llama-3.1-405b:free
      api_key: os.environ/OPENROUTER_API_KEY

  # ── kb#128 (A2A-16): tier pools — alvis's "tier" routing mode ───────────
  # target = constraint-set ("any large model"), not a specific backbone.
  # Two litellm_params entries sharing one model_name = a LiteLLM deployment
  # group; the router load-balances/fails-over across them. tier-large lists
  # kimi-agent FIRST so it's preferred, with local-small as the in-group
  # failover partner -- this is also what the fallbacks: block below promotes
  # to an explicit, auditable Kimi-429-degrades-to-local path (design §2
  # theorem 2: quota-gated a(t)=0 -> park/degrade, never fail).
  # tier-small mirrors model-registry.yaml's routing.tiers.small = [local-small].
  - model_name: tier-small
    litellm_params:
      model: ollama/gemma3:4b
      api_base: http://host.docker.internal:11436

  - model_name: tier-large
    litellm_params:
      model: openai/kimi-agent
      api_base: http://kimi-agent:8000/v1
      api_key: dummy

  # ── kb#128: Auto Router v2 -- embedding-based classification on the LOCAL
  # bge-m3 (design §3a/§3b: no classifier LLM, no API spend). Human-readable
  # source of truth for these routes: openai/auto-router-routes.json (keep
  # both in sync by hand -- see that file's _note for why).
  #
  # auto_router_config is INLINE JSON, not auto_router_config_path. This is
  # the open Auto Router v2 embedding bug the task brief warned about,
  # verified hands-on 2026-07-26 against litellm:main-latest: the _path
  # loader (AutoRouter -> SemanticRouter.from_json) unconditionally builds a
  # throwaway semantic_router encoder from scratch and demands a real
  # provider API key even for a local model name like "bge-m3" --
  # ValueError: "Expected API key via `api_key` parameter or
  # `{TYPE}_API_KEY` environment variable." The inline-string loader never
  # touches that code path (it just reads the `routes` key), and was
  # confirmed end-to-end: real `litellm.embedding(model=ollama/bge-m3)`
  # calls, zero metered spend, "hi there" -> ollama/gemma3:4b, a refactor/
  # dependency-injection prompt -> kimi-agent.
  #
  # default_model is the free local tier -- an unmatched/low-confidence
  # request degrades to free compute, never to a paid model.
  - model_name: auto_router
    litellm_params:
      model: auto_router/semantic-v1
      auto_router_default_model: ollama/gemma3:4b
      auto_router_embedding_model: bge-m3
      auto_router_config: >
        {"routes": [
        {"name": "ollama/gemma3:4b", "description": "Simple, short, low-stakes requests -- greetings, quick factual lookups, formatting, one-line questions.",
        "utterances": ["hi", "hello", "what time is it", "what's the weather", "thanks", "what does this word mean", "summarize this in one sentence", "give me a quick yes or no", "format this as a list", "what is 2 plus 2"],
        "score_threshold": 0.5},
        {"name": "kimi-agent", "description": "Complex reasoning, multi-step planning, coding, or anything needing tool use and deep context.",
        "utterances": ["write a function that parses this log file and extracts errors", "refactor this class to use dependency injection", "think through the tradeoffs of these two architectures step by step", "debug why this docker container keeps crashing", "plan out the migration from cognee to hindsight across five tasks", "analyze this design document and find inconsistencies", "write a SQL query that joins these three tables and aggregates by month", "review this pull request for security issues"],
        "score_threshold": 0.5}
        ]}

  # ── kb#128: heuristic keyword/length fallback classifier ────────────────
  # Auto Router v2 (2026-07-14) has an open embedding-related bug report
  # (task #128 brief) -- LiteLLM's built-in ComplexityRouter is exactly the
  # "keyword/length heuristic" fallback the brief calls for: pure regex/
  # token-count scoring, <1ms, ZERO external calls (verified hands-on by
  # reading router_strategy/complexity_router/complexity_router.py in the
  # running litellm:main-latest image, 2026-07-26). Tiers are overridden
  # here -- the package DEFAULT tiers point at gpt-4o/gpt-4o-mini/claude-
  # sonnet (metered!), which would silently violate §3a if left as-is; every
  # tier below maps only to already-governed non-metered deployments.
  - model_name: complexity_router
    litellm_params:
      model: auto_router/complexity_router
      complexity_router_default_model: ollama/gemma3:4b
      complexity_router_config:
        tiers:
          SIMPLE: ollama/gemma3:4b
          MEDIUM: ollama/gemma3:4b
          COMPLEX: tier-large
          REASONING: tier-large

litellm_settings:
  success_callback: ["langfuse"]
  failure_callback: ["langfuse"]
  drop_params: true
  fallbacks:
    - deepseek/deepseek-r1:free: ["ollama/qwen3.5:4b"]
    # kb#128 acceptance: "a forced Kimi 429 degrades cleanly". kimi-agent is
    # the only Kimi deployment actually routed through LiteLLM today (the
    # `kimi` model-registry id is called directly via the adolf-llm/
    # hindsight-llm wrappers, outside LiteLLM by design -- see model-
    # registry.yaml's kimi entry). Both the raw deployment and the tier-large
    # pool degrade to the free local-small model on 429/quota-exhaustion
    # rather than failing the caller.
    - kimi-agent: ["ollama/gemma3:4b"]
    - tier-large: ["tier-small"]
    # auto_router's embedding path is the one with the open bug report
    # (design §3a) -- if it errors, fail over to the zero-API-call heuristic
    # classifier rather than the caller seeing an error.
    - auto_router: ["complexity_router"]
