Add GLM-5.2 (Z.ai) as a first-class provider — frontier-class open weights at 1/6th the cost

2026-07-04

routerprovider-catalogdashboard

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.zai registers the https://api.z.ai/api/paas/v4 base URL, openai-compatible

wire protocol, and ZAI_API_KEY env var; aliases (zhipu, glm, z.ai, z-ai, bigmodel) resolve to zai.

  • PROVIDER_PRICING.zai carries verified direct rates: `{ input: 1.4, output: 4.4, cacheRead: 0.26,

cacheWrite: 0 } for glm-5.2 and glm-5`.

  • getEnvProviderIds() detects ZAI_API_KEY as a fleet key; the dashboard Providers page lists

"Z.ai (GLM)" for BYOK.

  • The CLI onboarding path registers glm-5.2 with a 1,000,000-token context window and makes it the

default GLM model.

The Numbers

GLM-5.2GPT-5.5Fable 5
Input $/M1.405.0010.00
Output $/M4.4030.0050.00
Context1Mlargelarge
WeightsOpen (MIT)ClosedClosed

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/models and GET /v1/providers/catalog read the catalog and pick up zai automatically.
  • [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.mdx tracks capabilities→files, not a provider enumeration; GLM-5.2 extends the existing provider-catalog capability.