Skip to content

Add GLM-5.2 (Z.ai) premium cloud backend for routing#2

Open
Tennisee-data wants to merge 1 commit into
mainfrom
feat/glm-premium-backend
Open

Add GLM-5.2 (Z.ai) premium cloud backend for routing#2
Tennisee-data wants to merge 1 commit into
mainfrom
feat/glm-premium-backend

Conversation

@Tennisee-data

Copy link
Copy Markdown
Owner

What

Lets the premium routing tier run on a frontier cloud model (GLM-5.2 via Z.ai) while cheap/medium tasks stay local. Adds a zai/glm backend and per-tier backend selection in the router.

Why

GLM-5.2 is an open-weights model in the Claude Opus / GPT-5.5 class, but at 744B params it can't run on ACF's target consumer hardware (8–24GB). It can serve as an on-demand premium tier over its OpenAI-compatible API — local-first by default, frontier on the domains that warrant it (payments, security, auth, database).

Changes

  • llm_backend/__init__.pyZaiBackend: the OpenAI backend pre-pointed at Z.ai (https://api.z.ai/api/paas/v4/), reading ZAI_API_KEY (or GLM_API_KEY). Registered as "zai"/"glm". Not in auto-detect — opt-in premium tier, not a default.
  • pipeline/config.pyRoutingConfig.premium_backend / premium_base_url. Empty = unchanged (all tiers on the global backend).
  • orchestrator/runner.py_init_model_routing resolves a backend per tier; cache key is now (backend, model).
  • config.toml — documented opt-in block.
  • tests/test_premium_routing.py — 7 tests.

Enabling

export ZAI_API_KEY=sk-...
[routing]
enabled = true
premium_backend = "zai"
model_premium   = "glm-5.2"

Testing

26 tests pass (was 19). Ruff clean on new code.

⚠️ Unit-tested, not exercised against the live Z.ai API (no key on hand). Base URL, model id (glm-5.2), and Bearer auth confirmed from Z.ai docs; OpenAI-SDK wiring tested offline. Validate with a real key before relying on it. Coding-plan accounts should set premium_base_url = "https://api.z.ai/api/coding/paas/v4".

🤖 Generated with Claude Code

Add a "zai"/"glm" backend that reuses the OpenAI backend against Z.ai's
OpenAI-compatible endpoint, reading ZAI_API_KEY. Routing now resolves a
backend per tier (RoutingConfig.premium_backend), so the premium tier and
premium_domains can run on GLM-5.2 in the cloud while cheap/medium stay
local. Not added to auto-detect — it's an opt-in premium tier, not a default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant