diff --git a/backend/app/openai/chat.go b/backend/app/openai/chat.go index de573cd..1624899 100644 --- a/backend/app/openai/chat.go +++ b/backend/app/openai/chat.go @@ -153,6 +153,7 @@ func (a *API) ChatCompleteStreaming(ctx context.Context, completion models.ChatC backgroundContext := context.WithValue(context.Background(), models.UserContext{}, ctx.Value(models.UserContext{}).(string)) backgroundContext = context.WithValue(backgroundContext, models.SubscriptionContext{}, ctx.Value(models.SubscriptionContext{}).(models.MongoSubscriptionName)) + backgroundContext = context.WithValue(backgroundContext, models.ClientContext{}, ctx.Value(models.ClientContext{}).(string)) usage.Usage.TotalTokens = usage.Usage.PromptTokens + usage.Usage.CompletionTokens go payments.Bill(backgroundContext, usage) config.CONFIG.DataDogClient.Timing("openai.chat_complete_streaming.latency", time.Since(timeNow), []string{"model:" + completion.Model}, 1)