Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
59 lines
1.6 KiB
Go
59 lines
1.6 KiB
Go
package service
|
|
|
|
func imagePriceConfigFromAPIKey(apiKey *APIKey) *ImagePriceConfig {
|
|
if apiKey == nil || apiKey.Group == nil {
|
|
return nil
|
|
}
|
|
return &ImagePriceConfig{
|
|
Price1K: apiKey.Group.ImagePrice1K,
|
|
Price2K: apiKey.Group.ImagePrice2K,
|
|
Price4K: apiKey.Group.ImagePrice4K,
|
|
}
|
|
}
|
|
|
|
func apiKeyHasConfiguredImagePrice(apiKey *APIKey, imageSize string) bool {
|
|
return apiKey != nil && apiKey.Group != nil && apiKey.Group.GetImagePrice(imageSize) != nil
|
|
}
|
|
|
|
func videoPriceConfigFromAPIKey(apiKey *APIKey) *VideoPriceConfig {
|
|
if apiKey == nil || apiKey.Group == nil {
|
|
return nil
|
|
}
|
|
return &VideoPriceConfig{
|
|
Price480P: apiKey.Group.VideoPrice480P,
|
|
Price720P: apiKey.Group.VideoPrice720P,
|
|
Price1080P: apiKey.Group.VideoPrice1080P,
|
|
ModelPrices: apiKey.Group.VideoModelPrices,
|
|
}
|
|
}
|
|
|
|
func apiKeyHasConfiguredVideoPrice(apiKey *APIKey, model, resolution string) bool {
|
|
return apiKey != nil && apiKey.Group != nil && apiKey.Group.GetVideoPriceForModel(model, resolution) != nil
|
|
}
|
|
|
|
func webSearchPricePerCallFromAPIKey(apiKey *APIKey) *float64 {
|
|
if apiKey == nil || apiKey.Group == nil {
|
|
return nil
|
|
}
|
|
return apiKey.Group.WebSearchPricePerCall
|
|
}
|
|
|
|
func groupSearchPricePer1kFromAPIKey(apiKey *APIKey) *float64 {
|
|
if apiKey == nil || apiKey.Group == nil {
|
|
return nil
|
|
}
|
|
return apiKey.Group.GetSearchPricePer1k()
|
|
}
|
|
|
|
func groupAudioPriceConfigFromAPIKey(apiKey *APIKey) *audioPriceConfig {
|
|
if apiKey == nil || apiKey.Group == nil {
|
|
return nil
|
|
}
|
|
g := apiKey.Group
|
|
return &audioPriceConfig{
|
|
RealtimePerMin: g.AudioRealtimePricePerMin,
|
|
TTSPerMChars: g.AudioTTSPricePerMillionChars,
|
|
STTPerHour: g.AudioSTTPricePerHour,
|
|
}
|
|
}
|