MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / CountTextToken

Function CountTextToken

service/token_counter.go:468–474  ·  view source on GitHub ↗

func CountAudioToken(sec float64, audioType string) { if audioType == "input" { } } CountTextToken 统计文本的token数量,仅当文本包含敏感词,返回错误,同时返回token数量

(text string, model string)

Source from the content-addressed store, hash-verified

466
467// CountTextToken 统计文本的token数量,仅当文本包含敏感词,返回错误,同时返回token数量
468func CountTextToken(text string, model string) int {
469 if text == "" {
470 return 0
471 }
472 tokenEncoder := getTokenEncoder(model)
473 return getTokenNum(tokenEncoder, text)
474}

Callers 9

palmHandlerFunction · 0.92
OpenaiHandlerFunction · 0.92
cfSTTHandlerFunction · 0.92
HandleClaudeResponseDataFunction · 0.92
CountTokenRealtimeFunction · 0.85
CountTokenInputFunction · 0.85
CountTTSTokenFunction · 0.85
ResponseText2UsageFunction · 0.85

Calls 2

getTokenEncoderFunction · 0.85
getTokenNumFunction · 0.85

Tested by

no test coverage detected