# claw-forge.local.yaml — per-machine overrides (GITIGNORED, never committed).
#
# Deep-merged on top of claw-forge.yaml at load time.  Put machine-specific
# secrets/toggles here so your edits SURVIVE `claw-forge run`: the startup
# uncommitted-state handler stashes edits to the *tracked* claw-forge.yaml
# (reverting them), but this gitignored overlay is left untouched.
#
# Everything below is commented out — an all-comment file is a safe no-op
# overlay.  Uncomment and edit what you need.
#
# Point the OAuth provider at a real token (run `claude setup-token`), and/or
# add a second account for a multi-account pool:
#
# providers:
#   claude-oauth:
#     oauth_token: ${ANTHROPIC_OAUTH_TOKEN}
#   claude-oauth-b:
#     type: anthropic_oauth
#     oauth_token: ${OAUTH_TOKEN_B}
#     priority: 2
#     enabled: true
#
# ---------------------------------------------------------------------------
# Anthropic-compatible model providers (Kimi, DeepSeek, GLM, Qwen, MiniMax, MiMo)
# ---------------------------------------------------------------------------
#
# Several labs expose a native Anthropic Messages endpoint, so the coding agent
# talks to them directly as `type: anthropic_compat`.  `base_url` and `model`
# travel with the credential on every dispatch, so these mix freely with a
# Claude provider as cheaper fallback tiers (give them a higher `priority:`
# number so they sit below your primary).
#
# They authenticate with a BEARER token, so use `oauth_token:` (injected as
# ANTHROPIC_AUTH_TOKEN) — NOT `api_key:`, which sends an x-api-key header.
#
# Model ids drift; verify the current one in each provider's own Claude Code
# doc before relying on it.
#
# providers:
#   kimi:                                    # Moonshot
#     type: anthropic_compat
#     oauth_token: ${MOONSHOT_API_KEY}
#     base_url: https://api.moonshot.ai/anthropic
#     model: kimi-k3
#     priority: 3
#   deepseek:
#     type: anthropic_compat
#     oauth_token: ${DEEPSEEK_API_KEY}
#     base_url: https://api.deepseek.com/anthropic
#     model: deepseek-chat
#     priority: 3
#   glm:                                     # Z.ai / Zhipu
#     type: anthropic_compat
#     oauth_token: ${ZAI_API_KEY}
#     base_url: https://api.z.ai/api/anthropic
#     model: glm-4.6
#     priority: 3
#   qwen:                                    # DashScope (Alibaba)
#     type: anthropic_compat
#     oauth_token: ${DASHSCOPE_API_KEY}
#     base_url: https://dashscope-intl.aliyuncs.com/api/v2/apps/claude-code-proxy
#     model: qwen3-coder-plus
#     priority: 4
#   minimax:
#     type: anthropic_compat
#     oauth_token: ${MINIMAX_API_KEY}
#     base_url: https://api.minimax.io/anthropic
#     model: MiniMax-M2
#     priority: 4
#   mimo:                                    # Xiaomi
#     type: anthropic_compat
#     oauth_token: ${MIMO_API_KEY}
#     base_url: https://api.xiaomimimo.com/anthropic
#     model: mimo-v2.5-pro
#     priority: 4
#
# China-mainland hosts differ and need their own keys.  Swap the base_url above
# (these are prose, not YAML — do not uncomment them as-is):
#   MiniMax    ->  https://api.minimaxi.com/anthropic
#   GLM        ->  https://open.bigmodel.cn/api/anthropic
#   DashScope  ->  https://dashscope.aliyuncs.com/api/v2/apps/claude-code-proxy
#
# These are provider-documented integrations, not Anthropic-endorsed.  If an
# agentic run returns HTTP 400s, try disabling extended thinking for that
# provider (seen with MiMo).
#
# ---------------------------------------------------------------------------
# Self-hosted llama.cpp (`llama-server`) — e.g. an Ornith / Qwen / Llama GGUF
# ---------------------------------------------------------------------------
#
# `llama-server` serves an Anthropic-shaped `/v1/messages`, real `tool_use`
# blocks included, so it is `type: anthropic_compat` exactly like the hosted
# providers above — NO translating proxy is needed.  (`type: ollama` is the
# separate OpenAI-compat path; the coding agent does not use it.)
#
#   llama-server -m Ornith-1.5-35B-Q5_K_M.gguf --host 0.0.0.0 --port 8080 #                --jinja -c 65536 -np 1
#
# providers:
#   ornith:
#     type: anthropic_compat
#     oauth_token: local-no-auth             # MUST be non-empty — see below
#     base_url: http://10.0.0.30:8080        # server ROOT, no /v1 suffix
#     model: ornith                          # whatever name you serve it under
#     priority: 0                            # lower number = tried first
#
# Four traps, each of which has cost real time:
#
#   * An EMPTY credential is not "no auth".  With neither `api_key` nor
#     `oauth_token` set, the dispatcher skips endpoint seeding entirely, so
#     ANTHROPIC_BASE_URL is never exported and every agent silently runs
#     against api.anthropic.com on your keychain identity.  llama-server
#     ignores the token — any non-empty dummy string is fine.
#   * `base_url` is the server root.  The client appends `/v1`, so writing it
#     here produces 404s on `/v1/v1/messages`.
#   * Concurrency is the `-n` flag on `claw-forge run`, NOT a config key.  A
#     server started `-np 1` has one slot; use `claw-forge run -n 1` or the
#     agents just queue behind each other.
#   * Context window: export CLAUDE_CODE_MAX_CONTEXT_TOKENS at ~85% of the
#     server's live `n_ctx` (llama.cpp reports it on `GET /props` as
#     `default_generation_settings.n_ctx`) before `claw-forge run`.  The CLI
#     otherwise assumes a Claude-sized window and the server truncates
#     mid-task.
#
# Budget a **~69k input-token floor per task** on this path (measured, and
# near-independent of task size): the harness preamble dominates, not your
# feature text — so splitting a feature in two roughly doubles token spend
# rather than halving it.
#
# ---------------------------------------------------------------------------
#
# NOTE: a bare ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN in your shell or .env
# short-circuits the pool entirely — the run uses that credential and NO
# rotation happens.  Keep per-provider keys under distinct names as above.
#
# Override which model an alias resolves to, without editing the committed
# config (`--model opus` then picks this up):
#
# model_aliases:
#   opus:   ${MODEL_OPUS:-claude-opus-4-6}
#   sonnet: ${MODEL_SONNET:-claude-sonnet-5}
#
# Model used by `claw-forge plan` for its own reasoning:
#
# agent:
#   plan_model: ${MODEL_PLAN:-claude-opus-4-6}
