Multi-LLM

InfoBelongs to: Tokenomics

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.
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.
| Item | Details |
|---|---|
| GLM Coding Plan | From $10/month (sign-up link) |
| Compatibility | Compatible with Claude Code — no code changes |
| Models | glm-5.3-flash (default), glm-5.3, GLM-4.7, GLM-4.5-Air, free models |
MoAI-ADK points all four Claude tiers at the same GLM model, through the
4 Claude Code ANTHROPIC_DEFAULT_*_MODEL environment variables:
| Claude tier | Environment variable | GLM model | Context |
|---|---|---|---|
| Opus | ANTHROPIC_DEFAULT_OPUS_MODEL | glm-5.3-flash | 1M |
| Sonnet | ANTHROPIC_DEFAULT_SONNET_MODEL | glm-5.3-flash | 1M |
| Haiku | ANTHROPIC_DEFAULT_HAIKU_MODEL | glm-5.3-flash | 1M |
| Fable | ANTHROPIC_DEFAULT_FABLE_MODEL | glm-5.3-flash | 1M |
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) inllm.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.
MoAI-ADK offers 3 LLM execution modes. Choose based on “what do you want to optimize”:
| Command | Leader | Workers | tmux required | Cost savings | Use case |
|---|---|---|---|---|---|
moai cc | Claude | Claude | No | - | Highest quality, complex work |
moai glm | GLM | GLM | Recommended | ~70% | Cost optimization |
moai cg | Claude | GLM | Required | ~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:#fffCG 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.
# 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)- CG Mode (Claude + GLM) — details of the tmux isolation architecture
- Model Policy — the per-agent model assignment table