You've already forked agentic-coding-workflow
feat(chat): StreamerHub with ring buffer + cond + Done/Error/Cancel flows
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package chat
|
||||
|
||||
import "strconv"
|
||||
|
||||
// computeCost returns the cost in USD for a single LLM call.
|
||||
// Prices on LLMModel are expressed in USD per million tokens.
|
||||
func computeCost(m LLMModel, ptok, ctok, ttok int) float64 {
|
||||
return (float64(ptok)*m.PromptPricePerMillionUSD +
|
||||
float64(ctok)*m.CompletionPricePerMillionUSD +
|
||||
float64(ttok)*m.ThinkingPricePerMillionUSD) / 1_000_000
|
||||
}
|
||||
|
||||
// int64ToString converts an int64 to its decimal string representation.
|
||||
// Uses strconv.FormatInt rather than fmt.Sprintf for efficiency.
|
||||
func int64ToString(v int64) string { return strconv.FormatInt(v, 10) }
|
||||
Reference in New Issue
Block a user