llm-usage

command module
v0.0.0-...-9ebe6ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 1 Imported by: 0

README

llm-usage

A CLI tool to display your LLM API usage statistics across multiple providers (Claude, Kimi, Z.AI).

Features

  • View real-time usage statistics from multiple LLM providers
  • Multiple output formats: pretty-printed, JSON, and Waybar-compatible
  • Visual progress bars showing usage utilization
  • Displays reset times for usage windows
  • Filter by provider or view all at once

Prerequisites

For Claude usage, you must have the Claude CLI installed and authenticated.

Installation

From Source
go install github.com/denysvitali/llm-usage@latest
From Releases

Download the appropriate binary for your platform from the Releases page.

Usage

# Show all configured providers (default)
llm-usage

# Show specific provider
llm-usage --provider=claude
llm-usage --provider=kimi
llm-usage --provider=zai

# JSON output
llm-usage --json

# Waybar-compatible JSON output
llm-usage --waybar

# Show version
llm-usage --version
Configuration

Credentials are stored following the XDG Base Directory Specification:

  • $XDG_CONFIG_HOME/llm-usage/claude.json - Claude OAuth credentials
  • $XDG_CONFIG_HOME/llm-usage/kimi.json - Kimi API credentials
  • $XDG_CONFIG_HOME/llm-usage/zai.json - Z.AI API credentials

On Linux/macOS, $XDG_CONFIG_HOME defaults to ~/.config if not set.

Migrating from claude-code-usage
# Create the config directory
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/llm-usage"

# Copy existing Claude credentials
cp ~/.claude/.credentials.json "${XDG_CONFIG_HOME:-$HOME/.config}/llm-usage/claude.json"
Example Output
LLM Usage Statistics
====================

Claude (Pro/Max Subscription):
--------------------------------
  5-Hour Window:
    Usage:    [████████████░░░░░░░░] 60.0%
    Resets:   in 2h 15m
  7-Day Window:
    Usage:    [██████░░░░░░░░░░░░░░] 30.0%
    Resets:   in 3d 5h

Kimi:
--------------------------------
  Error: API not yet configured or not implemented

Z.AI:
--------------------------------
  Daily Usage:
    Usage:    [████░░░░░░░░░░░░░░░] 20.0%
    Limit:    1000000 tokens
Waybar Integration

Add this to your Waybar config:

{
  "custom/llm-usage": {
    "exec": "llm-usage --waybar",
    "return-type": "json",
    "interval": 300
  }
}

Building from Source

# Clone the repository
git clone https://github.com/denysvitali/llm-usage.git
cd llm-usage

# Build
make build

# Or install directly
make install

Development

# Run linter
make lint

# Run tests
make test

# Build and test everything
make all

Supported Providers

Provider Status Notes
Claude ✅ Implemented Requires Claude CLI OAuth credentials
Kimi 🔜 Planned API endpoint identified, implementation pending
Z.AI 🔜 Planned API endpoint identified, implementation pending

License

MIT License - see LICENSE for details.

Documentation

Overview

Package main provides the CLI for llm-usage.

Directories

Path Synopsis
Package cmd provides the Cobra CLI commands for llm-usage.
Package cmd provides the Cobra CLI commands for llm-usage.
internal
cache
Package cache provides a file-based caching mechanism.
Package cache provides a file-based caching mechanism.
credentials
Package credentials provides credential loading for LLM providers.
Package credentials provides credential loading for LLM providers.
keychain
Package keychain provides platform-specific credential storage.
Package keychain provides platform-specific credential storage.
provider
Package provider provides the abstraction layer for LLM usage providers.
Package provider provides the abstraction layer for LLM usage providers.
provider/claude
Package claude implements the Claude API provider for llm-usage.
Package claude implements the Claude API provider for llm-usage.
provider/kimi
Package kimi implements the Kimi API provider for llm-usage.
Package kimi implements the Kimi API provider for llm-usage.
provider/minimax
Package minimax implements the MiniMax API provider for llm-usage.
Package minimax implements the MiniMax API provider for llm-usage.
provider/zai
Package zai implements the Z.AI API provider for llm-usage.
Package zai implements the Z.AI API provider for llm-usage.
serve
Package serve provides the HTTP server for the web UI and API
Package serve provides the HTTP server for the web UI and API
setup
Package setup provides the setup wizard and account management for llm-usage.
Package setup provides the setup wizard and account management for llm-usage.
setup/tui
Package tui provides the Bubble Tea TUI for the setup wizard.
Package tui provides the Bubble Tea TUI for the setup wizard.
usage
Package usage provides shared usage fetching and output logic.
Package usage provides shared usage fetching and output logic.
version
Package version provides the application version information.
Package version provides the application version information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL