Omahub
← All plugins
R

Agent Usage: Z.ai + Synthetic

by radbug

Adds Z.ai Coding Plan and Synthetic quota records to Omarchy's built-in Agents panel.

Install
$ omarchy plugin add https://github.com/alvarosaavedra/omarchy-agent-usage-zai-synthetic --enable
Widgets #bar #quickshell #ai

Agent Usage: Z.ai + Synthetic

An Omarchy service plugin that adds Z.ai (GLM Coding Plan) and Synthetic (synthetic.new) usage records to Omarchy's built-in Agents panel — the panel that already ships Claude, Codex, and Fireworks tabs.

How it works

The built-in omarchy.agents panel draws one tab per JSON record in ~/.local/state/omarchy/agents/usage/. Omarchy runs its packaged omarchy-agent-usage-* collectors itself, but only scans OMARCHY_PATH/bin, so third-party providers need their own publisher.

This plugin is a headless service that:

  1. Runs the bundled Python collectors for Z.ai and Synthetic every 5 minutes (and on shell start).
  2. Validates each collector's JSON output.
  3. Publishes the records to the usage state directory with atomic writes.

The records follow the exact contract the panel consumes (label / percent / resetsAt limits, tier label, auth-help text), so the Z.ai and Synthetic tabs appear with no panel changes.

What it shows

  • Z.ai — plan tier (lite/standard/pro), the 5-hour session token window, the 7-day token window, and the monthly web-search allowance, straight from api.z.ai usage monitor.
  • Synthetic — the rolling 5-hour session budget, the weekly token budget, and the hourly search allowance (plus the legacy daily free-tool-call budget when an account reports it), from api.synthetic.new/v2/quotas.

Requirements

  • Omarchy (Quattro) with the built-in Agents widget enabled (omarchy plugin list should show omarchy.agents enabled).
  • python3 (already required by Omarchy's own Fireworks collector).
  • Credentials — either environment variables or an opencode sign-in:
    • Z.ai: ZAI_API_KEY, or a zai-coding-plan / zai entry in opencode's auth.json
    • Synthetic: SYNTHETIC_API_KEY, or a synthetic entry in opencode's auth.json

Without credentials the tabs still appear, showing the unavailable state plus setup instructions — the same behavior as the built-in collectors.

Install

omarchy plugin add https://github.com/alvarosaavedra/omarchy-agent-usage-zai-synthetic.git --enable

For a local checkout:

omarchy plugin add ~/Projects/omarchy-agent-usage-zai-synthetic --enable

Remove

omarchy plugin remove alvarosaavedra.agent-usage-zai-synthetic
rm -f ~/.local/state/omarchy/agents/usage/zai.json ~/.local/state/omarchy/agents/usage/synthetic.json

The panel has no expiry for records, so removing the last-written files stops the (now stale) tabs from lingering.

Development

omarchy plugin validate .
qmllint -I /usr/share/omarchy/shell Service.qml

The collectors run standalone for quick debugging:

python3 collectors/omarchy-agent-usage-zai | jq .
python3 collectors/omarchy-agent-usage-synthetic | jq .

License

MIT