# Qwen Code cost tracking: /stats, token counts, status line

Qwen Code's /stats shows token usage by session, day and month, and an estimated cost per model. What each view shows, the status line fields, and what is missing.

Qwen Code shows usage in `/stats`: tokens for the session, by day and by month, with an estimated cost per model, and it can export to CSV or JSON. A custom status line gets token counts for the live session but no dollar field.


**ACP on Qwen Code.** The hook sees shell, file-edit and MCP calls in every approval mode, yolo included, and records each one. By default a force-push, destructive SQL, `curl | sh` or a recursive delete outside the project is blocked until you approve on the console or by email.

```bash
# macOS, Linux, WSL
curl -fsSL https://agenticcontrolplane.com/install.sh | bash

# Windows (PowerShell)
irm https://agenticcontrolplane.com/install.ps1 | iex
```

In a headless run Qwen Code turns an ask into a deny itself. Connected, the hook sends ACP each call's tool name and arguments, and up to 200 KB of its output. Add `--local` and nothing is sent: the rules and the log stay on this machine, with no account. Free up to 5 agents.

[What the installer writes](https://agenticcontrolplane.com/install-explained) · [Qwen Code guide](https://agenticcontrolplane.com/integrations/qwen-code) · [What ACP sees on each agent](https://agenticcontrolplane.com/coverage)


Everything here comes from the [Qwen Code docs](https://qwenlm.github.io/qwen-code-docs/en/), read on 2026-11-25. The commands page was last updated by the maintainers on 2026-11-15. We did not run a Qwen Code build for this page, so if a command is missing in your version, compare it against the docs.

## How Qwen Code is paid for

Qwen Code is a CLI, and what you pay depends on what sits behind it. The [README](https://github.com/QwenLM/qwen-code) says that in a session you run `/auth` and either sign in with a Qwen account with a Plus or Pro subscription, or configure a provider with an API key. It says the API key route supports OpenAI, Anthropic, Gemini and Qwen APIs and any third-party provider or local model, and that you can switch at runtime.

So there is no single price. On an API key you pay whatever that provider charges per token, and the docs for Qwen Code do not list those rates. On a subscription you pay the plan.

One cost lever is documented. The [token caching page](https://qwenlm.github.io/qwen-code-docs/en/users/features/token-caching/) says Qwen Code optimizes API costs through token caching when you use API key authentication, and that it "occurs with API key authentication but not with OAuth authentication."

## What Qwen Code shows

From the [commands reference](https://qwenlm.github.io/qwen-code-docs/en/users/features/commands/):

```text
/stats (or /usage)        Open the interactive usage statistics dashboard (Session, Activity, and Efficiency tabs)
/stats model              Show per-model token breakdown and estimated cost
/stats tools              Show per-tool call counts
/stats skills             Show per-skill call counts for the current live session
/stats daily  [YYYY-MM-DD]  Show daily token usage statistics
/stats monthly [YYYY-MM]    Show monthly token usage statistics
/stats export <daily|monthly> [date|month] [--format csv|json] [--output path]
/context                  Show context window usage breakdown
/context detail           Show per-item context usage breakdown
```

**`/stats model`** is the only place the docs mention a cost, and they call it an estimated cost. Treat it as an estimate, not an invoice.

**`/stats daily` and `/stats monthly`** are the cross-session views. `/stats skills` is the exception: it covers the current live session only.

**Cached tokens.** When caching is in play, `/stats` shows the cached share of input, for example "10,500 (90.4%) of input tokens were served from the cache", and only when cached tokens are being used.

**`/context`** is about the window, not money, but a window that keeps filling is what makes a long session expensive.

## The status line: tokens, not dollars

Qwen Code pipes JSON to a command-mode status line. The [status line docs](https://qwenlm.github.io/qwen-code-docs/en/users/features/status-line/) list these fields:

```text
model.display_name
context_window.context_window_size
context_window.used_percentage
context_window.remaining_percentage
context_window.current_usage          tokens from the last API call
context_window.total_input_tokens     consumed this session
context_window.total_output_tokens    consumed this session
metrics.models.<id>.api               total_requests, total_errors, total_latency_ms
metrics.models.<id>.tokens            prompt, completion, total, cached, thoughts
metrics.files                         total_lines_added, total_lines_removed
```

The docs document no cost or price field. The config goes under the `ui` key in `~/.qwen/settings.json`, not at the root:

```json
{
  "ui": {
    "statusLine": {
      "type": "command",
      "command": "~/.qwen/statusline.sh",
      "refreshInterval": 30
    }
  }
}
```

A script that shows session tokens, so you have a number to multiply by your own rates:

```bash
#!/bin/sh
input=$(cat)
echo "$input" | jq -r '"in " + ((.context_window.total_input_tokens // 0) | tostring)
  + "  out " + ((.context_window.total_output_tokens // 0) | tostring)'
```

Read stdin once: the docs warn that it can only be read once, so store it first. Make the script executable with `chmod +x`. Commands that take longer than 5 seconds are killed and the line clears, updates are debounced to 300 ms, and changes to `ui.statusLine` take effect without a restart. `/statusline <text>` will generate a command-mode status line for you from a plain-English request.

## Where usage lives

- **Settings:** `~/.qwen/settings.json`, which holds `ui.statusLine`.
- **Usage history:** behind `/stats daily` and `/stats monthly`. The docs I read do not say where it is stored on disk, so use `/stats export` to get a copy.
- **Live session numbers:** the status line JSON above.

## What is missing

- **A billed cost.** The only dollar figure is the estimate in `/stats model`.
- **A dollar field for scripts.** The status line has token counts only.
- **Provider rates.** Qwen Code does not publish a price list, because the price depends on the provider behind it.
- **Cached tokens on OAuth.** The docs say caching does not happen there, so there is nothing to show.
- **A team view.** Nothing in the docs reports spend per developer.

## Keeping a running cost visible

1. Add the token status line above, and set `refreshInterval` so it updates while the agent works.
2. Run `/stats model` at the end of a task for the estimate.
3. Run `/stats export monthly --format csv --output usage.csv` and keep the file, if you want your own history.

## What these numbers leave out

This is all model usage. None of it records what the agent did. Qwen Code's hooks are Claude Code's contract, and ACP uses them to record each shell, file-edit and MCP call and check it, [yolo mode included](/controls/qwen-code). That hook never sees the model call, so it does not price anything. To get priced spend, the cache hit rate and a loop-versus-leaf breakdown on the console, start Qwen Code with `qwen-acp`, which routes the model call through the ACP proxy for that launch. It only works when Qwen Code's auth type is OpenAI, which you pick once under `/auth`. See the [install guide](/integrations/qwen-code) and [Turn on Cost X-Ray](/cost-tracking).

## Frequently asked questions


### How do I check token usage in Qwen Code?

Run /stats (alias /usage). It opens a usage dashboard with Session, Activity and Efficiency tabs. /stats model shows a per-model token breakdown and estimated cost, /stats tools shows per-tool call counts, and /stats daily and /stats monthly show token usage by day or month.

### Can I export Qwen Code usage?

Yes. /stats export <daily|monthly> [date|month] [--format csv|json] [--output path] writes usage statistics to CSV or JSON.

### Does the Qwen Code status line show cost?

Not as a dollar field. The JSON passed to a custom status line command has token counts, including total_input_tokens, total_output_tokens and metrics.models.<id>.tokens (prompt, completion, total, cached, thoughts), and no cost field. You can multiply those by your provider's rates in the script.

### Does Qwen Code cache tokens, and can I see it?

Qwen Code's docs say token caching happens with API key authentication, including Qwen API keys and OpenAI-compatible providers, and not with OAuth. When it is used, /stats shows how many input tokens came from the cache, as a count and a percentage.


## Where to read more

- [Commands](https://qwenlm.github.io/qwen-code-docs/en/users/features/commands/): `/stats`, `/context`, `/statusline`
- [Status line](https://qwenlm.github.io/qwen-code-docs/en/users/features/status-line/): JSON fields, config, timing
- [Token caching](https://qwenlm.github.io/qwen-code-docs/en/users/features/token-caching/): which auth types cache
- [Qwen Code controls](/controls/qwen-code): hooks and approval modes
- [Qwen Code install guide](/integrations/qwen-code): the hook and the cost X-Ray
- [Turn on Cost X-Ray](/cost-tracking): the proxy path across harnesses
- [OpenCode cost tracking](/blog/opencode-cost-tracking): another open-source CLI that talks to many providers
