Prints out Claude Code and Codex monthly usage every 1 minute on PowerShell A developer shared a PowerShell script that prints Claude Code and Codex monthly usage every minute, showing costs of $8.42 and $4.34 respectively. | while $true { | | | $data = npx -y -q ccusage monthly --by-agent --json | ConvertFrom-Json | | | Clear-Host | | | Write-Host "$ Get-Date -Format 'yyyy-MM-dd HH:mm:ss' n" | | | $data.monthly 0 .agents | | | | Where-Object { $ .agent -eq "claude" -or $ .agent -eq "codex" } | | | | ForEach-Object { PSCustomObject @{ agent = $ .agent; totalCost = " $ {0:N2}" -f $ .totalCost } } | | | | Format-Table -AutoSize | | | Start-Sleep -Seconds 60 | | | } | | 2026-07-21 15:14:06 | | | agent totalCost | | | ----- --------- | | | claude $ 8.42 | | | codex $ 4.34 |