{"version":"2.1.309","anchor":"stream-json-result-carries-per-call-usage-delta-field","canonical_anchor":"result-messages-can-carry-model-usage-since-last-result","heading":"Result messages can report usage and cost since the previous result","tier":"use","area":"SDK","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.309\/e\/stream-json-result-carries-per-call-usage-delta-field","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.309","markdown":"### Result messages can report usage and cost since the previous result\n\nIn stream-json and --sdk-url runs, result messages can carry model_usage_since_last_result, per-model usage and cost since the last result\n\n**Unclear.** The name of the new field is not known.\n\n**What**\n\nWhen 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`.\n\n- It gives usage and cost, broken down per model, for the calls this process counted since it wrote its previous result.\n\n- It is meant to be added up across a conversation.\n\n- It is set in `stream-json` output and in `--sdk-url` runs, not in `json` or `text` output.\n\n- It only appears when a value is available for it.\n\n**Why**\n\nPreviously 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.\n\n- Area: SDK\n- Tier: Use it now\n- Useful: 4\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: no"}