| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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,
- }
- }
|