Skip to main content
SECTION · MULTI-LLM MODE

Multi-LLM

Info
Belongs to: Tokenomics

CG Mode structure

Beyond the Claude API, MoAI-ADK supports z.ai GLM as an alternative AI backend. This is not a convenience feature — it is the cost dimension of v3.0’s three core elements, Tokenomics (Token Economics). To get the same quality of code at a lower cost, you must be able to assign the right model to each task.

What is z.ai GLM?

GLM (Generative Language Model) is an AI model service provided by z.ai that is compatible with Claude Code. You can switch with environment variables alone — no code changes.

ItemDetails
GLM Coding PlanFrom $10/month (sign-up link)
CompatibilityCompatible with Claude Code — no code changes
Modelsglm-5.3-flash (default), glm-5.3, GLM-4.7, GLM-4.5-Air, free models

Default model mapping

MoAI-ADK points all four Claude tiers at the same GLM model, through the 4 Claude Code ANTHROPIC_DEFAULT_*_MODEL environment variables:

Claude tierEnvironment variableGLM modelContext
OpusANTHROPIC_DEFAULT_OPUS_MODELglm-5.3-flash1M
SonnetANTHROPIC_DEFAULT_SONNET_MODELglm-5.3-flash1M
HaikuANTHROPIC_DEFAULT_HAIKU_MODELglm-5.3-flash1M
FableANTHROPIC_DEFAULT_FABLE_MODELglm-5.3-flash1M

glm-5.3 stays selectable in any tier slot — set the slot in llm.yaml (llm.glm.models.*) and it loads unchanged (1M context, standard effort collapse).

Claude Code sizes the auto-compact window once, from the Opus slot, and every agent spawned into another slot inherits it. A smaller model in the Sonnet or Haiku slot would run past its own limit with compaction still waiting for a ceiling it never reaches — which is why all four slots hold the same 1M model. Tier differentiation moves to the effort axis, where z.ai actually implements it. This slot mapping is configured via glm.models (high/medium/low/fable) in llm.yaml, each injected through the environment variables above. The Fable environment variable is officially supported since Claude Code v2.1.202.

Free models are also available: GLM-4.7-Flash, GLM-4.5-Flash. See z.ai Pricing for full pricing.

3 execution modes

MoAI-ADK offers 3 LLM execution modes. Choose based on “what do you want to optimize”:

CommandLeaderWorkerstmux requiredCost savingsUse case
moai ccClaudeClaudeNo-Highest quality, complex work
moai glmGLMGLMRecommended~70%Cost optimization
moai cgClaudeGLMRequired~60%Quality + cost balance
graph TD
    A["MoAI Orchestrator"] --> B{"Select execution mode"}
    B -->|"moai cc"| C["Claude Only
Highest quality"] B -->|"moai glm"| D["GLM Only
Cost savings"] B -->|"moai cg"| E["CG Hybrid
Balanced"] C --> F["Leader: Claude
Workers: Claude"] D --> G["Leader: GLM
Workers: GLM"] E --> H["Leader: Claude
Workers: GLM"] style C fill:#7C3AED,color:#fff style D fill:#059669,color:#fff style E fill:#D97706,color:#fff

CG mode is the flagship example of Tokenomics. Work where reasoning quality matters — strategy, planning, auditing — goes to the Claude leader, while volume-heavy work like bulk implementation goes to GLM workers. For implementation-heavy work, this saves roughly 60-70% of the cost.

Quick start

bash
# 1. Save your GLM API key (once)
moai glm setup sk-your-glm-api-key

# 2. Pick a mode
moai cc            # Claude only
moai glm           # GLM only
moai cg            # CG hybrid (tmux required)

Next steps