# Prints out Claude Code and Codex monthly usage every 1 minute on PowerShell

> Source: <https://gist.github.com/sjeon87/6f0fe958549d8daf756ad5ebbe43c7e3>
> Published: 2026-07-21 06:14:24+00:00

| 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 |
