| @@ -704,9 +704,14 @@ func (e *DevinExecutor) streamDevinFrames( · 703 unmodified lines |
| 704 | 704 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.id", interactionID) |
| 705 | 705 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.model", req.Model) |
| 706 | 706 | if finalUsage != nil { |
| 707 | | − completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_input_tokens", finalUsage.PromptTokens) |
| 708 | | − completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_output_tokens", finalUsage.CompletionTokens) |
| 707 | + totalInput := finalUsage.PromptTokens + finalUsage.CachedTokens |
| 708 | + totalOutput := finalUsage.CompletionTokens |
| 709 | + totalTokens := totalInput + totalOutput |
| 710 | + |
| 711 | + completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_input_tokens", totalInput) |
| 712 | + completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_output_tokens", totalOutput) |
| 709 | 713 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_cached_tokens", finalUsage.CachedTokens) |
| 714 | + completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_tokens", totalTokens) |
| 710 | 715 | if detail, ok := helps.ParseInteractionsStreamUsage(completedEvent); ok { |
| 711 | 716 | reporter.Publish(ctx, detail) |
| 712 | 717 | } |
| @@ -895,9 +900,14 @@ func consumeDevinFramesToInteractions(body io.Reader, model, chatModelUID string · 182 unmodified lines |
| 895 | 900 | } |
| 896 | 901 | |
| 897 | 902 | if finalUsage != nil { |
| 898 | | − out, _ = sjson.SetBytes(out, "usage.total_input_tokens", finalUsage.PromptTokens) |
| 899 | | − out, _ = sjson.SetBytes(out, "usage.total_output_tokens", finalUsage.CompletionTokens) |
| 903 | + totalInput := finalUsage.PromptTokens + finalUsage.CachedTokens |
| 904 | + totalOutput := finalUsage.CompletionTokens |
| 905 | + totalTokens := totalInput + totalOutput |
| 906 | + |
| 907 | + out, _ = sjson.SetBytes(out, "usage.total_input_tokens", totalInput) |
| 908 | + out, _ = sjson.SetBytes(out, "usage.total_output_tokens", totalOutput) |
| 900 | 909 | out, _ = sjson.SetBytes(out, "usage.total_cached_tokens", finalUsage.CachedTokens) |
| 910 | + out, _ = sjson.SetBytes(out, "usage.total_tokens", totalTokens) |
| 901 | 911 | } |
| 902 | 912 | |
| 903 | 913 | respLog := &helps.DevinUpstreamResponseLog{ |