Sweep 19 Sep 2026 · 02:36Z Build v2.1.278 500 read Stable v2.1.267 Latest v2.1.278 Next v2.1.278 Feeds RSS JSON llms.txt Unofficial
Claude Code v2.1.267 ·

New scriptable session-usage API ($.session.usage)

A new scripting API, $.session.usage, exposes context, rate-limit, and cost data to plugins and scripts

TierUse it nowhow much it should matter to you
Useful5my rating, 1 to 5
Signal3worth watching, 1 to 5
AreaSDKwhat it touches
KindNew Featuresin v2.1.267,
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, and spend_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.

See this entry in the whole of v2.1.267 →