Skip to content

Projects

llm-usage projects lists your 10 costliest projects (--top 0 for all), costliest first, with its share of the cost, tokens, events, active days, and top models.

Terminal window
llm-usage projects
Terminal output of llm-usage projects: four projects ranked by cost, each with its models, cost, share of the cost, tokens, events, and active days, and a TOTAL row
╭────────────────┬─────────────────────┬───────┬────────┬────────┬────────┬─────────────╮
│ Project │ Models │ Cost │ Share │ Tokens │ Events │ Active Days │
├────────────────┼─────────────────────┼───────┼────────┼────────┼────────┼─────────────┤
│ a/api │ • claude-sonnet-4-5 │ $0.05 │ 46.5% │ 17,900 │ 3 │ 2 │
│ b/api │ • gpt-5 │ $0.03 │ 31.5% │ 11,700 │ 3 │ 1 │
│ │ • claude-sonnet-4-5 │ │ │ │ │ │
│ web │ • gpt-5 │ $0.01 │ 8.9% │ 3,350 │ 2 │ 2 │
│ (unattributed) │ • gpt-5 │ $0.01 │ 6.1% │ 1,750 │ 2 │ 1 │
│ │ • claude-sonnet-4-5 │ │ │ │ │ │
│ src │ • claude-sonnet-4-5 │ $0.01 │ 5.3% │ 1,000 │ 1 │ 1 │
│ tools │ • gpt-5 │ $0.00 │ 1.8% │ 790 │ 1 │ 1 │
├────────────────┼─────────────────────┼───────┼────────┼────────┼────────┼─────────────┤
│ TOTAL │ │ $0.10 │ 100.0% │ 36,490 │ 12 │ 3 │
╰────────────────┴─────────────────────┴───────┴────────┴────────┴────────┴─────────────╯

A project is the directory a session started in. The coding tool records a working directory with each request, and events store it as repoRoot. When a session cds into a subfolder, say site/ or src/, its later requests still count for the directory it started in, so one session stays one project. Claude Code, Codex, Droid, dsh, Gemini, OpenClaw, OpenCode, and pi record a working directory. Usage from the other sources, and sessions where the tool recorded none, is listed as (unattributed).

Within a repository, the CLI uses the directories sessions started in, not .git folders:

  • A request in a subfolder counts for the nearest folder above it, up to its session’s starting directory, where a session the report reads started. A session started in ~/work that cds into ~/work/api counts that usage under api if another session started in ~/work/api, and under ~/work if none did.
  • A session started in a subfolder, such as ~/work/api/site, is its own project.
  • A request logged outside its session’s starting directory keeps the directory it logged.
  • A session’s starting directory comes from its earliest request, found before date and --repo filters, so the window does not change it for sessions on this machine. Another machine’s session that began before the window starts at its earliest request inside it, since other machines’ usage is read within the window. The sessions known to have started in a subfolder can change: a report skips files last changed before its window, and --source and --machine leave out other tools and machines. When the session that started in ~/work/api is left out that way, usage after a cd into it counts for ~/work.

events exports and filters on the directory each request logged, and efficiency finds the repository from it, so neither applies these rules.

Two kinds of directory count as the project that holds them. A directory inside node_modules, where a session cds into a dependency, counts as the folder above node_modules. A Claude Code worktree, <repo>/.claude/worktrees/<name> or any folder inside it, counts as <repo>.

Usage in any other git worktree on this machine counts for its repository, whichever tool ran there and wherever the worktree lives. A session in ~/.cache/app-review that worked in a worktree of ~/projects/app counts under app. The CLI finds the repository in one of two ways:

  • The .git file. While the worktree exists, its .git file names the repository. The CLI looks for it in the project’s folder and the folders above it, stopping below your home directory, so a session started in ~/.cache/app-review/site counts as app/site. The event store records each repository and worktree it finds, so usage from a worktree still counts for its repository after you remove it. A report run with the event store off (LLM_USAGE_EVENT_STORE=0) only sees worktrees that still exist.
  • The folder name. A worktree removed before any report saw it counts for a repository if a folder in its path starts with the repository’s name and a - or _ (app-review, app_tmp), or ends with one and the name (review-app). Case is ignored. The repository must be one a report on this machine has found on disk, and its name must be at least 4 characters; the longest matching name wins. When several repositories share the name, it goes to the one with worktrees, and to none if that is not exactly one. Such a worktree counts for the repository itself, not a folder inside it. A folder named exactly like a repository is left alone, since it is usually another clone of it.

