M11: provider model catalog, per-model context window, subscription usage in footer + /usage
ci / check (push) Canceled after 0s
ci / check (pull_request) Canceled after 0s

This commit is contained in:
hermes committed 2026-10-01 11:53:27 +00:00
1 parent 3fee36d788
commit 6533dde4ca
11 files changed
+751 -54

No files matched your search

+12
View File
@@ -26,6 +26,9 @@ class H(http.server.BaseHTTPRequestHandler):
LOG.append({"auth": self.headers.get("authorization"), "beta": self.headers.get("anthropic-beta"), "body": body})
turn = TURNS[min(len(LOG) - 1, len(TURNS) - 1)]
self.send_response(200)
self.send_header("anthropic-ratelimit-unified-5h-utilization", "0.42")
self.send_header("anthropic-ratelimit-unified-5h-reset", str(int(__import__("time").time()) + 7980))
self.send_header("anthropic-ratelimit-unified-7d-utilization", "0.13")
self.send_header("content-type", "text/event-stream")
self.end_headers()
w = self.wfile.write
@@ -46,6 +49,15 @@ class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
if self.path.startswith("/v1/models"):
# live catalog: newest first, includes a model the static fallback doesn't know
self.wfile.write(json.dumps({"data": [
{"id": "claude-opus-5-5", "max_input_tokens": 1000000},
{"id": "claude-sonnet-5-5", "max_input_tokens": 1000000},
{"id": "claude-sonnet-5-6-preview", "max_input_tokens": 2000000},
{"id": "claude-haiku-4-5", "max_input_tokens": 200000},
]}).encode())
return
self.wfile.write(json.dumps(LOG).encode())
+15 -2
View File
@@ -52,6 +52,8 @@ def check(label, needle):
pump(1.5)
check("startup footer", "Claude")
check("latest default model", "claude-sonnet-5-5")
check("1M window", "/900k")
send(b"/skills\r")
check("skills from ~/.agents", "/deploy — ship it")
check("project .agents skills", "/lint — project lint")
@@ -63,8 +65,19 @@ check("tool call shown", "hello.txt")
check("tool outcome", "1 lines")
check("final answer", "Done: file says hi from hx.")
check("file written", "") if os.path.exists(f"{tmp}/repo/hello.txt") else (print("FAIL file"), None)
send(b"/model claude-opus-4-1\r")
check("model switch", "model → claude-opus-4-1")
check("quota in footer", "5h 42%")
send(b"/usage\r")
check("usage report", "58% left, resets in 2h1")
send(b"/model claude-opus-5-5\r")
check("model switch", "model → claude-opus-5-5 · context 1000k")
send(b"/model claude-sonnet-5-6-preview\r")
check("live catalog window", "context 2000k")
check("live catalog cached", "") if os.path.exists(f"{tmp}/home/.hx/models-claude.json") else (print("FAIL no model cache"), globals().update(ok=False))
buf = b""
send(b"/provider ")
check("only logged-in providers offered", "claude")
ok &= "codex" not in plain(); print("PASS no codex without login" if "codex" not in plain() else "FAIL codex offered")
send(b"\x15")
send(b"/bogus\r")
check("unknown cmd", "unknown command /bogus")
send(b"\x10") # ctrl-p