#!/usr/bin/env python3 """Retest Zhipu channel 107 (HmrK_money) after its weekly/monthly cap resets. Probes the HmrK Coding Plan key directly on glm-5.2 (and glm-4.7) against the coding endpoint, then tests the NewAPI channel itself. Prints a clear verdict. """ import json import time import urllib.request import urllib.error import newapi_client as nc HMRK = "07da445762144f82be2457dc58da35f6.luUK4XLKxBpRHmrK" CODING = "https://open.bigmodel.cn/api/coding/paas/v4/chat/completions" MODELS = ["glm-5.2", "glm-4.7", "glm-4.6", "glm-4.5"] def probe(model, retries=2): body = json.dumps({ "model": model, "max_tokens": 8, "messages": [{"role": "user", "content": "回复两个字:你好"}], }).encode() req = urllib.request.Request( CODING, data=body, headers={"Authorization": "Bearer " + HMRK, "Content-Type": "application/json"}, ) for attempt in range(retries + 1): try: with urllib.request.urlopen(req, timeout=40) as r: d = json.loads(r.read()) return r.getcode(), "OK", bool(d.get("choices")) except urllib.error.HTTPError as e: try: j = json.loads(e.read()) err = j.get("error", {}) return e.code, err.get("code", ""), err.get("message", "")[:120] except Exception: return e.code, "", "" except Exception as e: if attempt < retries: time.sleep(2 ** attempt) continue return -1, "NET", str(e) return -1, "NET", "" def main(): print("=" * 60) print("Zhipu 107 (HmrK_money) post-reset recheck") print("=" * 60) results = {} for m in MODELS: code, ecode, msg = probe(m) results[m] = (code, ecode, msg) verdict = "✅ USABLE" if code == 200 else f"❌ {code}/{ecode}" print(f" {m:10} {verdict:14} {msg}") time.sleep(1) print() print("NewAPI channel test (ID=107):") ok, msg, t = nc.test_channel(107) print(f" {'✅' if ok else '❌'} ({t}ms) {msg[:160]}") print() glm52 = results.get("glm-5.2", (None,)) if glm52[0] == 200: print("🎉 GLM-5.2 IS LIVE on HmrK! Channel 107 is serving glm-5.2.") elif glm52[1] == 1310: print("⏳ Still capped (1310) — quota not reset yet, try later.") elif glm52[1] == 1313: print("🐢 Rate limited (1313) — plan access confirmed, just throttled.") elif glm52[1] == 1113: print("⚠️ 1113 no balance — plan may have lapsed.") else: print(f"ℹ️ glm-5.2 status: {glm52}") if __name__ == "__main__": main()