diff --git a/api/onboarding.py b/api/onboarding.py index f09651c4..d2be6d50 100644 --- a/api/onboarding.py +++ b/api/onboarding.py @@ -71,7 +71,9 @@ _SUPPORTED_PROVIDER_SETUPS = { "default_model": "anthropic/claude-sonnet-4.6", "requires_base_url": False, "models": [ - {"id": _to_openrouter_namespace(model["id"]), "label": model["label"]} + {"id": "z-ai/glm-4.5-air", "label": "GLM-4.5 Air (free)"} + if model["id"] == "zai/glm-4.5-flash" + else {"id": _to_openrouter_namespace(model["id"]), "label": model["label"]} for model in _FALLBACK_MODELS ], "category": "easy_start", diff --git a/tests/test_onboarding_mvp.py b/tests/test_onboarding_mvp.py index 664fe220..f15a9663 100644 --- a/tests/test_onboarding_mvp.py +++ b/tests/test_onboarding_mvp.py @@ -249,3 +249,37 @@ def test_onboarding_setup_rejects_api_key_with_newline(): ) assert status == 400 assert "newline" in data["error"].lower() + + +# ── Regression: #7520 ──────────────────────────────────────────────────────── + +def test_openrouter_wizard_no_dead_zai_ids(): + """OpenRouter wizard must not offer zai/glm-4.5-flash — OpenRouter does not + serve it. The free-tier equivalent is z-ai/glm-4.5-air. (#7520)""" + from api.onboarding import _SUPPORTED_PROVIDER_SETUPS + + or_setup = _SUPPORTED_PROVIDER_SETUPS["openrouter"] + or_ids = {m["id"] for m in or_setup["models"]} + + # Dead id must not appear in the OpenRouter projection + assert "zai/glm-4.5-flash" not in or_ids, ( + "OpenRouter wizard still offers dead id zai/glm-4.5-flash" + ) + # The remapped replacement must be present + assert "z-ai/glm-4.5-air" in or_ids, ( + "OpenRouter wizard missing remapped z-ai/glm-4.5-air" + ) + + +def test_zai_native_still_has_glm_4_5_flash(): + """The native Z.AI onboarding setup must still offer glm-4.5-flash — + the remapping is OpenRouter-only.""" + from api.onboarding import _SUPPORTED_PROVIDER_SETUPS + + zai_setup = _SUPPORTED_PROVIDER_SETUPS["zai"] + zai_ids = {m["id"] for m in zai_setup["models"]} + + assert "glm-4.5-flash" in zai_ids, ( + "Native Z.AI setup lost glm-4.5-flash — the remapping must be " + "OpenRouter-only, not touching _FALLBACK_MODELS" + )