Save local changes (GSC/Bing integrations) before merging PR #354

This commit is contained in:
ajaysi
2026-02-13 13:11:27 +05:30
parent 43e66835ac
commit 08a1f4a1d8
144 changed files with 8310 additions and 2748 deletions

View File

@@ -199,6 +199,24 @@ class PricingService:
"cost_per_input_token": 0.0, # No additional token cost for grounding
"cost_per_output_token": 0.0, # No additional token cost for grounding
"description": "Grounding with Google Search - 1,500 RPD free, then $35/1K requests"
},
# Alwrity Voice Cloning - Qwen3
{
"provider": APIProvider.AUDIO,
"model_name": "alwrity-ai/qwen3-tts/voice-clone",
"cost_per_request": 0.10,
"cost_per_input_token": 0.00001,
"cost_per_output_token": 0.0,
"description": "Alwrity Qwen3 Voice Clone (Efficient)"
},
# Alwrity Voice Cloning - CosyVoice
{
"provider": APIProvider.AUDIO,
"model_name": "alwrity-ai/cosyvoice/voice-clone",
"cost_per_request": 0.15,
"cost_per_input_token": 0.00001,
"cost_per_output_token": 0.0,
"description": "Alwrity CosyVoice Clone (High Fidelity)"
}
]
@@ -402,11 +420,19 @@ class PricingService:
{
"provider": APIProvider.AUDIO,
"model_name": "wavespeed-ai/qwen3-tts/voice-clone",
"cost_per_request": 0.0,
"cost_per_input_token": 0.0,
"cost_per_request": 0.005,
"cost_per_input_token": 0.00005,
"cost_per_output_token": 0.0,
"description": "Qwen3-TTS Voice Clone via WaveSpeed (cost depends on text length)"
},
{
"provider": APIProvider.AUDIO,
"model_name": "wavespeed-ai/cosyvoice-tts/voice-clone",
"cost_per_request": 0.005,
"cost_per_input_token": 0.00005,
"cost_per_output_token": 0.0,
"description": "CosyVoice-TTS Voice Clone via WaveSpeed (cost depends on text length)"
},
{
"provider": APIProvider.AUDIO,
"model_name": "default",
@@ -429,8 +455,9 @@ class PricingService:
if existing:
# Update existing pricing (especially for HuggingFace if env vars changed)
if pricing_data["provider"] == APIProvider.MISTRAL:
# Update HuggingFace pricing from env vars
if pricing_data["provider"] in [APIProvider.MISTRAL, APIProvider.AUDIO]:
# Update pricing
existing.cost_per_request = pricing_data.get("cost_per_request", 0.0)
existing.cost_per_input_token = pricing_data["cost_per_input_token"]
existing.cost_per_output_token = pricing_data["cost_per_output_token"]
existing.description = pricing_data["description"]

View File

@@ -490,6 +490,32 @@ class UsageTrackingService:
'cost': image_edit_cost
}
# WaveSpeed (aggregated across Video, Audio, Image, Image Edit)
# Query APIUsageLog directly to get accurate WaveSpeed-specific usage
wavespeed_logs = self.db.query(APIUsageLog).filter(
APIUsageLog.user_id == user_id,
APIUsageLog.billing_period == billing_period,
APIUsageLog.actual_provider_name == "wavespeed"
).all()
if wavespeed_logs:
wavespeed_calls = len(wavespeed_logs)
wavespeed_tokens = sum((log.tokens_total or 0) for log in wavespeed_logs)
wavespeed_cost = sum(float(log.cost_total or 0.0) for log in wavespeed_logs)
provider_breakdown['wavespeed'] = {
'calls': wavespeed_calls,
'tokens': wavespeed_tokens,
'cost': wavespeed_cost
}
logger.info(f"[UsageStats] Calculated WaveSpeed usage: {wavespeed_calls} calls, ${wavespeed_cost:.6f}")
else:
provider_breakdown['wavespeed'] = {
'calls': 0,
'tokens': 0,
'cost': 0.0
}
# Search APIs
tavily_calls = getattr(summary, "tavily_calls", 0) or 0
tavily_cost = getattr(summary, "tavily_cost", 0.0) or 0.0