### ccmonitor --watch interval example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example demonstrating the use of --watch with various intervals, showing support for 5+ second intervals. ```bash --watch ``` -------------------------------- ### ccmonitor report --json example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'report' command with the --json option to get raw data output. ```bash report --json ``` -------------------------------- ### ccmonitor report --full --since example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'report' command with --full and a --since time filter to display usage from a specific start date, including zero hours. ```bash report --full --since "2025-01-01" ``` -------------------------------- ### Development Setup Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands to initialize the development environment for Node.js or Bun. ```bash # For Node.js development npm install # No dependencies, but sets up npm scripts # For Bun development (optional) curl -fsSL https://bun.sh/install | bash chmod +x ccmonitor.ts ``` -------------------------------- ### ccmonitor report --full example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'report' command with the --full option to show all hours, including those with zero usage, for time continuity. ```bash report --full ``` -------------------------------- ### Basic Execution Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Common ways to invoke the tool depending on the installation method. ```bash # With npx (no installation required) npx ccmonitor report npx ccmonitor rolling # With local installation ./ccmonitor.js report # Node.js version (built from TypeScript) ./ccmonitor.ts report # Bun version (TypeScript direct execution) # With global installation ccmonitor report ccmonitor rolling ``` -------------------------------- ### ccmonitor rolling --cost-limit --full example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'rolling' command with a custom --cost-limit and the --full option to display all hours including zero usage. ```bash rolling --cost-limit 100 --full ``` -------------------------------- ### Install and Run ccmonitor via npx Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Run the tool directly without installation or install it globally via npm. ```bash # Run directly with npx (most convenient) npx ccmonitor report npx ccmonitor rolling # Or install globally npm install -g ccmonitor ccmonitor report ``` -------------------------------- ### ccmonitor --no-header option example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the --no-header option for a compact display without feature headers, useful for scripting. ```bash --no-header ``` -------------------------------- ### Watch Mode Usage Examples Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Demonstrates various ways to use the --watch option for continuous monitoring with different configurations like custom intervals, cost limits, and compact display. ```bash # Default 60-second monitoring ccmonitor rolling --watch ``` ```bash # Custom 30-second updates with limit monitoring ccmonitor rolling --watch 30 --cost-limit 50 ``` ```bash # Compact continuous monitoring ccmonitor rolling --watch --no-header --tail 5 ``` -------------------------------- ### ccmonitor rolling --watch --cost-limit example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'rolling' command in watch mode with a custom --cost-limit to monitor usage with spending constraints. ```bash rolling --watch --cost-limit ``` -------------------------------- ### ccmonitor --cost-limit large value example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example showing validation for large --cost-limit values, demonstrating acceptance up to 10000. ```bash --cost-limit ``` -------------------------------- ### Show ccmonitor Help and Version Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Use these commands to display detailed help information or check the installed version of ccmonitor. ```bash # Show detailed help npx ccmonitor --help ``` ```bash # Check version npx ccmonitor --version ``` -------------------------------- ### ccmonitor time filter combinations example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Demonstrates the use of time filtering options like --since and --until in combination for precise data range selection. ```bash --since --until ``` -------------------------------- ### ccmonitor rolling --json --tail 5 example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'rolling' command with --json and --tail 5 to output JSON data for the last 5 hours. ```bash rolling --json --tail 5 ``` -------------------------------- ### ccmonitor rolling --watch --tail example Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Example of using the 'rolling' command in watch mode with the --tail option to monitor recent hours continuously. ```bash rolling --watch --tail ``` -------------------------------- ### Start Rolling Cost Monitoring Source: https://context7.com/shinagaki/ccmonitor/llms.txt Initiate rolling monitoring to track costs against a limit, with options to include full details or suppress headers. ```bash npx ccmonitor rolling --cost-limit 100 --full --no-header ``` -------------------------------- ### Migrate Aggregated Data Source: https://context7.com/shinagaki/ccmonitor/llms.txt Instructions for migrating aggregated data from previous versions or starting fresh. ```bash mv ~/.claude-usage-monitor ~/.ccmonitor # Preserve aggregated data ``` ```bash rm -rf ~/.claude-usage-monitor # Fresh start (rebuilds from logs) ``` -------------------------------- ### Publish ccmonitor to npm Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Commands for publishing the ccmonitor package to npm, including testing installation. ```bash # Build and publish (automatically runs build before publish) npm publish ``` ```bash # Test installation from npm npm install -g ccmonitor ccmonitor --version ``` -------------------------------- ### Build and Run ccmonitor Locally Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Clone the repository and execute the tool using either Node.js or Bun. ```bash # Clone this repository git clone https://github.com/shinagaki/ccmonitor.git cd ccmonitor # For Node.js users - build and run JavaScript version npm run build ./ccmonitor.js report # For Bun development - run TypeScript directly chmod +x ccmonitor.ts ./ccmonitor.ts report ``` -------------------------------- ### Build Process Overview Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Outlines the steps involved in the build.js process for transpiling TypeScript to CommonJS, including version injection and permission setting. ```bash # build.js process overview: # 1. Read current version from package.json # 2. Use Bun to transpile ccmonitor.ts to CommonJS format # 3. Remove Bun's CommonJS wrapper for Node.js compatibility # 4. Replace shebang: #!/usr/bin/env bun → #!/usr/bin/env node # 5. Inject current version into console.log statements # 6. Set executable permissions ``` -------------------------------- ### Build and Release Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for building the project and managing version releases. ```bash # Build JavaScript version for npm distribution npm run build # Release new versions (automatically builds, commits, pushes, and publishes to npm) npm run release:patch # 3.0.1 → 3.0.2 npm run release:minor # 3.0.1 → 3.1.0 npm run release:major # 3.0.1 → 4.0.0 ``` -------------------------------- ### Download and Execute ccmonitor Directly Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Download the standalone script and make it executable for immediate use. ```bash # Download built JavaScript version (Node.js compatible) curl -O https://raw.githubusercontent.com/shinagaki/ccmonitor/main/ccmonitor.js chmod +x ccmonitor.js ./ccmonitor.js report # Or download TypeScript version (Bun required) curl -O https://raw.githubusercontent.com/shinagaki/ccmonitor/main/ccmonitor.ts chmod +x ccmonitor.ts ./ccmonitor.ts report ``` -------------------------------- ### Build and Validation Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Provides commands for manually building the project and validating the build by checking the version. ```bash # Manual build npm run build ``` ```bash # Automatic build (during npm publish) npm publish # Runs prepublishOnly → npm run build ``` ```bash # Build validation npm run build && ./ccmonitor.js --version ``` -------------------------------- ### Basic Usage Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Standard commands for generating usage reports and monitoring rolling usage. ```bash # Show hourly usage report (auto-collects data) ./ccmonitor report # Show 5-hour rolling usage for Pro limit monitoring (auto-collects data) ./ccmonitor rolling # Continuous monitoring (default 60-second updates) ./ccmonitor rolling --watch # Quick continuous monitoring (every 10 seconds) ./ccmonitor rolling --watch 10 ``` -------------------------------- ### Configure Rolling Monitoring with Watch Interval Source: https://context7.com/shinagaki/ccmonitor/llms.txt Set up rolling monitoring with a specified watch interval and cost limit, showing recent usage. ```bash npx ccmonitor rolling --watch 30 --cost-limit 50 --tail 8 ``` -------------------------------- ### Perform Manual Testing with Real Data Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for verifying CLI functionality, edge cases, and real-time monitoring integration. ```bash # Manual testing with real data ./ccmonitor report --json | jq '.[0]' # Verify JSON structure ./ccmonitor rolling --tail 5 # Test rolling calculations ./ccmonitor rolling --full --tail 10 # Test full mode with continuous hours # Watch mode testing timeout 10 ./ccmonitor rolling --watch 5 --tail 3 # Test watch mode with limits timeout 8 ./ccmonitor rolling --watch --no-header # Test compact watch mode ./ccmonitor rolling --watch # Test default 60-second interval # Edge case testing ./ccmonitor report --since "invalid-date" # Error handling ./ccmonitor report --tail 0 # Boundary conditions ./ccmonitor rolling --watch 2 # Should error (< 5 seconds) # Real-time monitoring integration watch -n 60 './ccmonitor rolling --no-header' # Monitor default limits watch -n 30 './ccmonitor rolling --full --no-header --cost-limit 50' # Custom limit monitoring ./ccmonitor rolling --cost-limit 200 --tail 12 # Test custom limits ``` -------------------------------- ### Execute Version Release Process Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for triggering automated version increments and transpilation builds. ```bash # Standard npm-based releases (automatically transpiles and publishes) npm run release:patch # For bug fixes (auto-increments version) npm run release:minor # For new features npm run release:major # For breaking changes ``` -------------------------------- ### Programmatic API Usage with TypeScript/JavaScript Source: https://context7.com/shinagaki/ccmonitor/llms.txt Demonstrates initializing the ClaudeUsageMonitor, collecting data incrementally, and generating reports using the ccmonitor API. ```typescript import { ClaudeUsageMonitor, HourlyStats, ClaudeLogEntry } from 'ccmonitor'; // Initialize monitor with custom paths const monitor = new ClaudeUsageMonitor( '/custom/data/path', // Optional: custom data directory '/custom/claude/dir' // Optional: custom Claude directory ); // Collect data and generate reports async function monitorUsage() { // Initialize cache for efficient incremental loading await monitor.initializeCache(); // Collect new data incrementally (efficient for watch mode) const newEntriesCount = await monitor.collectIncremental({ since: '2025-06-15 09:00', tail: 24 // Last 24 hours }); console.log(`Processed ${newEntriesCount} new entries`); // Access cached statistics const stats: Map = monitor.getCachedStats(); for (const [hour, hourStats] of stats) { console.log(`${hour}: $${hourStats.cost.toFixed(2)}, ${hourStats.totalTokens} tokens`); } // Generate report output as string const reportOutput = await monitor.generateReportOutput({ since: '2025-06-20 00:00', tail: 12, json: false, noHeader: true }); // Generate rolling output const rollingOutput = await monitor.generateRollingOutputIncremental({ tail: 10, costLimit: 50, noHeader: false }); console.log(rollingOutput); } // Run the monitor monitorUsage().catch(console.error); ``` -------------------------------- ### Monitor Rolling Usage Limits Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Track usage against specific cost thresholds for subscription plans. ```bash # Monitor usage limits (5-hour rolling window, default: $10 Pro limit) npx ccmonitor rolling # Custom cost limits for different subscription plans npx ccmonitor rolling --cost-limit 50 # For Max $100 plan npx ccmonitor rolling --cost-limit 200 # For Max $200 plan # Rolling usage monitoring with custom cost limits npx ccmonitor rolling --cost-limit 50 # Compact rolling display for monitoring npx ccmonitor rolling --no-header ``` -------------------------------- ### Continuous Monitoring with Watch Mode Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Run the monitor continuously with configurable intervals and display options. ```bash # Default 60-second continuous monitoring npx ccmonitor rolling --watch # Custom interval monitoring npx ccmonitor rolling --watch 30 # Every 30 seconds # Compact continuous monitoring npx ccmonitor rolling --watch --no-header --tail 5 # Monitor custom cost limits npx ccmonitor rolling --watch --cost-limit 50 --tail 8 ``` -------------------------------- ### Build ccmonitor for Node.js Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Commands to build the TypeScript project into a JavaScript version compatible with Node.js and test the built version. ```bash # Build JavaScript version from TypeScript npm run build ``` ```bash # Test the built version ./ccmonitor.js --version ``` -------------------------------- ### Run Automated Test Suite Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for managing and executing the Vitest-based test suite. ```bash # Install test dependencies npm install # Run all tests npm test # Run tests in watch mode (for development) npm run test:watch # Generate coverage report npm run test:coverage # Run tests with UI (browser-based) npm run test:ui ``` -------------------------------- ### CLI Command: rolling Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Displays 5-hour rolling usage monitoring with support for continuous watch mode. ```APIDOC ## COMMAND rolling ### Description Displays 5-hour rolling usage monitoring with progress bars. Supports continuous monitoring via watch mode. ### Usage `ccmonitor rolling [options]` `ccmonitor rolling --watch [interval] [options]` ### Options - **--path** (string) - Optional - Custom data directory path - **--claude-dir** (string) - Optional - Custom Claude projects directory - **--since** (string) - Optional - Start time filter - **--until** (string) - Optional - End time filter - **--json** (boolean) - Optional - JSON output format (Not supported in watch mode) - **--tail** (string) - Optional - Limit output lines - **--full** (boolean) - Optional - Show all hours including zero - **--no-header** (boolean) - Optional - Suppress descriptive headers - **--cost-limit** (string) - Optional - Custom cost limit (default: 10) - **--watch** (string) - Optional - Watch interval in seconds (minimum 5) - **--help** (boolean) - Optional - Show help - **--version** (boolean) - Optional - Show version ``` -------------------------------- ### Advanced Usage Options Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Advanced configuration options for filtering reports, formatting output, and setting custom cost limits. ```bash # Show specific time range ./ccmonitor report --since "2025-06-15 09:00" --until "2025-06-16 18:00" # Show last N hours only ./ccmonitor report --tail 24 # Enable rolling view in report command ./ccmonitor report --rolling # Output in JSON format for scripting ./ccmonitor report --json # Show all hours including zero usage (rolling mode) ./ccmonitor rolling --full # Custom cost limits for different subscription plans ./ccmonitor rolling --cost-limit 50 # For Max $100 plan ./ccmonitor rolling --cost-limit 200 # For Max $200 plan # Compact display without feature headers (useful for scripting) ./ccmonitor report --no-header --tail 5 ./ccmonitor rolling --no-header # Watch mode combinations ./ccmonitor rolling --watch --full --tail 10 # All hours with terminal size limit ./ccmonitor rolling --watch 30 --no-header # Compact continuous monitoring ./ccmonitor rolling --watch --cost-limit 50 --tail 8 # Custom limits with size control ``` -------------------------------- ### Run Linting and Type Checking Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for validating TypeScript source and the generated build output. ```bash # Type check with Bun (built-in TypeScript support) bun --check ccmonitor.ts # For stricter type checking during development bunx tsc --noEmit ccmonitor.ts # Validate build output npm run build && ./ccmonitor.js --version ``` -------------------------------- ### Testing and Verification Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands to verify the functionality of the TypeScript source, built JavaScript, and npm distribution. ```bash # Test TypeScript version (development) ./ccmonitor.ts --help ./ccmonitor.ts --version # Test built JavaScript version (production) npm run build ./ccmonitor.js --help ./ccmonitor.js --version # Test npm distribution npx ccmonitor --version # Verify data collection works ./ccmonitor.ts report --json | head -5 ``` -------------------------------- ### Run ccmonitor report command Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Executes the report command to generate usage statistics. Use options like --since, --until, --tail, --full, or --json for customized output. ```bash npx ccmonitor report [options] ``` -------------------------------- ### CLI Command: report Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Displays hourly usage statistics with support for time filtering and JSON output. ```APIDOC ## COMMAND report ### Description Displays hourly usage statistics in a table format with totals. ### Usage `ccmonitor report [options]` ### Options - **--path** (string) - Optional - Custom data directory path - **--claude-dir** (string) - Optional - Custom Claude projects directory - **--since** (string) - Optional - Start time filter - **--until** (string) - Optional - End time filter - **--json** (boolean) - Optional - JSON output format - **--tail** (string) - Optional - Limit output lines - **--full** (boolean) - Optional - Show all hours including zero - **--no-header** (boolean) - Optional - Suppress descriptive headers - **--help** (boolean) - Optional - Show help - **--version** (boolean) - Optional - Show version ``` -------------------------------- ### Generate Usage Report Source: https://context7.com/shinagaki/ccmonitor/llms.txt Use this command to generate a JSON report of API usage since a specific time, showing token counts and costs. ```bash npx ccmonitor report --since "2025-06-15 09:00" --tail 24 --json ``` -------------------------------- ### Generate Hourly Usage Reports Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Filter and format usage data by time range, output format, or display density. ```bash # Basic hourly report npx ccmonitor report # Last 24 hours only npx ccmonitor report --tail 24 # Specific time range npx ccmonitor report --since "2025-06-20 09:00" --until "2025-06-20 18:00" # JSON output for scripting npx ccmonitor report --json # Show all hours including zero usage npx ccmonitor report --full # Compact display without feature headers (useful for scripting) npx ccmonitor report --no-header --tail 5 ``` -------------------------------- ### Execute Debugging Commands Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Commands for inspecting data storage and verifying JSONL output. ```bash # Check data collection status ls -la ~/.ccmonitor/ # Verify JSONL parsing ./ccmonitor report --json | head -1 | jq . ``` -------------------------------- ### Specify Custom Data and Log Directories Source: https://context7.com/shinagaki/ccmonitor/llms.txt Use custom paths for storing aggregated data and Claude Code logs when running reports. ```bash npx ccmonitor report --path /custom/data/dir --claude-dir /custom/claude/dir ``` -------------------------------- ### Rolling Usage Monitor Output Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Visualizes the current hour's cost, the rolling 5-hour cost, and progress towards the cost limit. Includes a progress bar and color-coded indicators for usage levels. ```text ╭───────────────────────────────────────────╮ │ │ │ ccmonitor - Limit Monitor (5-Hour) │ │ │ ╰───────────────────────────────────────────╯ ┌──────────────────┬───────────┬───────────┬───────────────┐ │ Current Hour │ Hour Cost │5-Hour Cost│ Limit Progress│ ├──────────────────┼───────────┼───────────┼───────────────┤ │ 2025-06-20 14:00 │ $0.45 │ $2.34 │ 23.0% ██░░░░░░│ │ 2025-06-20 15:00 │ $0.67 │ $3.12 │ 31.0% ███░░░░░│ │ 2025-06-20 16:00 │ $1.23 │ $8.45 │ 84.0% ███████░│ │ 2025-06-20 17:00 │ $0.89 │ $9.12 │ 91.0% ████████│ └──────────────────┴───────────┴───────────┴───────────────┘ 📊 Claude Code Pro Limits: • Cost Limit: $10.00 per 5-hour window • Time Window: Rolling 5-hour period • Color: Green (Safe) | Yellow (Caution) | Red (Danger) ``` -------------------------------- ### Hourly Usage Report Output Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Displays a formatted table of hourly input, output, total usage, and cost in USD. Useful for analyzing daily usage patterns. ```text ╭─────────────────────────────────────────╮ │ │ │ ccmonitor - Hourly Usage Report │ │ │ ╰─────────────────────────────────────────╯ ┌──────────────────┬──────────────┬──────────────┬──────────────┬────────────┐ │ Hour │ Input │ Output │ Total │ Cost (USD) │ ├──────────────────┼──────────────┼──────────────┼──────────────┼────────────┤ │ 2025-06-20 14:00 │ 1,234 │ 5,678 │ 6,912 │ $0.45 │ │ 2025-06-20 15:00 │ 2,345 │ 6,789 │ 9,134 │ $0.67 │ │ 2025-06-20 16:00 │ 3,456 │ 7,890 │ 11,346 │ $0.89 │ └──────────────────┴──────────────┴──────────────┴──────────────┴────────────┘ │ Total │ 7,035 │ 20,357 │ 27,392 │ $2.01 │ └──────────────────┴──────────────┴──────────────┴──────────────┴────────────┘ ``` -------------------------------- ### ccmonitor report command usage Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Use the 'report' command to display hourly usage statistics in a table format with hourly breakdowns and totals. The --json option outputs raw data, and --full shows all hours including zero usage. ```bash ccmonitor report [options] ``` -------------------------------- ### Generate Hourly Usage Report Source: https://context7.com/shinagaki/ccmonitor/llms.txt Generates an hourly breakdown of Claude Code usage including input, output, and total tokens, along with costs in USD. Use --tail for recent hours, --since/--until for specific ranges, --json for scripting, and --full to show all hours. ```bash npx ccmonitor report ``` ```bash npx ccmonitor report --tail 24 ``` ```bash npx ccmonitor report --since "2025-06-20 09:00" --until "2025-06-20 18:00" ``` ```bash npx ccmonitor report --json ``` ```bash npx ccmonitor report --full ``` ```bash npx ccmonitor report --no-header --tail 5 ``` -------------------------------- ### Verify Aggregated Data Directory Source: https://context7.com/shinagaki/ccmonitor/llms.txt Check the contents of the default ccmonitor aggregated data directory to confirm data collection. ```bash ls -la ~/.ccmonitor/ ``` -------------------------------- ### Run ccmonitor rolling command Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Executes the rolling monitor command to track usage against cost limits. Options include --tail, --full, --cost-limit, and --json. ```bash npx ccmonitor rolling [options] ``` -------------------------------- ### View Raw Aggregated Usage Data Source: https://context7.com/shinagaki/ccmonitor/llms.txt Display the raw content of the aggregated usage log file, which contains historical usage data. ```bash cat ~/.ccmonitor/usage-log.jsonl ``` -------------------------------- ### Enable Watch Mode for Continuous Monitoring Source: https://context7.com/shinagaki/ccmonitor/llms.txt Enables continuous real-time monitoring of Claude Code usage with automatic terminal updates. The default refresh interval is 60 seconds, which can be customized with an argument. Use --no-header for a compact display and --cost-limit to set custom limits. ```bash npx ccmonitor rolling --watch ``` ```bash npx ccmonitor rolling --watch 30 ``` ```bash npx ccmonitor rolling --watch --no-header --tail 5 ``` ```bash npx ccmonitor rolling --watch --cost-limit 50 --tail 8 ``` ```bash npx ccmonitor rolling --watch 120 --cost-limit 50 --full ``` -------------------------------- ### ccmonitor rolling command usage Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Use the 'rolling' command for 5-hour rolling usage monitoring, outputting rolling window analysis with progress bars. The --json option outputs rolling calculations, and --watch enables continuous monitoring. ```bash ccmonitor rolling [options] ccmonitor rolling --watch [interval] [options] ``` -------------------------------- ### Generate JSON Cost Report Source: https://context7.com/shinagaki/ccmonitor/llms.txt Generates a JSON report of API usage for the last 3 hours, including token counts and calculated costs. ```bash npx ccmonitor report --json --tail 3 ``` -------------------------------- ### Monitor 5-Hour Rolling Usage Source: https://context7.com/shinagaki/ccmonitor/llms.txt Monitors Claude Code subscription plan limits using a 5-hour rolling window. Displays usage percentage against cost limits with color-coded progress bars. Customize cost limits with --cost-limit and use --tail for recent hours or --json for scripting. ```bash npx ccmonitor rolling ``` ```bash npx ccmonitor rolling --cost-limit 50 ``` ```bash npx ccmonitor rolling --cost-limit 200 ``` ```bash npx ccmonitor rolling --tail 10 ``` ```bash npx ccmonitor rolling --json ``` ```bash npx ccmonitor rolling --no-header ``` -------------------------------- ### ccmonitor rolling --watch mode usage Source: https://github.com/shinagaki/ccmonitor/blob/main/OPTIONS_MATRIX.md Enable real-time continuous monitoring with 'rolling --watch'. This mode provides a live-updating terminal display but does not support the --json option. The interval must be 5 seconds or greater. ```bash ccmonitor rolling --watch [interval] [options] ``` -------------------------------- ### npx ccmonitor report Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Generates an hourly usage report based on Claude Code logs. ```APIDOC ## GET report ### Description Retrieves an hourly usage report showing input tokens, output tokens, total tokens, and costs. ### Method CLI Command: npx ccmonitor report [options] ### Parameters #### Query Parameters - **--since** (datetime) - Optional - Start time for the report (e.g., "2025-06-20 09:00") - **--until** (datetime) - Optional - End time for the report (e.g., "2025-06-20 18:00") - **--tail** (hours) - Optional - Show only the last N hours - **--full** (boolean) - Optional - Show all hours including those with zero usage - **--json** (boolean) - Optional - Output the report in JSON format ``` -------------------------------- ### npx ccmonitor rolling Source: https://github.com/shinagaki/ccmonitor/blob/main/README.md Monitors usage against a rolling 5-hour cost limit. ```APIDOC ## GET rolling ### Description Displays a rolling 5-hour usage monitor to track spending against defined cost limits. ### Method CLI Command: npx ccmonitor rolling [options] ### Parameters #### Query Parameters - **--tail** (hours) - Optional - Show only the last N hours - **--full** (boolean) - Optional - Show all hours including those with zero usage - **--cost-limit** (amount) - Optional - Set a custom cost limit (default: 10) - **--json** (boolean) - Optional - Output the monitor data in JSON format ``` -------------------------------- ### Validate Cost Calculations Manually with bun Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Manually validate cost calculations by executing a JavaScript expression using bun. This is useful for verifying the accuracy of the billing logic. ```javascript bun -e "console.log((1000/1000) * 0.003 + (2000/1000) * 0.015)" # Expected: 0.033 ``` -------------------------------- ### Debug Timestamp Parsing with cccmonitor Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Use this command to debug timestamp parsing in cccmonitor by reporting data since a specific time. Ensure the date command is available in your environment. ```bash ./ccmonitor report --since "$(date -d '1 hour ago' '+%Y-%m-%d %H:%M')" ``` -------------------------------- ### Data Deduplication Logic Source: https://github.com/shinagaki/ccmonitor/blob/main/CLAUDE.md Illustrates the TypeScript code used to prevent double-counting of messages by checking if a message ID has already been seen. ```typescript if (seenMessageIds.has(entry.message.id)) { continue; } seenMessageIds.add(entry.message.id); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.