Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zenmux-cli

Manage ZenMux accounts from the terminal — query quotas, switch API keys into Claude Code, and monitor usage in a live statusline.

中文文档

Node.js License Platform


Install

npm install -g .
# or during development
npm link

Account Management

Add an account

Keys are masked during input — only the first and last few characters are shown:

$ zenmux account add personal

? Management Key (required):  sk-mg-v****5a3f
? API Key (optional, press enter to skip):  sk-ss-v****c819
? Base URL (default: https://zenmux.ai/api/anthropic):
✓ Account "personal" added.
  Set as active account.

List accounts

$ zenmux account list

* personal
  work     (no api_key)

* marks the active account. Accounts without an api_key cannot be switched to.

Switch account

Without an argument, an interactive picker appears:

$ zenmux account use

? Select account to activate:
❯ personal  (current)
  work

✓ Switched to account "work".
  Claude Code updated: ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL set.

Or pass the name directly: zenmux account use personal


Status

Shows all accounts in parallel, each as a card with quota and balance:

$ zenmux status

╭──────────────────────────────────────────────────────────────────────────────╮
│ ● personal (active)                                                          │
│ ZenMux Ultra  ·  800 Flows/5h  ·  [healthy]                                 │
│ Worth $1,367/mo  ·  $200/month  ·  Renews Apr 27, 11:42 AM                  │
│                                                                              │
│ 5-Hour Window              Current Week                   PAYG Balance       │
│ Resets in 4h 36m           Resets Apr 13, 12:17 PM        $85.80            │
│ █░░░░░░░░░░░░░░░░░░░       ████░░░░░░░░░░░░░░░░           top-up  $0.00     │
│ 6%   50 / 800 flows        20%  1,240 / 6,182 flows       bonus   $85.80    │
│                                                           $0.052 / Flow     │
╰──────────────────────────────────────────────────────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────╮
│ ○ work                                                                       │
│ ZenMux Ultra  ·  800 Flows/5h  ·  [healthy]                                 │
│ Worth $870/mo  ·  $200/month  ·  Renews May 6, 12:15 PM                     │
│                                                                              │
│ 5-Hour Window              Current Week                   PAYG Balance       │
│ Resets in now              Resets Apr 11, 9:36 PM         $13.82            │
│ ░░░░░░░░░░░░░░░░░░░░       ██████████░░░░░░░░░░           top-up  $0.00     │
│ 0%   0 / 800 flows         48%  2,962 / 6,182 flows       bonus   $13.82    │
│                                                           $0.033 / Flow     │
╰──────────────────────────────────────────────────────────────────────────────╯

Active account has a green border. If one account's API call fails, its card shows the error while others render normally.

Append --json to get raw data for scripting:

zenmux status --json | jq '.[0].subscription.quota_5_hour'

Claude Code Statusline

Install a live quota bar at the bottom of every Claude Code session:

$ zenmux statusline install

✓ Statusline installed in ~/.claude/settings.json
  Preview:  ◉ personal · 5h █░░░░░░░ 6% 4h36m · 7d ██░░░░░░ 20% · PAYG $85.80
  Reload Claude Code to activate.

The statusline appears at the bottom of Claude Code and updates after every assistant message:

◉ personal · 5h ████░░░░ 43% 2h10m · 7d ████████░░░░░░░░ 78% · PAYG $85.80
Usage Color
> 70% Yellow
> 90% Red
PAYG < $10 Yellow

Data is cached for 60 seconds — the first call per minute hits the API; subsequent calls within that window return instantly from cache.

zenmux statusline install   # install and pre-fill cache
zenmux statusline remove    # remove from Claude Code

Other Query Commands

zenmux flow-rate            # current Flow exchange rate
zenmux payg                 # PAYG balance breakdown
zenmux generation <id>      # single generation record detail

All support --json.


Shell Completion

zenmux completion --install   # detect shell (zsh/bash/fish) and append to rc file
source ~/.zshrc               # reload without restarting shell

What gets completed:

Input Completions
zenmux <TAB> all top-level commands
zenmux account <TAB> list add remove use
zenmux account use <TAB> account names (live from config)
zenmux account remove <TAB> account names (live from config)

Output the script manually:

zenmux completion zsh
zenmux completion bash
zenmux completion fish

Config

Accounts are stored in ~/.zenmux-cli/config.json:

{
  "active": "personal",
  "accounts": {
    "personal": {
      "management_key": "sk-mg-...",
      "api_key": "sk-ss-v1-...",
      "base_url": "https://zenmux.ai/api/anthropic"
    }
  }
}
Field Required Description
management_key Used for all quota / balance queries
api_key Required for account use and generation
base_url Defaults to https://zenmux.ai/api/anthropic

zenmux account use <name> writes ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL into ~/.claude/settings.json, merging safely with any existing content.

About

CLI tool for managing ZenMux accounts and switching Claude Code API keys

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages