Add GLM-5.2 (Z.ai) as a first-class provider — frontier-class open weights at 1/6th the cost
2026-07-04
LOCKSTEP TRACEABILITY MATRIX --- api_endpoints: ["none"] sdk_methods_updated: ["none"] mcp_tools_updated: ["none"] ---
What We Built
Promoted Z.ai (Zhipu) / GLM from a CLI-only integration to a first-class BrainstormRouter provider, and added GLM-5.2 — Z.ai's open-weight (MIT) MoE flagship (744B total / 40B active, 1M-token context). The provider now appears in the SaaS provider catalog, carries verified pricing for model:"auto" routing, is selectable in the dashboard for BYOK, and is detected as a platform-level fleet key via ZAI_API_KEY. On the CLI/agent runtime, glm-5.2 is now the default GLM model and is registered with its true 1M context window.
Because GLM speaks the OpenAI-compatible wire protocol, no new adapter was needed — the existing OpenAICompatAdapter handles it. The change is almost entirely catalog + config wiring plus a forward-compat guard so newly-released glm-5.x ids clone glm-4.7 when they aren't yet in pi-ai's built-in model catalog.
Why It Matters
GLM-5.2 is the strongest open-weight model on the Artificial Analysis Intelligence Index and is priced dramatically below the closed frontier ($1.40/$4.40 vs GPT-5.5 $5/$30 and Fable 5 $10/$50). Making it a first-class routing target lets BR's cost-optimizer send eligible traffic to a frontier-class model at a fraction of the cost, and lets tenants BYOK their own GLM keys directly from the dashboard.
How It Works
PROVIDER_CATALOG.zairegisters thehttps://api.z.ai/api/paas/v4base URL,openai-compatible
wire protocol, and ZAI_API_KEY env var; aliases (zhipu, glm, z.ai, z-ai, bigmodel) resolve to zai.
PROVIDER_PRICING.zaicarries verified direct rates: `{ input: 1.4, output: 4.4, cacheRead: 0.26,
cacheWrite: 0 } for glm-5.2 and glm-5`.
getEnvProviderIds()detectsZAI_API_KEYas a fleet key; the dashboard Providers page lists
"Z.ai (GLM)" for BYOK.
- The CLI onboarding path registers
glm-5.2with a 1,000,000-token context window and makes it the
default GLM model.
The Numbers
| GLM-5.2 | GPT-5.5 | Fable 5 | |
|---|---|---|---|
| Input $/M | 1.40 | 5.00 | 10.00 |
| Output $/M | 4.40 | 30.00 | 50.00 |
| Context | 1M | large | large |
| Weights | Open (MIT) | Closed | Closed |
Competitive Edge
Unlike Portkey/OpenRouter, which treat providers as opaque pass-throughs, BR carries verified per-model pricing so the cost-aware router can actively prefer GLM-5.2 when quality thresholds allow — turning a cheap open-weight model into a default-eligible routing target rather than a manual opt-in.
Lockstep Checklist
> _You MUST check these boxes [x] and verify the corresponding files are updated BEFORE committing this log._
- [x] API Routes: No
src/api/routes/change — catalog/pricing data only;GET /v1/modelsandGET /v1/providers/catalogread the catalog and pick upzaiautomatically. - [x] TS SDK: No change — SDK passes provider/model as free-form strings (no provider allowlist).
- [x] Python SDK: No change — same as TS SDK.
- [x] MCP Schemas: No change — no agent-facing endpoint added.
- [x] Master Record: No change —
master-capability-record.mdxtracks capabilities→files, not a provider enumeration; GLM-5.2 extends the existing provider-catalog capability.