# Copy to .env and fill in. .env is git-ignored. # Your GLM (Zhipu / Z.ai) API key. Used as a Bearer token. GLM_API_KEY=your-zai-key-here # Anthropic-compatible endpoint for the GLM coding plan. GLM_BASE_URL=https://api.z.ai/api/anthropic # --- optional tuning (sensible defaults baked in) --- # GLM_USE_HAIKU=off # off (DEFAULT) = skip the Haiku `glm` subagent and call GLM directly # # (mcp__glm__glm_agent) so ALL tokens stay on GLM. Set to `on` to allow # # the Haiku-orchestrated subagent (it spends some Claude tokens). # GLM_DELEGATE=off # off (DEFAULT) = hide the text-only glm_delegate tool so orchestrators # # always use glm_agent (which handles text-only tasks too). Set on to expose it. # GLM_COST_BIAS=7 # how hard to favor GLM. Default 7 => GLM handles ~98-100% of tasks # # (Opus only for vision/parallel/huge-context/sensitive/heavy tool-loops). # # Lower (e.g. 1.5) to route more hard tasks to Opus; 0 = capability only. # GLM_MAX_CONCURRENT=1 # GLM caps in-flight requests ~1; keep at 1 unless your tier allows more # --- output token cap (OFF by default = generous) --- # The glm_agent/glm_delegate max_tokens param defaults to "auto" (uncapped/generous -- the # orchestrating agent decides; it may pass a specific number to cap a given call). # By default the cap is OFF: every call may use up to GLM_MAX_TOKENS_CEILING (131072). # max_tokens is a ceiling, not a target -- you pay for ACTUAL output, so leaving it off # just prevents truncation. Turn the cap ON to control spend. # GLM_CAP=off # off (default) | on -- enforce GLM_MAX_TOKENS when on # GLM_MAX_TOKENS=32768 # the hard per-call limit applied WHEN GLM_CAP=on # GLM_MAX_TOKENS_CEILING=131072 # the generous default used when the cap is OFF # GLM_MAX_RETRIES=4 # GLM_STALL_TIMEOUT_MS=120000 # abort a turn only after this long with NO stream bytes (idle/stall # # timeout). Streaming keeps resetting it, so a long-but-active turn is # # never cut off. Falls back to GLM_TIMEOUT_MS, then 120000. # GLM_TIMEOUT_MS=300000 # GLM_AGENT_MAX_ITERS=30 # max tool-loop turns for glm_agent before it stops # GLM_AGENT_BASH_TIMEOUT_MS=120000 # per-command timeout for glm_agent's run_bash # GLM_OFFPEAK_MODEL=glm-5.2 # model(s) for "auto" off-peak. Can be a COMMA LIST, e.g. # # "glm-5.2,glm-5-turbo" -> the router auto-picks (most capable for # # hard tasks, cheapest for easy ones). # GLM_PEAK_MODEL=glm-5.2 # model(s) for "auto" during peak. glm-5.x carries the ~3x surcharge, # # so when "auto" lands on a glm-5.x model the router routes LESS to GLM # # at peak. Include a no-surcharge model (e.g. "glm-5.2,glm-4.7") and # # the router will prefer it at peak -> GLM stays fine to use. # GLM_CHEAP_MODEL=glm-4.5-air # GLM_PEAK_START_CN=14 # peak window start, China hour (UTC+8) # GLM_PEAK_END_CN=18 # peak window end (exclusive)