Repository navigation
Description
Hi maintainers,
I am trying to build some scripting which relies on the output of the --json ccusage command. As part of this work, I have uncovered some bugs in the way all the ccusage apps currently report data. This bug report is one of them.
I will submit a PR resolving this issue soon, creating an issue first to track the problem and my thinking around fixing it.
Issue Description
The ccusage apps have inconsistent behavior when no usage data exists. The reference app (ccusage) is itself inconsistent, and the other apps do not follow a consistent pattern. This makes it difficult to write scripts that work across all apps.
Current Behavior
ccusage (Reference App)
Behaviour today:
| Command | Output when no data exists |
|---|---|
daily --json |
[] (no totals field) |
monthly --json |
{ monthly: [], totals: {all zeros} } |
session --json |
[] (no totals field) |
weekly --json |
{ weekly: [], totals: {all zeros} } |
Pattern: ccusage is inconsistent - only monthly and weekly include a totals field with zeros.
ccusage-codex
Behaviour today:
| Command | Output when no data exists |
|---|---|
daily --json |
{ daily: [], totals: null } |
monthly --json |
{ monthly: [], totals: null } |
session --json |
{ sessions: [], totals: null } |
weekly --json |
Flag not supported |
Pattern: All commands return totals: null.
ccusage-opencode
Behaviour today:
| Command | Output when no data exists |
|---|---|
daily --json |
{ daily: [], totals: null } |
monthly --json |
{ monthly: [], totals: null } |
session --json |
{ sessions: [], totals: null } |
weekly --json |
{ weekly: [], totals: null } |
Pattern: All commands return totals: null.
ccusage-amp
Behaviour today:
| Command | Output when no data exists |
|---|---|
daily --json |
{ daily: [], totals: null } |
monthly --json |
{ monthly: [], totals: null } |
session --json |
{ sessions: [], totals: null } |
weekly --json |
Flag not supported |
Pattern: All commands return totals: null.
ccusage-pi
Behaviour today:
| Command | Output when no data exists |
|---|---|
daily --json |
[] (no totals field) |
monthly --json |
[] (no totals field) |
session --json |
[] (no totals field) |
weekly --json |
Flag not supported |
Pattern: All commands return [] with no totals field.
Changes needed:
- ccusage: Update
dailyandsessionto include totals with zeros (already does inmonthlyandweekly) - ccusage-codex: Change
totals: null→totals: {zeros}, add support forweekly - ccusage-opencode: Change
totals: null→totals: {zeros} - ccusage-amp: Change
totals: null→totals: {zeros}, add support forweekly - ccusage-pi: Change
[]→{ daily: [], totals: {zeros} }, add support forweekly
Activity
fix: normalize totals outputs across ccusage/codex/opencode/pi/amp
fix: normalize totals outputs across ccusage/codex/opencode/pi/amp
fix(ccusage): apply jq to empty session output
fix(ccusage): honor config jq for session output
fix(ccusage): honor config jq for session output
github-actions commentedon Aug 28, 2026
Automatic implementation was not started because the issue author GitHub email could not be resolved reliably for co-author attribution. A maintainer can implement the issue manually or provide a verifiable author email.
ryoppippi commentedon Aug 30, 2026
Closing as not planned. The pre-adapter-split output matrix is obsolete. Current Codex reports already emit zero totals for empty data, while unified reports use their existing totalCost contract. Normalizing remaining source-local null cases would require an explicit breaking-schema decision that is not part of this issue.
fix(pi): return zero totals for empty reports (#1674)