A repository on disk, and every folder inside it, keeps its own project even when its name starts with another’s, so app-cli next to app stays app-cli. Name your worktree folders <repo>-<task> so they count for the repository even when no report ran before you removed them. --repo on a path inside a worktree selects that folder of its repository.

The event store keeps the first repository it found at a path: if you later reuse the path for a worktree of another repository, its usage keeps counting for the first. Usage from other machines (--machine) keeps the directories they logged.

The label is the last folder name of the path. When two projects end in the same folder name, both labels gain parent folders until they differ: /work/a/api and /work/b/api become a/api and b/api. A label stays the same across every period of one report. session, value, trends --by-repo, compare --by-repo, the --by-repo splits of the usage reports, and the interactive report label projects the same way.

Another machine’s usage in a git repository counts under the repository here with the same origin remote, wherever each machine cloned it (see Machines). For folders that are not repositories, or clones with different remotes, use aliases.

When a repository lives under different folders, such as ~/projects/app on one machine and ~/Projects/Personal/app on another, list the other folder under projectAliases in the config file so both count as one project:

[projectAliases]
"~/projects" = ["~/Projects/Personal"]

The alias covers every folder below it, on every machine, after worktrees move to their repositories.

Without date flags, projects covers your full history. --last N covers the last N months, counting the current one; --since and --until take inclusive dates in the reporting timezone.

Terminal window
llm-usage projects --last 3 --top 0
llm-usage projects --since 2026-06-01 --until 2026-06-30

The report lists the 10 costliest projects; --top N lists N, and --top 0 lists every project. The limit applies to --json as well. The TOTAL row and the JSON totals still count every project in the window, and a note on stderr says how many were left out.

Terminal window
llm-usage projects --granularity monthly

--granularity daily, weekly, or monthly adds a second table with one row per period and project (cost, tokens, and models), for the projects the first table lists. Rows are ordered by period, then by label, with (unattributed) last.

The shared filters apply: --source, --provider, --model, --machine, --timezone, pricing flags, and --no-history. --repo keeps some projects only:

Terminal window
llm-usage projects --repo api
llm-usage projects --repo ~/work --granularity weekly

A path (absolute, or starting with ./, ../, or ~/) matches that directory and every project under it; a path inside a Claude Code worktree or a node_modules folder matches the project that holds it, as do a name or path tail that ends inside one. A name or path tail such as api or work/api matches projects whose path ends with it. (unattributed) matches usage without a project. The same flag works on most reports; see each command’s --help.

projects supports terminal, --json, and --markdown output, but not --share; the interactive report of any usage command has its own projects table with a drill-down into sessions. --compact abbreviates token counts and drops the Events and Active Days columns; --no-cost drops Cost and Share. Neither works with --json.

Terminal window
llm-usage projects --granularity monthly --json
{
"schemaVersion": 1,
"report": "projects",
"data": {
"totals": {
"inputTokens": 20000,
"outputTokens": 4490,
"reasoningTokens": 0,
"cacheReadTokens": 12000,
"cacheWriteTokens": 0,
"totalTokens": 36490,
"costUsd": 0.101325,
"projects": 6,
"events": 12,
"activeDays": 3
},
"projects": [
{
"repoRoot": "/work/a/api",
"project": "a/api",
"inputTokens": 6200,
"outputTokens": 1700,
"reasoningTokens": 0,
"cacheReadTokens": 10000,
"cacheWriteTokens": 0,
"totalTokens": 17900,
"costUsd": 0.0471,
"costShare": 0.464841,
"events": 3,
"activeDays": 2,
"topModels": ["claude-sonnet-4-5"]
}
],
"granularity": "monthly",
"periods": [
{
"rowType": "period_project",
"periodKey": "2026-05",
"repoRoot": "/work/a/api",
"project": "a/api",
"models": ["claude-sonnet-4-5"],
"modelBreakdown": [
{
"model": "claude-sonnet-4-5",
"inputTokens": 1200,
"outputTokens": 300,
"reasoningTokens": 0,
"cacheReadTokens": 0,
"cacheWriteTokens": 0,
"totalTokens": 1500,
"costUsd": 0.0081
}
],
"inputTokens": 1200,
"outputTokens": 300,
"reasoningTokens": 0,
"cacheReadTokens": 0,
"cacheWriteTokens": 0,
"totalTokens": 1500,
"costUsd": 0.0081
}
]
}
}

repoRoot is the full path without trailing separators, or null for (unattributed). costShare runs from 0 to 1 and is null when the window has no cost or the project has no resolved cost. topModels holds at most three models, most tokens first. granularity and periods appear only with --granularity; each period row’s modelBreakdown lists its models with their own totals. The full contract is report-projects.v1.schema.json.