fix: 可灵替换为Seedance 2.0 + 清理旧GPU计算逻辑

This commit is contained in:
yumoqing 2026-07-06 17:22:41 +08:00
parent 225c654811
commit 0d73abfb20

View File

@ -39,13 +39,13 @@ MODEL_PRICING = {
"features": ["T2V", "I2V"], "features": ["T2V", "I2V"],
"recommended_for": ["standard", "batch"], "recommended_for": ["standard", "batch"],
}, },
"kling-v2-1-master": { "doubao-seedance-2-0-260128": {
"name": "可灵 Kling 2.1 Master (T2V)", "name": "豆包 Seedance 2.0 (T2V)",
"price_per_second": 0.10, "price_per_second": 0.08,
"quality_score": 9.0, "quality_score": 9.0,
"generation_speed": "slow", "generation_speed": "slow",
"description": "旗舰级文生视频,最高质量", "description": "字节跳动旗舰视频生成,支持音效同步",
"features": ["T2V", "I2V"], "features": ["T2V", "I2V", "Ref2V", "音效"],
"recommended_for": ["premium", "cinematic"], "recommended_for": ["premium", "cinematic"],
}, },
} }
@ -70,12 +70,12 @@ def estimate_scene_cost(storyboard: List[Dict[str, Any]], fps: int = 24) -> int:
return total_frames return total_frames
def estimate_model_cost(model_id: str, total_frames: int) -> Dict[str, Any]: def estimate_model_cost(model_id: str, total_frames: int, fps: int = 24) -> Dict[str, Any]:
""" """
Estimate cost for a specific model. Estimate cost for a specific model.
Args: Args:
model_id: Model identifier (wan2.2, wan2.7, vidu2.0) model_id: Model identifier (e.g., wan2.6-t2v, doubao-seedance-2-0-260128)
total_frames: Total frames to generate total_frames: Total frames to generate
Returns: Returns:
@ -85,28 +85,14 @@ def estimate_model_cost(model_id: str, total_frames: int) -> Dict[str, Any]:
raise ValueError(f"Unknown model: {model_id}") raise ValueError(f"Unknown model: {model_id}")
model = MODEL_PRICING[model_id] model = MODEL_PRICING[model_id]
base_cost = total_frames * model["price_per_frame"]
# Add GPU compute overhead for local models
if "Local GPU" in model["name"]:
# Estimate GPU time: ~10 seconds per frame on 4090
gpu_seconds = total_frames * 10
# GPU cost: $0.50/hour = $0.000139/second
gpu_cost = gpu_seconds * 0.000139
total_cost = base_cost + gpu_cost
else:
# Cloud API includes compute in price
total_cost = base_cost
gpu_cost = 0
return { return {
"model_id": model_id, "model_id": model_id,
"model_name": model["name"], "model_name": model["name"],
"total_frames": total_frames, "total_frames": total_frames,
"price_per_frame": model["price_per_frame"], "fps": fps,
"base_cost": round(base_cost, 4), "price_per_second": model["price_per_second"],
"gpu_cost": round(gpu_cost, 4), "total_cost": round(total_frames * model["price_per_second"] / fps, 4),
"total_cost": round(total_cost, 4),
"quality_score": model["quality_score"], "quality_score": model["quality_score"],
"generation_speed": model["generation_speed"], "generation_speed": model["generation_speed"],
"description": model["description"], "description": model["description"],
@ -132,7 +118,7 @@ def estimate_all_models(storyboard: List[Dict[str, Any]], fps: int = 24) -> List
estimates = [] estimates = []
for model_id in MODEL_PRICING.keys(): for model_id in MODEL_PRICING.keys():
try: try:
estimate = estimate_model_cost(model_id, total_frames) estimate = estimate_model_cost(model_id, total_frames, fps)
estimate["scene_count"] = scene_count estimate["scene_count"] = scene_count
estimate["fps"] = fps estimate["fps"] = fps
estimates.append(estimate) estimates.append(estimate)
@ -188,11 +174,7 @@ def format_cost_summary(estimates: List[Dict[str, Any]]) -> str:
lines.append(f" 生成速度: {est['generation_speed']}") lines.append(f" 生成速度: {est['generation_speed']}")
lines.append(f" 功能: {', '.join(est['features'])}") lines.append(f" 功能: {', '.join(est['features'])}")
lines.append(f" 描述: {est['description']}") lines.append(f" 描述: {est['description']}")
lines.append(f" 费用明细:") lines.append(f" 费用: 每秒 ${est['price_per_second']:.4f} × {est['total_frames']}帧@{est['fps']}fps = ${est['total_cost']:.4f}")
lines.append(f" - 基础费用: ${est['base_cost']:.4f}")
if est['gpu_cost'] > 0:
lines.append(f" - GPU计算: ${est['gpu_cost']:.4f}")
lines.append(f" - 总计: ${est['total_cost']:.4f}")
lines.append("") lines.append("")
lines.append("=" * 70) lines.append("=" * 70)