Qwen Data Source (Experimental)
Qwen support is experimental. Expect breaking changes while both ccusage and Qwen Code continue to evolve.
ccusage can read Qwen Code chat JSONL files as one of its supported local data sources, using the same focused and all-source report views as the rest of ccusage.
Focused Views
bunx ccusage qwen --helpnpx ccusage@latest qwen --helppnpm dlx ccusage qwen --helpData Source
The CLI reads Qwen chat JSONL files from QWEN_DATA_DIR (defaults to ~/.qwen). QWEN_DATA_DIR can be one directory or a comma-separated list of directories.
QWEN_DATA_DIR="$HOME/.qwen,/backup/qwen" ccusage qwen daily~/.qwen/
└── projects/
└── {project}/
└── chats/
└── *.jsonlReport Views
| Focused view | Description | See also |
|---|---|---|
ccusage qwen daily | Aggregate usage by date | Daily Usage |
ccusage qwen monthly | Aggregate usage by month | Monthly Usage |
ccusage qwen session | Group usage by Qwen session | Session Usage |
These views support --json for structured output, --compact for narrow terminals, and --offline for cached pricing data.
What Gets Calculated
- Token usage - Qwen assistant rows provide input and output token counts through
usageMetadata. - Reasoning tokens -
thoughtsTokenCountis included intotalTokensand priced as output tokens when pricing data is available. - Cache tokens -
cachedContentTokenCountis treated as cache read tokens. Qwen logs do not currently expose cache creation tokens. - Pricing - Costs are calculated from LiteLLM pricing data using the raw model name and Qwen provider-prefixed candidates.
Environment Variables
| Variable | Description |
|---|---|
QWEN_DATA_DIR | Override the root directory, or comma-separated root directories, containing Qwen data |
LOG_LEVEL | Adjust verbosity (0 silent ... 5 trace) |
Troubleshooting
No Qwen usage data found
Ensure the data directory exists at ~/.qwen/projects/{project}/chats/. Set QWEN_DATA_DIR if your Qwen data lives elsewhere or in multiple archive roots.
Costs showing as $0.00
If a model is not in LiteLLM's database, the cost will be $0.00. Open an issue to request alias support.