You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 34c697b
Browse filesBrowse the repository at this point in the historyBrowse files
`--sections` accepts `daily`, `weekly`, `monthly`, and `session`. The invoked report section is always included, and table output prints each requested section as a separate table. `--by-agent` adds an `agents` array to daily, weekly, and monthly JSON rows; session rows are already source-specific.
34
+
`--sections` accepts `daily`, `weekly`, `monthly`, and `session`. The invoked report section is always included, and table output prints each requested section as a separate table. `--by-agent` adds an `agents` array to daily, weekly, and monthly JSON rows; session rows are already source-specific.`--by-source` adds Codex client/originator breakdowns to unified JSON rows and totals, and adds indented source rows to unified tables. Codex maps known originators to `CLI`, `Exec`, `Desktop App`, `VS Code`, and `SDK`, preserves unknown values, and groups missing or empty values under `Uncategorized`.
# Add per-agent breakdowns to daily, weekly, and monthly JSON rows
166
166
ccusage daily --by-agent --json
167
+
168
+
# Add Codex client/originator breakdowns to unified output
169
+
ccusage daily --by-source --json
167
170
```
168
171
169
-
`--sections` accepts a comma-separated list of `daily`, `weekly`, `monthly`, and `session`. The invoked report section is always included. For table output, each requested section is printed as a separate table. `--by-agent` is JSON-only; session rows are already per-agent.
172
+
`--sections` accepts a comma-separated list of `daily`, `weekly`, `monthly`, and `session`. The invoked report section is always included. For table output, each requested section is printed as a separate table. `--by-agent` is JSON-only; session rows are already per-agent.`--by-source` is opt-in and applies to Codex-focused reports and unified reports. It adds `sourceBreakdowns` to JSON and source rows to tables while leaving output unchanged when omitted.
|`ccusage codex monthly`| Aggregate usage by month |[Monthly Usage](/guide/monthly-reports)|
38
38
|`ccusage codex session`| Group usage by Codex session |[Session Usage](/guide/session-reports)|
39
39
40
-
These views support `--json`, `--compact`, `--offline`, and `--speed auto|standard|fast`.
40
+
These views support `--json`, `--compact`, `--offline`, `--speed auto|standard|fast`, and the opt-in `--by-source` breakdown.
41
+
42
+
`--by-source` groups Codex usage by the `session_meta.payload.originator` value. The built-in
43
+
labels are `CLI` (`codex-tui` and `codex_cli_rs`), `Exec` (`codex_exec`), and `Desktop App`
44
+
(`Codex Desktop` and `codex_work_desktop`), `VS Code` (`codex_vscode`), and `SDK`
45
+
(`codex_python_sdk`); other non-empty values are kept unchanged, while missing or empty values
46
+
are reported as `Uncategorized`. Same-source copies of a usage event are deduplicated, while
47
+
different normalized originators remain distinct so their totals are preserved. Tables add source
48
+
rows below each period, and JSON adds `sourceBreakdowns` to the period and totals objects without
49
+
changing the default output.
41
50
42
51
## Monthly Example
43
52
@@ -79,6 +88,9 @@ ccusage codex daily --speed fast
79
88
80
89
# Force standard pricing
81
90
ccusage codex daily --speed standard
91
+
92
+
# Show usage by Codex client/originator
93
+
ccusage codex daily --by-source
82
94
```
83
95
84
96
## JSON Output
@@ -89,9 +101,10 @@ Codex focused views use the same JSON mode as the shared reports:
89
101
ccusage codex daily --json
90
102
ccusage codex monthly --json
91
103
ccusage codex session --json
104
+
ccusage codex daily --by-source --json
92
105
```
93
106
94
-
Session JSON includes per-model breakdowns, cached token counts, `lastActivity`, and `isFallback` flags for any events that required the legacy `gpt-5` pricing fallback.
107
+
Session JSON includes per-model breakdowns, cached token counts, `lastActivity`, and `isFallback` flags for any events that required the legacy `gpt-5` pricing fallback. With `--by-source`, each source breakdown has the same token and model totals, and source totals conserve the report totals exactly.
95
108
96
109
Have feedback or ideas? [Open an issue](https://github.com/ccusage/ccusage/issues/new) so we can improve Codex support.
Copy file name to clipboardExpand all lines: docs/guide/config-files.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,7 +192,8 @@ Use data source namespaces to set defaults and report overrides. Supported names
192
192
"codex": {
193
193
"defaults": {
194
194
"json": true,
195
-
"offline": true
195
+
"offline": true,
196
+
"bySource": true
196
197
},
197
198
"commands": {
198
199
"daily": {
@@ -280,7 +281,7 @@ ccusage copilot monthly
280
281
ccusage gemini daily
281
282
```
282
283
283
-
Source-specific settings are also applied when running unified reports such as `ccusage daily`. In that case, each source receives its own merged options before data is loaded.
284
+
Source-specific report settings apply only to the focused commands shown above. In particular, `codex.defaults.bySource` is honored only by focused Codex commands. Unified reports such as `ccusage daily` do not apply agent-specific options; use the unified `--by-source` flag to request Codex client/originator breakdowns there.
284
285
285
286
Use `pi.stores` for additional pi-format session stores, such as tools or forks that write sessions outside `~/.pi/agent/sessions`. Named stores are additive to the default `pi` agent in unified reports, use their own agent name in JSON and tables, and prefix models with `[name]` followed by a space. Store names must match `^[a-z][a-z0-9_-]{0,31}$`, must be unique, and cannot use a built-in agent name. Each store path can be one sessions directory or a comma-separated list; `~` is expanded for store paths, nonexistent paths are treated as empty, and resolved paths that overlap the default `pi` store or another named store — including one path nested inside another — are rejected. They do not create focused commands such as `ccusage omp daily`; `PI_AGENT_DIR`, `--pi-path`, and `pi.defaults.piPath` still affect only the default `pi` agent.
Source sections apply to focused commands such as `ccusage codex daily` and `ccusage amp session`. They are also used by unified reports such as `ccusage daily`, where each source receives its own merged options before data is loaded.
144
+
Source sections apply to focused commands such as `ccusage codex daily` and `ccusage amp session`. The `codex.defaults.bySource` option is honored only by focused Codex commands; unified reports such as `ccusage daily` do not apply agent-specific options. Use the unified `--by-source` flag to request Codex client/originator breakdowns there.
`--sections` emits each requested unified section from one load. The invoked command's section is always included, and the top-level `totals` object remains the total for that invoked section. JSON keys are emitted with the invoked section first, then remaining sections in `daily`, `weekly`, `monthly`, `session` order, with `totals` last. `--by-agent` adds an `agents` array to daily, weekly, and monthly rows; session rows are already per-agent.
39
+
`--sections` emits each requested unified section from one load. The invoked command's section is always included, and the top-level `totals` object remains the total for that invoked section. JSON keys are emitted with the invoked section first, then remaining sections in `daily`, `weekly`, `monthly`, `session` order, with `totals` last. `--by-agent` adds an `agents` array to daily, weekly, and monthly rows; session rows are already per-agent.`--by-source` adds `sourceBreakdowns` to Codex rows and the applicable totals. Focused Codex JSON uses the same field name. Source token and cost totals conserve their containing Codex totals; known originators are normalized to `CLI`, `Exec`, `Desktop App`, `VS Code`, or `SDK`, while unknown originators remain unchanged and missing or empty values use `Uncategorized`.
0 commit comments