Use it now Notable
A new scripting API, $.session.usage, exposes context, rate-limit, and cost data to plugins and scripts
What
A new function called $.session.usage is now available for scripting and plugin code. It returns details about the current session, including:
- context-window usage (how many tokens are used, the size of the window, and the percentage full)
- rate-limit windows (
five_hour,seven_day, andspend_limit), each with a percent used and when it resets - the current session's cost in US dollars
Why
This lets plugins and other scripts built on top of Claude Code read the same usage and cost figures Claude Code itself tracks, instead of guessing or parsing them from elsewhere. That makes it possible to build custom status lines, dashboards, or automations that react to how close a session is to its context or rate limits.