mirror of
https://github.com/coalaura/whiskr.git
synced 2025-12-02 20:22:52 +00:00
include upstream inference cost for byok
This commit is contained in:
4
stats.go
4
stats.go
@@ -45,6 +45,10 @@ func HandleStats(w http.ResponseWriter, r *http.Request) {
|
|||||||
Time: Nullable(generation.GenerationTime, 0),
|
Time: Nullable(generation.GenerationTime, 0),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if generation.IsBYOK && generation.UpstreamInferenceCost != nil {
|
||||||
|
statistics.Cost += *generation.UpstreamInferenceCost
|
||||||
|
}
|
||||||
|
|
||||||
nativeIn := Nullable(generation.NativeTokensPrompt, 0)
|
nativeIn := Nullable(generation.NativeTokensPrompt, 0)
|
||||||
normalIn := Nullable(generation.TokensPrompt, 0)
|
normalIn := Nullable(generation.TokensPrompt, 0)
|
||||||
|
|
||||||
|
|||||||
2
title.go
2
title.go
@@ -132,7 +132,7 @@ func HandleTitle(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
choice := response.Choices[0].Message.Content.Text
|
choice := response.Choices[0].Message.Content.Text
|
||||||
cost := response.Usage.Cost
|
cost := response.Usage.Cost + response.Usage.CostDetails.UpstreamInferenceCost
|
||||||
|
|
||||||
var result TitleResponse
|
var result TitleResponse
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user