ai-usagebar 0.16.0

Waybar widget + TUI for AI plan usage across Anthropic, OpenAI, Z.AI, OpenRouter, DeepSeek, Kimi, and Antigravity
Documentation
# ai-usagebar configuration. Lives at ~/.config/ai-usagebar/config.toml.
# Every section and field is optional — missing config = defaults below.
#
# IMPORTANT: if you put an inline `api_key` in any section, chmod 600 the
# file (`chmod 600 ~/.config/ai-usagebar/config.toml`). Otherwise env vars
# are the safer choice.

[ui]
# Which vendor the widget shows when `--vendor` is omitted, AND which tab
# is selected when the TUI opens. Comment out to default to Anthropic.
# Valid: anthropic | openai | zai | openrouter | deepseek | kimi
# primary = "anthropic"

# Optional, TUI-only monitor for local Claude Code session context. When
# enabled, press `c` in ai-usagebar-tui. The scanner reads only bounded tails
# below ~/.claude/projects, skips subagent transcripts and never follows
# discovered symlinks. Nothing is read while this remains disabled.
[context]
enabled = false
# Where the view docks when opened: full (own screen) | split (beside the
# dashboard) | bottom. `v` cycles it while open; this is the starting value.
layout = "full"
# projects_path = "~/.claude/projects"  # default
# Set a fallback only when it matches the sessions you use. Without a known
# denominator the overlay shows raw input tokens rather than inventing a %.
# context_window_tokens = 200000
# Exact per-model values take precedence, which is useful when 200K and 1M
# sessions coexist. Keys must match the model id stored in the transcript.
# [context.model_context_window_tokens]
# "claude-opus-4-6" = 1000000

[anthropic]
enabled = true
# Path to the Claude CLI OAuth credentials. Leave commented out to use
# the default ~/.claude/.credentials.json.
# credentials_path = "/home/you/.claude/.credentials.json"

# Anthropic (API) — unlike the balance vendors above (which show your REMAINING
# credit), Anthropic does not expose the prepaid credit balance over any API
# (Console dashboard only), so this reports your month-to-date SPEND (consumed)
# instead — for your API/Console account, which is separate from the Claude Code
# OAuth login above.
#
# NOTE: the cost API does NOT report Priority Tier usage, so if your
# organization is on Priority Tier the figure shown here is LOWER than your
# real total spend. See
# https://platform.claude.com/docs/en/manage-claude/usage-cost-api
#
# Opt-in (disabled until you set a key). Requires a Console *Admin key*
# (`sk-ant-admin01-...`, sent as the `x-api-key` header), distinct from an
# inference key. Admin keys exist only for ORGANIZATION accounts: set one up
# first (Console > Settings > Organization) — the .../settings/admin-keys page
# 404s for individual accounts.
[anthropic_api]
enabled = false
api_key_env = "ANTHROPIC_ADMIN_KEY"  # checked first; if set + non-empty, used
# api_key = "sk-ant-admin01-..."      # fallback; chmod 600 the file if you use it
# Positive, finite monthly USD limit for the spend-vs-limit % display (the API
# doesn't expose a limit). With it: "$1.34 / $1000 · 0%". Without it:
# "$1.34/mo".
# monthly_limit = 1000

[openai]
enabled = true
# Path to the Codex CLI OAuth credentials. Leave commented out to use
# the default ~/.codex/auth.json.
# codex_auth_path = "/home/you/.codex/auth.json"
# RESERVED — setting this does nothing today. It names the env var a future
# API-key-only path would read (admin key → `/v1/organization/costs`). No code
# consumes it: OpenAI usage comes only from Codex OAuth. Left commented out so
# it isn't mistaken for a working alternative to `codex login`.
# admin_key_env = "OPENAI_ADMIN_KEY"

[zai]
enabled = true
# Credential resolution order: env var → inline api_key → error.
api_key_env = "ZAI_API_KEY"      # checked first; if set + non-empty, used
# api_key = "..."                # fallback for users who don't export env vars
# Display-only. Used when the API doesn't return a plan tier itself.
# plan_tier = "lite"   # lite | pro | max

[openrouter]
enabled = true
api_key_env = "OPENROUTER_API_KEY"
# api_key = "sk-or-v1-..."

[deepseek]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
enabled = false
api_key_env = "DEEPSEEK_API_KEY"  # checked first; if set + non-empty, used
# api_key = "sk-..."              # fallback; chmod 600 the file if you use it

[kimi]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
# Shows Kimi Code subscription quota (weekly + 5h rolling window) from the
# undocumented, community-confirmed api.kimi.com/coding/v1/usages endpoint.
enabled = false
api_key_env = "KIMI_API_KEY"      # checked first; if set + non-empty, used
# api_key = "sk-..."              # fallback; chmod 600 the file if you use it

# --- Account-balance vendors -------------------------------------------------
# These report your REMAINING credit as money, rather than plan usage as a %.
# All are opt-in and never fetch until enabled with a key present.

[kilo]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
# Remaining credit from the undocumented api.kilo.ai/api/profile/balance
# endpoint (used internally by the Kilo Code extension).
enabled = false
api_key_env = "KILO_API_KEY"       # checked first; if set + non-empty, used
# api_key = "..."                  # fallback; chmod 600 the file if you use it
# Scopes the balance to a team via the x-kilocode-organizationid header.
# Omit for the personal balance. Switching this refetches rather than reusing
# the previous account's cached figure.
# organization_id = "org_..."

[novita]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
# Remaining credit from the documented
# api.novita.ai/openapi/v1/billing/balance/detail endpoint.
enabled = false
api_key_env = "NOVITA_API_KEY"     # checked first; if set + non-empty, used
# api_key = "..."                  # fallback; chmod 600 the file if you use it

[moonshot]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
# Account balance from the documented /v1/users/me/balance endpoint.
enabled = false
api_key_env = "MOONSHOT_API_KEY"   # checked first; if set + non-empty, used
# api_key = "sk-..."               # fallback; chmod 600 the file if you use it
# Region picks BOTH the host and the currency, so switching it refetches
# rather than showing the other region's figure:
#   global -> api.moonshot.ai (USD)   |   cn -> api.moonshot.cn (CNY)
# region = "global"

[grok]
# Disabled by default — enable once you've set a key (env var or inline).
# Saving a key in the Settings overlay writes the inline fallback AND flips
# `enabled` to true; clearing the field removes the inline key again.
# Prepaid credit from the documented xAI Management API
# management-api.x.ai/v1/billing/teams/{team}/prepaid/balance.
#
# This is the *Management* key (xAI Console > Management keys), NOT the
# inference key you use for chat completions.
enabled = false
api_key_env = "XAI_MANAGEMENT_KEY" # checked first; if set + non-empty, used
# api_key = "..."                  # fallback; chmod 600 the file if you use it
# The balance is per-team. A TEAM-scoped management key identifies its team on
# its own; an ORGANIZATION-scoped key cannot (its scopeId is an organization,
# not a team), so set the team explicitly here. Without it, an org-scoped key
# reports an error saying so instead of querying the wrong team.
# team_id = "..."

# Google Antigravity. No credentials: usage is read from whichever local
# Antigravity product is running (Antigravity 2.0, the `agy` CLI, or the IDE) —
# all three share one account-wide quota. Set ANTIGRAVITY_LS_ADDRESS to
# "host:port" only if auto-discovery of that local server ever fails.
[antigravity]
enabled = false