{"id":31002141,"url":"https://github.com/effet/cxusage","last_synced_at":"2026-04-18T17:33:45.212Z","repository":{"id":314403374,"uuid":"1055277963","full_name":"Effet/cxusage","owner":"Effet","description":"Codex usage analytics CLI that scans ~/.codex/sessions, aggregates tokens by day or model, and estimates cost using OpenRouter pricing.","archived":false,"fork":false,"pushed_at":"2025-09-12T08:44:41.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-12T09:25:44.394Z","etag":null,"topics":["anthropic","claude","cli","codex","command-line-tool","cost-estimation","daily-reports","data-aggregation","developer-tools","jsonl","log-analysis","metrics","nodejs","observability","openai","openrouter","reporting","token-usage","typescript","usage-analytics"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Effet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2025-09-12T03:23:36.000Z","updated_at":"2025-09-12T08:50:40.000Z","dependencies_parsed_at":"2025-09-12T09:25:46.847Z","dependency_job_id":"fa400072-de86-4f02-8086-af7b704b2e3c","html_url":"https://github.com/Effet/cxusage","commit_stats":null,"previous_names":["effet/cxusage"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Effet/cxusage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Effet%2Fcxusage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Effet%2Fcxusage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Effet%2Fcxusage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Effet%2Fcxusage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Effet","download_url":"https://codeload.github.com/Effet/cxusage/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Effet%2Fcxusage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274902937,"owners_count":25371079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anthropic","claude","cli","codex","command-line-tool","cost-estimation","daily-reports","data-aggregation","developer-tools","jsonl","log-analysis","metrics","nodejs","observability","openai","openrouter","reporting","token-usage","typescript","usage-analytics"],"created_at":"2025-09-13T00:46:35.572Z","updated_at":"2026-04-18T17:33:45.190Z","avatar_url":"https://github.com/Effet.png","language":"TypeScript","readme":"# cxusage\n\nAnalyze Codex daily usage from session logs. Similar to `ccusage`, this Node.js CLI scans JSONL session logs under `~/.codex/sessions` and aggregates token counts by day or by model within each day.\n\n- Input: JSONL logs (recursively) under `~/.codex/sessions` by default\n- Output: Plain table (default), Markdown table (`--md`), or JSON lines (`--json`)\n- Grouping: By day (default) or by model-within-day (`--by model`)\n- Timezone: Local timezone by default, or specify via `--tz` with an IANA TZ\n\n## Quickstart\n\n- After publish to npm: `npx cxusage --help`\n- From GitHub (before publish): `npx github:Effet/cxusage -- --help`\n- Typical commands:\n  - `npx cxusage daily --from 2025-01-01 --to 2025-01-31 --md`\n  - `npx cxusage daily --by model --json`\n\n## Usage\n\nThe top-level command is `cxusage`. The primary subcommand is `daily`.\n\n- Default root: `~/.codex/sessions`\n- Date range: `--from YYYY-MM-DD`, `--to YYYY-MM-DD`\n- Grouping: `--by day` (default) or `--by model`\n- Output format: `--md` (Markdown) or `--json` (JSONL), default is a plain table\n- Empty days: include zero-usage days via `--empty`\n\nExamples:\n\n- `cxusage daily`\n- `cxusage daily --from 2025-01-01 --to 2025-01-31 --md`\n- `cxusage daily --by model --json`\n- Use a specific timezone: `cxusage daily --tz Asia/Shanghai`\n\n## Pricing\n\nThe CLI automatically fetches model pricing from the public OpenRouter models API and estimates cost based on input/output tokens per model.\n\n- API: `https://openrouter.ai/api/v1/models`\n- Fallback: when a model name is missing (`unknown`), cxusage attempts a fallback chain: `openai/gpt-5` → `openai/gpt-4o` → `anthropic/claude-3.5-sonnet`. The first available price is used.\n- Disable fallback with `--no-fallback`. With fallback disabled, unknown models show `$0.00`.\n\nNotes about token counts: cxusage sums numeric fields commonly used for token counts (e.g., `input_tokens`, `output_tokens`, `promptTokenCount`, `completionTokenCount`, etc.). If older logs don’t include any of these fields, tokens will appear as zero even though events are counted. Use `--by model --debug` to inspect which model names are detected in your logs.\n\n## Programmatic invocation\n\nThis package exposes only a CLI. If you need a library API, please open an issue to discuss the desired interface.\n\n## Development\n\n- Node 18+ required\n- `npm i`\n- `npm run build`\n- `node dist/cli.js --help`\n\n\n### Contribution Guide\n\n- Issues: https://github.com/Effet/cxusage/issues\n- Pull Requests: welcome! Please read CONTRIBUTING.md\n\n### Release\n\n- CI runs on pushes/PRs to verify install and build.\n- Stable release: create a Git tag like `v0.1.0` to publish to npm as `latest`.\n  - The workflow automatically sets `package.json` version from the Git tag (stripping the leading `v`).\n  - Pre-release tags (containing a hyphen, e.g. `v0.2.0-rc.1`) publish with the `next` dist-tag.\n- The release workflow requires a repository secret `NPM_TOKEN` with publish permissions.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffet%2Fcxusage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feffet%2Fcxusage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feffet%2Fcxusage/lists"}