Back to library
AI
best practice

Track AI Token Costs and Budget in Real-Time with /stats

Monitor your daily API spend directly from your terminal.

Check your real-time token usage and project costs by running `/stats` inside the Qwen Code interface to avoid billing surprises.

Qwen

The Scenario

You are working on a large codebase and want to ensure you aren't burning through your API budget during a long development session.

Before & after

The old way

Users have to log in to an API provider's dashboard and navigate through billing menus to find usage metrics. This process usually takes 5-10 minutes.

With AI

Use the `/stats` command to instantly see your daily token expenditure. This takes 5 seconds and helps you decide if you should switch to a smaller model.

The Prompt

/stats

Keeping track of token costs directly in the CLI helps developers manage their budget, especially when using high-reasoning models for long debugging sessions.

Source

Qwen Code Blog: AI Coding Updates and Guides | Qwen Code Docs
"/stats shows your daily token spend."