|
|
@@ -92,13 +92,6 @@ func getImageToken(info *relaycommon.RelayInfo, imageUrl *dto.MessageImageUrl, m
|
|
|
if !constant.GetMediaTokenNotStream && !stream {
|
|
|
return 256, nil
|
|
|
}
|
|
|
- // 是否统计图片token
|
|
|
- if !constant.GetMediaToken {
|
|
|
- return 256, nil
|
|
|
- }
|
|
|
- if info.ChannelType == common.ChannelTypeGemini || info.ChannelType == common.ChannelTypeVertexAi || info.ChannelType == common.ChannelTypeAnthropic {
|
|
|
- return 256, nil
|
|
|
- }
|
|
|
// 同步One API的图片计费逻辑
|
|
|
if imageUrl.Detail == "auto" || imageUrl.Detail == "" {
|
|
|
imageUrl.Detail = "high"
|
|
|
@@ -109,6 +102,13 @@ func getImageToken(info *relaycommon.RelayInfo, imageUrl *dto.MessageImageUrl, m
|
|
|
tileTokens = 5667
|
|
|
baseTokens = 2833
|
|
|
}
|
|
|
+ // 是否统计图片token
|
|
|
+ if !constant.GetMediaToken {
|
|
|
+ return 3 * baseTokens, nil
|
|
|
+ }
|
|
|
+ if info.ChannelType == common.ChannelTypeGemini || info.ChannelType == common.ChannelTypeVertexAi || info.ChannelType == common.ChannelTypeAnthropic {
|
|
|
+ return 3 * baseTokens, nil
|
|
|
+ }
|
|
|
var config image.Config
|
|
|
var err error
|
|
|
var format string
|