Files
clawdmeter/tools
wenilandClaude Opus 4.8 ac0742d92c v3 M3: z.ai (GLM) provider — Anthropic-compatible poll from a pasted API key
ZaiProvider replaces the zai stub. It reaches z.ai's Anthropic-compatible
endpoint (default https://api.z.ai/api/anthropic) exactly like Claude Code with
ANTHROPIC_BASE_URL pointed at z.ai: a /v1/messages POST with a Bearer key. The
key + base URL come from the config the control panel's z.ai field writes
(providers.zai.base_url/.api_key) — no OAuth, no local files.

Two z.ai-specific cares: (1) static API key, no self-refresh; (2) the GLM Coding
Plan meters by prompts, so a 60s poll would drain quota — the provider
self-throttles to one network call per poll_interval_s (default 15 min) and
serves a cached status in between. Rate-limit parsing assumes z.ai proxies
Anthropic's unified headers (5h->s/sr, 7d->w/wr); if a real response lacks them
it still reports connected and logs the limit-ish headers it did return, so the
mapping can be finalized against a live key.

tools/probe_zai.py dumps a real z.ai response's headers (key via env, never
printed) to pin the exact header names. Graceful without a key: selecting z.ai
shows the blue theme + "no key", never crashes the loop. Registry: all three
providers now real; unknown ids fall back to StubProvider. +7 z.ai tests (mocked
transport: header mapping, auth, throttle, fallback); 120 passed, 2 Linux-only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 07:27:34 +03:00
..

Splash animation tools

Two-step pipeline for getting third-party 20×20 pixel animations onto the device.

1. Scrape

node scrape_claudepix.js

Fetches the manifest from claudepix.vercel.app/app.js, then each animation's HTML file, evaluates the embedded JS in a Node VM context (loading the same creature-engine.js the site uses), and writes resolved frame data to tools/claudepix_data/*.json.

Each output file looks like:

{
  "filename": "idle_breathe.html",
  "name": "idle breathe",
  "category": "Idle",
  "description": "...",
  "frame_count": 17,
  "frames": [{ "hold": 500, "grid": [[0,0,...],[0,1,1,...],...] }, ...]
}

Override URL or output dir with --base and --out.

2. Convert to C

node convert_to_c.js

Reads tools/claudepix_data/*.json and emits a single firmware/src/splash_animations.h with:

  • splash_<ident>_frames[N][400] — per-frame cell codes (0 = empty, 1 = body, 2 = eye)
  • splash_<ident>_holds[N] — per-frame hold time in ms
  • splash_anims[] — master table with name, category, frame count, pointers
  • SPLASH_ANIM_COUNT

The firmware (splash.cpp) consumes this header to render and animate.

Re-running

The scraper is idempotent — re-run any time the source library updates. The converter overwrites the header. Rebuild firmware after running both.

License note

The scraper hits a public site without a stated license. Confirm reuse is appropriate for your case before redistributing the output.