What probably matters to youSection of the release
What
When Claude Code runs without its interactive screen, for example from a script or through the SDK (the toolkit for driving Claude Code from your own program), it writes a result message at the end of each piece of work. These result messages can now carry a field called model_usage_since_last_result, placed next to the existing result_index.
It gives usage and cost, broken down per model, for the calls this process counted since it wrote its previous result.
It is meant to be added up across a conversation.
It is set in stream-json output and in --sdk-url runs, not in json or text output.
It only appears when a value is available for it.
Why
Previously only result_index was added. If you consume Claude Code's output from your own program, you can now total usage and cost for a conversation by summing this field from each result, instead of working out differences between running totals.
Read from
Names in the bundlemodel_usage_since_last_resultresult_index