MeUtils 2025.7.1.18.54.57__py3-none-any.whl → 2025.7.4.19.37.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ def get_billing_n(request: Union[BaseModel, dict], duration: float = 6, resoluti
130
130
  :param duration:
131
131
  :return:
132
132
  """
133
- resolution = resolution or "500" # resolution.lower().removesuffix('p')
133
+ resolution = (resolution or "500").lower().removesuffix('p')
134
134
 
135
135
  if isinstance(request, BaseModel):
136
136
  request = request.model_dump()
@@ -139,7 +139,7 @@ def get_billing_n(request: Union[BaseModel, dict], duration: float = 6, resoluti
139
139
  num = request.get("n") or request.get("num_images") or 1
140
140
 
141
141
  # 时长
142
- dur = np.ceil(request.get("duration", duration) / duration) # 默认 6s
142
+ dur = np.ceil(int(request.get("duration", duration)) / duration) # 默认 6s
143
143
  durs = {"--duration 10", "--dur 10"}
144
144
  if any(i in str(request) for i in durs):
145
145
  dur = max(dur, 2)
@@ -153,6 +153,39 @@ def get_billing_n(request: Union[BaseModel, dict], duration: float = 6, resoluti
153
153
  return num * dur * rs or 1
154
154
 
155
155
 
156
+ def get_billing_model(
157
+ request: Union[BaseModel, dict],
158
+
159
+ default_model: Optional[str] = None,
160
+ default_duration: Optional[int] = None,
161
+ default_resolution: Optional[str] = None
162
+ ):
163
+ """继续拓展其兼容性
164
+ 什么时候走这个逻辑?
165
+ """
166
+ if isinstance(request, BaseModel):
167
+ request = request.model_dump()
168
+
169
+ model = (request.get("model") or request.get("model_name") or default_model or "undefined model").lower()
170
+
171
+ # 某些模型不需要匹配,单模型计费
172
+ if model.startswith(("veo", "jimeng", "cogvideo")): # todo 后续再拓展
173
+ return model
174
+
175
+ duration = request.get("duration", default_duration or "5")
176
+ resolution = request.get("resolution", default_resolution or "720p")
177
+
178
+ # 火山
179
+ if any(i in str(request).lower() for i in {"--duration 10", "--dur 10"}):
180
+ duration = 10
181
+
182
+ for rs in {"480p", "720p", "1080p"}:
183
+ if any(i in str(request).lower() for i in {f"--resolution {rs}", f"--rs {rs}"}):
184
+ resolution = rs
185
+
186
+ return f"{model}_{duration}s_{resolution}"
187
+
188
+
156
189
  @asynccontextmanager
157
190
  async def billing_flow_for_async_task(
158
191
  model: str = "usage-async",
@@ -238,8 +271,11 @@ if __name__ == '__main__':
238
271
  # }
239
272
 
240
273
  data = {
241
- "model": "cogvideox-flash",
242
- "prompt": "比得兔开小汽车,游走在马路上,脸上的表情充满开心喜悦。",
243
- "resolution": "720p"
274
+ "model": "veo3",
275
+ "prompt": "女人飞上天了",
276
+ "images": [
277
+ "https://oss.ffire.cc/files/kling_watermark.png"
278
+ ],
279
+ "enhance_prompt": True
244
280
  }
245
- print(get_billing_n(data))
281
+ print(get_billing_model(data, default_resolution=""))
@@ -22,10 +22,38 @@ MJ_FAST = 1.5
22
22
  STEP = 2
23
23
  MINIMAX_VIDEO = 3
24
24
 
25
- """
25
+ FAL = {
26
+ 'fal-elevenlabs-tts-turbo-v2.5': 0.3,
27
+ 'fal-kling-video-lipsync-audio-to-video': 0.5,
28
+
29
+ 'fal-pixverse-v4.5-effects': 1,
30
+ 'fal-pixverse-v4.5-text-to-video': 0.9,
31
+ 'fal-pixverse-v4.5-text-to-video-fast': 1.8,
32
+ 'fal-pixverse-v4.5-image-to-video': 0.9,
33
+ 'fal-pixverse-v4.5-image-to-video-fast': 1.8,
34
+
35
+ # flux
36
+ 'fal-flux-1-schnell': 0.003 * 4,
37
+ 'fal-flux-1-schnell-redux': 0.025 * 4,
38
+ 'fal-flux-1-dev': 0.025 * 3,
39
+ 'fal-flux-1-dev-image-to-image': 0.03 * 3,
40
+ 'fal-flux-1-dev-redux': 0.025 * 3,
41
+
42
+ 'fal-flux-pro-kontext': 0.04 * 3,
43
+ 'fal-flux-pro-kontext-text-to-image': 0.1,
44
+ 'fal-flux-pro-kontext-multi': 0.04 * 3,
45
+
46
+ 'fal-flux-pro-kontext-max': 0.08 * 3,
47
+ 'fal-flux-pro-kontext-max-text-to-image': 0.08 * 3,
48
+ 'fal-flux-pro-kontext-max-multi': 0.08 * 3,
49
+ }
50
+
51
+ FAL = {model.replace("fal-ai", "fal").replace("{{BASE_URL}}/", "").replace("/", "-").lower(): v for model, v in
52
+ FAL.items()}
26
53
 
27
- """
28
54
  MODEL_PRICE = {
55
+ **FAL,
56
+
29
57
  "chatfire-claude": 0.02,
30
58
  "o1:free": FREE,
31
59
  # "claude-3-7-sonnet-code:free": "claude-3-7-sonnet-code"
@@ -72,28 +100,23 @@ MODEL_PRICE = {
72
100
  "minimax_video-01-live2d": MINIMAX_VIDEO,
73
101
 
74
102
  # 火山
103
+ "jimeng-video-3.0": 0.5,
75
104
  "doubao-seedream-3-0-t2i-250415": 0.1,
76
- "api-volcengine-high_aes_general_v30l_zt2i": 0.05,
77
- "api-volcengine-byteedit_v2.0": 0.05,
78
105
 
79
- "doubao-seedance-1-0-pro-250528": 0.5, # 480 1080
106
+ "doubao-seedance-1-0-pro-250528": 0.5, # 480 1080
107
+ "api-doubao-seedance-1-0-pro-250528-1080p": 2, # 480 1080
108
+ "api-doubao-seedance-1-0-pro-250528-480p": 0.5, # 480 1080
80
109
 
81
- "doubao-seedance-1-0-lite-t2v-250428": 0.5,
82
- "doubao-seedance-1-0-lite-i2v-250428": 0.5,
110
+ "doubao-seedance-1-0-lite-t2v-250428": 0.4,
111
+ "doubao-seedance-1-0-lite-i2v-250428": 0.4,
83
112
 
84
- # videos
85
- "api-videos-wan-ai/wan2.1-t2v-14b": 1.2,
86
- "api-videos-wan-ai/wan2.1-t2v-14b-turbo": 1.2,
87
- "api-videos-wan-ai/wan2.1-i2v-14b-720p": 1.2,
88
- "api-videos-wan-ai/wan2.1-i2v-14b-720p-turbo": 1.2,
113
+ "api-volcengine-high_aes_general_v30l_zt2i": 0.05,
114
+ "api-volcengine-byteedit_v2.0": 0.05,
89
115
 
90
116
  # veo
91
117
  "veo3": 2,
92
118
  "veo3-pro": 8,
93
119
  "veo3-pro-frames": 8,
94
- "api-veo3": 2,
95
- "api-veo3-pro": 8,
96
- "api-veo3-pro-frames": 8,
97
120
 
98
121
  # hailuo
99
122
  "minimax-hailuo-02": 1,
@@ -103,8 +126,6 @@ MODEL_PRICE = {
103
126
  "api-minimax-hailuo-02-6s-1080p": 2,
104
127
 
105
128
  # chatfire
106
- "ppu-0001": 0.0001,
107
- "ppu-001": 0.001,
108
129
  "ppu-01": 0.01,
109
130
  "ppu-1": 0.1,
110
131
  "api-oss": 0.01,
@@ -1587,3 +1608,5 @@ if __name__ == '__main__':
1587
1608
  print([k for k in MODEL_RATIO if k.startswith('qwen3')] | xjoin(","))
1588
1609
 
1589
1610
  print([k for k in MODEL_RATIO if k.startswith(('deepseek', 'doubao', 'moon'))] | xjoin(","))
1611
+
1612
+ print(','.join(FAL))