From acc33f5ff49dfaca4f80d5d6bc8218e66f01222e Mon Sep 17 00:00:00 2001 From: teahubxyz Date: Sat, 10 Oct 2026 19:29:56 -0700 Subject: [PATCH] probe: show raw responses --- .github/workflows/probe.yml | 39 ++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/.github/workflows/probe.yml b/.github/workflows/probe.yml index ce3f1e0..5dc2be2 100644 --- a/.github/workflows/probe.yml +++ b/.github/workflows/probe.yml @@ -14,18 +14,31 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | python3 - <<'PY' - import json, os, urllib.request + import json, os, urllib.request, urllib.error tok = os.environ["GH_TOKEN"] - h = {"Authorization": f"Bearer {tok}", "Accept": "application/json"} - req = urllib.request.Request("https://models.github.ai/catalog/models", headers=h) - cat = json.loads(urllib.request.urlopen(req, timeout=30).read()) - print(f"{len(cat)} models") - for m in cat: - print(m["id"], "|", m.get("rate_limit_tier"), "|", m.get("publisher")) - body = {"model": "openai/gpt-4.1-mini", "messages": [{"role": "user", "content": "Reply with exactly: ok"}]} - req = urllib.request.Request("https://models.github.ai/inference/chat/completions", - data=json.dumps(body).encode(), method="POST", - headers={**h, "Content-Type": "application/json"}) - out = json.loads(urllib.request.urlopen(req, timeout=60).read()) - print("inference:", out["choices"][0]["message"]["content"]) + h = {"Authorization": f"Bearer {tok}", "Accept": "application/vnd.github+json", + "X-GitHub-Api-Version": "2022-11-28"} + def call(url, body=None): + req = urllib.request.Request(url, headers={**h, "Content-Type": "application/json"}, + data=json.dumps(body).encode() if body else None, + method="POST" if body else "GET") + try: + with urllib.request.urlopen(req, timeout=60) as r: + return r.status, r.headers.get("Content-Type"), r.read().decode(errors="replace") + except urllib.error.HTTPError as e: + return e.code, e.headers.get("Content-Type"), e.read().decode(errors="replace") + st, ct, txt = call("https://models.github.ai/catalog/models") + print("catalog:", st, ct, len(txt), "bytes") + try: + for m in json.loads(txt): + print(" ", m["id"], "|", m.get("rate_limit_tier")) + except Exception: + print(" raw:", txt[:300]) + for model in ("openai/gpt-4.1-mini", "xai/grok-3-mini", "deepseek/deepseek-v3-0324", "meta/llama-4-scout-17b-16e-instruct"): + st, ct, txt = call("https://models.github.ai/inference/chat/completions", + {"model": model, "messages": [{"role": "user", "content": "Reply with exactly: ok"}]}) + try: + print("inference", model, st, json.loads(txt)["choices"][0]["message"]["content"][:40]) + except Exception: + print("inference", model, st, txt[:200]) PY