| @@ -704,9 +704,14 @@ func (e *DevinExecutor) streamDevinFrames( · 703 unmodified lines |
| 704 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.id", interactionID) | 704 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.id", interactionID) |
| 705 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.model", req.Model) | 705 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.model", req.Model) |
| 706 | if finalUsage != nil { | 706 | if finalUsage != nil { |
| 707 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_input_tokens", finalUsage.PromptTokens) | 707 | totalInput := finalUsage.PromptTokens + finalUsage.CachedTokens |
| 708 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_output_tokens", finalUsage.CompletionTokens) | 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 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_cached_tokens", finalUsage.CachedTokens) | 713 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_cached_tokens", finalUsage.CachedTokens) |
| | 714 | completedEvent, _ = sjson.SetBytes(completedEvent, "interaction.usage.total_tokens", totalTokens) |
| 710 | if detail, ok := helps.ParseInteractionsStreamUsage(completedEvent); ok { | 715 | if detail, ok := helps.ParseInteractionsStreamUsage(completedEvent); ok { |
| 711 | reporter.Publish(ctx, detail) | 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 | if finalUsage != nil { | 902 | if finalUsage != nil { |
| 898 | out, _ = sjson.SetBytes(out, "usage.total_input_tokens", finalUsage.PromptTokens) | 903 | totalInput := finalUsage.PromptTokens + finalUsage.CachedTokens |
| 899 | out, _ = sjson.SetBytes(out, "usage.total_output_tokens", finalUsage.CompletionTokens) | 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 | out, _ = sjson.SetBytes(out, "usage.total_cached_tokens", finalUsage.CachedTokens) | 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 | respLog := &helps.DevinUpstreamResponseLog{ | 913 | respLog := &helps.DevinUpstreamResponseLog{ |