Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

zai-widget

Android home-screen widget for your Z.ai GLM Coding Plan — glance at your phone, see if quota is available, decide whether to send workloads.

Clock-style dial:

  • Outer ring = % of the 5-hour quota used (green → amber → red); on plans that report only a weekly window, the outer ring is the weekly quota
  • Weekly bar = % of the weekly quota used, drawn as a horizontal colour-coded bar under the dial when the plan reports both windows
  • Needle = time elapsed in the primary window (points up when a reset just happened, sweeps a full circle until the next reset)
  • Center = % used + runway ETA ("2h 41m left" at the current burn rate — ported from the zai-usage CLI's etaHours)
  • Below the dial: primary reset countdown, then a weekly bar row (wk + bar + 20% + 6d 22h), then credits (2k/10k cr), tool-call %, reset packs and plan tier
  • Wall-clock row with time, date, and day
  • In-app configuration toggles for the wall-clock row and quota statistics

Data comes straight from the same undocumented Z.ai monitor endpoints the zai-usage CLI uses (/api/monitor/usage/quota/limit + /api/biz/customer-package-reset/list) — no backend, the phone talks to api.z.ai with your GLM key.

The quota endpoint has two generations of payload and the widget understands both: legacy TOKENS_LIMIT rows and the credit-based CREDIT_LIMIT rows Z.ai's V3 coding plans return since mid-2026. Window identity comes from the (type, unit, number) triple — unit 3 is the 5-hour window, unit 6 is the weekly cap, unit 5 is monthly tool/search quota. When a response omits percentage, it is derived from currentValue / usage (or currentValue + remaining when usage is absent), and level / planName are shown as the plan tier.

Install

Grab zai-widget-v*.apk from Releases, sideload it, long-press your launcher → Widgets → zai-widget, drop it on the home screen, paste your GLM Coding Plan API key once (stored with EncryptedSharedPreferences). The setup screen also lets you show or hide the wall-clock row and the weekly/tool-call/reset-pack rows. Tap the ⟳ button (or the widget itself) any time to force a refresh — Android's minimum widget auto-refresh interval is 30 minutes, which is what updatePeriodMillis is set to; the button covers everything faster.

Android refreshes home-screen widgets at most every 30 minutes (updatePeriodMillis); tap for instant. That cadence is deliberate — battery-kind and fine for "do I have quota?" decisions.

Privacy

  • The API key never leaves the device (except to api.z.ai).
  • The app makes exactly two GET requests per refresh and stores nothing else. No analytics, no trackers.

Build

make verify   # unit tests + lint + assembleDebug (JDK 17, Android SDK 35)
make apk      # copy APK to releases/

Zero runtime dependencies — plain Kotlin + framework widgets (no Compose, no OkHttp; HttpURLConnection only), so builds are fast.

Repo family

  • zai-usage — the terminal CLI (quota, billing ledger, behavioral reviews, runway)
  • zai-widget — this widget (this repo)

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages