MeUtils 2025.5.14.16.46.40__py3-none-any.whl → 2025.5.27.14.55.19__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.
Files changed (40) hide show
  1. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/METADATA +265 -265
  2. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/RECORD +39 -34
  3. examples/_openaisdk/openai_audio.py +13 -5
  4. examples/_openaisdk/openai_chatfire.py +5 -0
  5. meutils/ai_audio/asr/openai_asr.py +5 -5
  6. meutils/apis/dreamfaceapp/__init__.py +11 -0
  7. meutils/apis/dreamfaceapp/audios.py +31 -0
  8. meutils/apis/dreamfaceapp/images.py +110 -0
  9. meutils/apis/dreamfaceapp/videos.py +115 -0
  10. meutils/apis/fal/videos.py +1 -0
  11. meutils/apis/google/chat.py +3 -0
  12. meutils/apis/google/gemini_sdk.py +34 -0
  13. meutils/apis/hailuoai/images.py +8 -4
  14. meutils/apis/images/recraft.py +11 -8
  15. meutils/apis/jimeng/audio.py +19 -11
  16. meutils/apis/jimeng/doubao_images.py +70 -0
  17. meutils/apis/jimeng/doubao_utils.py +4 -4
  18. meutils/apis/jimeng/videos.py +2 -0
  19. meutils/apis/oneapi/channel.py +11 -7
  20. meutils/apis/oneapi/user.py +1 -1
  21. meutils/apis/siliconflow/videos.py +8 -15
  22. meutils/common.py +2 -1
  23. meutils/config_utils/lark_utils/common.py +4 -4
  24. meutils/data/VERSION +1 -1
  25. meutils/io/files_utils.py +5 -3
  26. meutils/io/openai_files.py +3 -2
  27. meutils/llm/completions/chat_spark.py +31 -13
  28. meutils/llm/completions/qwenllm.py +13 -14
  29. meutils/llm/completions/xx.py +3 -48
  30. meutils/llm/openai_polling/chat.py +2 -2
  31. meutils/office_automation/pdf.py +38 -2
  32. meutils/pipe.py +4 -1
  33. meutils/schemas/dreamfaceapp_types.py +12 -0
  34. meutils/schemas/oneapi/common.py +52 -22
  35. meutils/schemas/openai_types.py +5 -4
  36. meutils/apis/jimeng/doubao.py +0 -68
  37. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/LICENSE +0 -0
  38. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/WHEEL +0 -0
  39. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/entry_points.txt +0 -0
  40. {MeUtils-2025.5.14.16.46.40.dist-info → MeUtils-2025.5.27.14.55.19.dist-info}/top_level.txt +0 -0
@@ -34,7 +34,6 @@ base_url = "https://chat.qwen.ai/api"
34
34
  from fake_useragent import UserAgent
35
35
 
36
36
  ua = UserAgent()
37
- cookie="_gcl_au=1.1.1784604298.1740443944; cna=KP9DIEqqyjUCATrw/+LjJV8F; _bl_uid=LXmp28z7dwezpmyejeXL9wh6U1Rb; cnaui=310cbdaf-3754-461c-a3ff-9ec8005329c9; aui=310cbdaf-3754-461c-a3ff-9ec8005329c9; x-ap=ap-southeast-1; sca=43897cb0; xlly_s=1; acw_tc=0a03e56417472095089155840e4e574acbd40c39a21ce666c960987382db60; token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMGNiZGFmLTM3NTQtNDYxYy1hM2ZmLTllYzgwMDUzMjljOSIsImV4cCI6MTc0OTgwMTUxN30.nbaFZ52NvV-4H4ADG67PAjBIjrfKg6rASaIXpGNzotc; x5sec=7b22733b32223a2237386636303338646236626336396135222c227466652d636c6f75643b32223a223330376232663533623638383863316362363164373062363764313730306434434c75626b634547454f4c52737055424d4b66326e6133362f2f2f2f2f77453d227d; SERVERID=4e5d49f8b8c4de74d3e582effa08efe1|1747210060|1747192080; atpsida=c71f340a491f3cce3e3eac74_1747210060_3; tfstk=gDVmWYm8i0tBFWI-e7GfKQDSk3WRqjGslldtXfnNU0o7MlBjX8ca8kDtQtwYqcmrWZwOlflyz2ikgI71c70r8koZ3KkZaUo-J-eAhA5zz2ZL6Ck4s8OgRPNAlfQjGrGs_MId9R4blfapfz5Lsblr7qftuxJqGbWc57xO96Ubu8oYIx1L64q7w0oZ_xkw43oSJVuabAuya0gs7nuwgaboV2x2QfoqaQuiRfoabf7uz0gi_VrZ_fkW_DVaN7SWLnccpRYQ4qDmYro4kyFPlYJbW0Aw_72oBD5KqCRaZq4Rnoceg6mzHRPxaSSyXbzQeouot1YirJ4rgqq1OIG48zyZn5X9RcwuzJHuFEQjrS43s2DPZ3unK7PxG8jH9Dy775DzlMvIyRzLMRqAVCoYKzrop7KJ9bP0mSkoTgkDUpS5pCgPW7J6CxuSrDeV61GDG-hhDabkdtMqPqIdrav6kxuSrDQlrpTZ34gAv; isg=BMDAlP-3vKe5UE86-2l73onAkUiSSaQTo_fIsTpTDltitWrf7l0Ho-HDzR11BVzr; ssxmod_itna=iqGxRDuQqWqxgDUxeKYI5q=xBDeMDWK07DzxC5750CDmxjKidKDUGWubFP=eODglD2PbK9lY5D/f0GeDZDGKQDqx0ob0KjhitD9ehDw3HW8YRw3gzBTox63aTDo4QY=0DOldLLnzLtbDnne+DibDBKDnx4DjpuFDeeaDCeDQxirDD4DAlYD0cg+GDDd7KOpO4YYYt2+74GWG7YdGDGCc4Gtp/OA747PZtxDBr3DaOA31t4DExGO3q4d74Gacf+RDlIhDm4bbzZcDCKX53RQkSoAGA=rqWyDmjarmCHP4OWxY0cM9ahxNQDHe4Ti0K7DH3+tB4HRrtz5894DGRrArQeOdqA4dnkhkCKfCm7q1xNwQtkxxZGdGhdk0QgGNg75ZGNeGdumoQBxNisZGxKDzegx4D; ssxmod_itna2=iqGxRDuQqWqxgDUxeKYI5q=xBDeMDWK07DzxC5750CDmxjKidKDUGWubFP=eODglD2PbK9lGeDAYZGDqD9i8TP4DFgo4f4yQB2DDlaPrasYl/GSIjQlFhxcYO=09GcBzhgnDC7qCFh8PPOGCYBKQQQG1aacPaCHPoKKxyoeaR7vQKSWFpxuOl2g1n1OPYWKwAO0qz6O49xEaEomH=l54na7UyhApqGkvamKQ083kWacqL3hpRSYmV=QURgeFqTpNTF2WOpcHomFGf2fk0ajtWc3xtdLkYBn1xhakW6DqtRHaqs9jqvAv746sxIwPfuBwU2KI7o6xYv7ezBP27oyPfg=Q0xrllEuaQZ6oOjEtf6rhP/aY4FxvlPq85qjokrYAabgAfPKIR7DVPRRChzO5Vr5qAwMYPnmpy1Auj6t329ovh=Iixqga2==KhK24C6egt9nqLWRyaeDZvx=ExD=OZPv7AWK39UikaIQ7oCgATKIXW3DOpaZ5KgvY4=Utyf6uYINC=oho6xzAipN4TEBzn1OEZPhok6+pXVjhvAOv/AtMgv4njQEPr9=QiDuTgaUM456FQhz69aKBAn=m6e10OgbDZGHIGMOXPfDEU6qoLtOYozdXj5ynI=Y9DRcyojI52PfY/RO/SGFqYUBPhpAbhGQkDy0cQq5UyNSaRt6j5DTBr1HOfpjhemqVhtmYsK80TQbMp3Hw9BerDL2ix+klsArI6=TxCEiEmN0K4YxGhQ+S0KGBDmKrG6BdCYGiDmBkl5tAYbFeDwleHTTWh4BWQwkRKCGmP4AWZemD8i7EAW5WG7DmGSi+Iy3/GwHkj35D4lGf47eejxkxKxuE0DaBG0KkiI1DY4k0DbOKA5dD7lOzpz6PkO4lPfuKieqGb+v8qxmqMiNmw/hQRDBgztPxYrYDD"
38
37
 
39
38
  thinking_budget_mapping = {
40
39
  "low": 1000,
@@ -42,15 +41,19 @@ thinking_budget_mapping = {
42
41
  "high": 24000
43
42
  }
44
43
 
44
+ COOKIE = """
45
+ cna=KP9DIEqqyjUCATrw/+LjJV8F; _bl_uid=LXmp28z7dwezpmyejeXL9wh6U1Rb; cnaui=310cbdaf-3754-461c-a3ff-9ec8005329c9; aui=310cbdaf-3754-461c-a3ff-9ec8005329c9; x-ap=ap-southeast-1; sca=43897cb0; acw_tc=0a03e53417483123807755658e597c5e3685457054f2ca60a0a8d87b657874; _gcl_au=1.1.106229673.1748312382; xlly_s=1; token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMGNiZGFmLTM3NTQtNDYxYy1hM2ZmLTllYzgwMDUzMjljOSIsImV4cCI6MTc1MDkwNDU2MH0.nV7I1sp6rAE0QnqXYKNm4I0vLZmA-TdOKWEHg_37_tw; SERVERID=1e5b6792fa61468bae321990103ad502|1748312579|1748312380; atpsida=0450727e7c9d8a7299a0b2bd_1748312579_5; ssxmod_itna=iqGxRDuQqWqxgDUxeKYI5q=xBDeMDWK07DzxC5750CDmxjKidKDUGQN0bFP=jhWOGxDkYCA+UQSD0HPKmDA5DnGx7YDtr4FN4SeKhDwIa78YRwwHQiGoh=LTX90w=3qflZqcj1T3xoD==hYDmeDUxD1GDDkS0PDxOPD5xDTDWeDGDD3t4DCCfYYD0RpiboIVxRhTABpDYPYPR4YDY56DAqEz4SpVaxXTDDzw4iaPf4vwDi8D7FRG0RpD7P6fmQDXaYDEAWmFk=Dv6Lh+QwI1/oYOyyDc=DoCO0Km0DTVj2qPGGiU5eiBdnNC4490i+yte+in2MWYHDDW=4=5rzqDxKGe1qC+LimweRk5yxmLhdYY4KGYqOqIheUk5ZB5x2QgohQBxN7spmxFezNiDD; ssxmod_itna2=iqGxRDuQqWqxgDUxeKYI5q=xBDeMDWK07DzxC5750CDmxjKidKDUGQN0bFP=jhWOGxDkYCA+UQmDDpU3qY6obeDLWr7pfFyiDDsa7QaIhEVl4FKFerBUoQiRQlSzS+caiWpDOqz2HrsO6xFOwpKsSOYH0Q0WwhDs0Ye1mah+b99w34Im3AYwt4oztFoQ7xBhThYqatKQWcgkRDBDCOiLViK62z51rnpzpbHH7pFpS=Y4zfHiWfozYCf+9FcGmRMsMEYFGRP+TgG9EbEi3Khm0lQmt2AL=quK6RomKnFmmpjzYzxHQ/QEK0AAa3qGPOl3crGu7DDpQnxjfEEgWD/oEHaE4l6jOpKp6DI6P=vQa39gN6h5i3R5eInP2Gob9pY7DKDr3lYiTZrC3R2Yiz/rsFIG1j5n=2=DD3=obLGPQsWnOZWSinlZ=KjKGpIwRPKn3jpohCU+2PciIEehVxTSnioeIx6xdp91zK29tHtN2Zcgi0clGNaY4jIenYlnw+/Qlapjg6Qho=3E/2v3mIjaYygren01ebwPI4EKgDY+4NyiTXYmU+o/lGSogI=GT/38rPOnA5mjuDg2Ub=+HtTjKnpYoEaTvwj3K0GI7FKARVAv=Wojxe0nHRBwhrQIa1vMpv5pfQ8LGCXGp=lZ3Q8v+6=lSfexroPjNP9MvyNVAXQhnKvyAwT/KEsgh/eOdqx0YiHaP1kwxzsu54i4eGiQDshEOQoiRlPBqiDiSRDQay2k1x4xWDhpBTjqZ0Neer0qlDK0YbDpBYKxSGDD; tfstk=gy8S5jal7pL47z_LOgc4laG38cQQOjuaeW1psBUz9aQRdW9e6MCzzbxBcpJ5eU7-ZoUBQpYrZMdRRipBCgUKqMCvlpJBzkd82-QvQ1KUpv4LH-C1yMxPLTWCRBvsgAuZ7QAl-akZQVyg4ccA76BdpJPAkw5IYeMoXQAl-SDk9fRkZW1NLUsRJpQAD1CRJkB8yjsAs1bLyMU8D-BcHwCdvTQAk61dpkIJpIhfttBdJgpdkj1n_yV1O06kNbzD-uH4ifA5hyUplsHhpQig5_8lNgW9wUwzUXf5VOdRhAjyDMIBFgTqPRfWDC9PNp0graIB2hQJRAg5kCx2es9KCk6vfUYCbUM_jTLlKd_JcxU5JaK95wQIf7f2PILGAUD7kT9DMh7kWx4BBIRwriYIC-BH41bANnGLDTId4azNCak3ASsgRs6ZGjZ3xSw1l2pVr0vc2sf50jGbeHjRis1mGjZ3xgCcN_GjG8Kh.; isg=BOrqXB6_dpCyTPX0tTuBOG9yO1aMW261hQXS_3ShLD3Op4xhWOtyxWGRN9O7V-ZN
46
+ """.strip()
47
+
45
48
 
46
49
  @retrying()
47
- async def to_file(file, api_key):
50
+ async def to_file(file, api_key, cookie: Optional[str] = None):
48
51
  qwen_client = AsyncOpenAI(
49
52
  base_url="https://all.chatfire.cn/qwen/v1",
50
53
  api_key=api_key,
51
54
  default_headers={
52
55
  'User-Agent': ua.random,
53
- 'Cookie': cookie
56
+ 'Cookie': cookie or COOKIE
54
57
  }
55
58
  )
56
59
  filename = Path(file).name if isinstance(file, str) else 'untitled'
@@ -62,7 +65,8 @@ async def to_file(file, api_key):
62
65
  return file_object
63
66
 
64
67
 
65
- async def create(request: CompletionRequest, token: Optional[str] = None): # ChatCompletionRequest 重构
68
+ async def create(request: CompletionRequest, token: Optional[str] = None, cookie: Optional[str] = None):
69
+ cookie = cookie or COOKIE
66
70
 
67
71
  if request.temperature > 1:
68
72
  request.temperature = 1
@@ -77,9 +81,6 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
77
81
  default_headers={
78
82
  'User-Agent': ua.random,
79
83
  'Cookie': cookie,
80
- "bx-v": "2.5.28",
81
- "bx-umidtoken": "T2gAeo1Mqj6q05L65Ro3Hjf9KHuOsB63ttVeMP_-13M2-R82AvHnHe-o9nAbz7J8Si4=",
82
- "x-request-id": "08cb2785-53d2-4c6d-a24c-069cf0303d1a"
83
84
  }
84
85
  )
85
86
  # qwen结构
@@ -118,13 +119,13 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
118
119
  for i, content in enumerate(user_content):
119
120
  if content.get("type") == 'file_url': # image_url file_url video_url
120
121
  url = content.get(content.get("type")).get("url")
121
- file_object = await to_file(url, token)
122
+ file_object = await to_file(url, token, cookie)
122
123
 
123
124
  user_content[i] = {"type": "file", "file": file_object.id}
124
125
 
125
126
  elif content.get("type") == 'image_url':
126
127
  url = content.get(content.get("type")).get("url")
127
- file_object = await to_file(url, token)
128
+ file_object = await to_file(url, token, cookie)
128
129
 
129
130
  user_content[i] = {"type": "image", "image": file_object.id}
130
131
 
@@ -133,7 +134,7 @@ async def create(request: CompletionRequest, token: Optional[str] = None): # Ch
133
134
 
134
135
  user_content = [{"type": "text", "text": user_content}]
135
136
 
136
- file_object = await to_file(file_url, token)
137
+ file_object = await to_file(file_url, token, cookie)
137
138
 
138
139
  content_type = file_object.meta.get("content_type", "")
139
140
  if content_type.startswith("image"):
@@ -260,11 +261,11 @@ if __name__ == '__main__':
260
261
  'role': 'user',
261
262
  # 'content': '今天南京天气',
262
263
  # 'content': "9.8 9.11哪个大",
263
- # 'content': 'https://oss.ffire.cc/files/AIGC.pdf 总结下',
264
+ 'content': 'https://oss.ffire.cc/files/AIGC.pdf 总结下',
264
265
 
265
266
  # "chat_type": "search",
266
267
 
267
- 'content': user_content,
268
+ # 'content': user_content,
268
269
 
269
270
  # "content": [
270
271
  # {
@@ -330,8 +331,6 @@ if __name__ == '__main__':
330
331
 
331
332
  token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjMxMGNiZGFmLTM3NTQtNDYxYy1hM2ZmLTllYzgwMDUzMjljOSIsImV4cCI6MTc0ODQ3OTE0M30.oAIE1K0XA0YYqlxB8Su-u0UJbY_BBZa4_tvZpFJKxGY"
332
333
 
333
- # token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwNzY1N2Y1LTgxN2ItNDg5Yi1iNjk4LWFhZjAyM2EwZTE4MyIsImV4cCI6MTc0NjI5NTAwNH0.D1uJN44NHiEt6URce4upbHvs7v73_Vd0V1s3T_JzclI"
334
334
  arun(create(request, token))
335
- # token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEwNzY1N2Y1LTgxN2ItNDg5Yi1iNjk4LWFhZjAyM2EwZTE4MyIsImV4cCI6MTc0NjI5NTAwNH0.D1uJN44NHiEt6URce4upbHvs7v73_Vd0V1s3T_JzclI"
336
335
 
337
336
  # arun(to_file("https://oss.ffire.cc/files/kling_watermark.png", token))
@@ -10,52 +10,7 @@
10
10
 
11
11
  from meutils.pipe import *
12
12
 
13
- # ResponseT = TypeVar(
14
- # "ResponseT",
15
- # bound=Union[
16
- # object,
17
- # str,
18
- # None,
19
- # "BaseModel",
20
- # List[Any],
21
- # Dict[str, Any],
22
- # Response,
23
- # ModelBuilderProtocol,
24
- # "APIResponse[Any]",
25
- # "AsyncAPIResponse[Any]",
26
- # "HttpxBinaryResponseContent",
27
- # ],
28
- # )
29
-
30
- payload = {
31
- "messages": [
32
- {
33
- "role": "user",
34
- "content": "hi"
35
- }
36
- ],
37
- "use_search": False,
38
- "extend": {
39
- "sidebar": True
40
- },
41
- "kimiplus_id": "kimi",
42
- "use_research": False,
43
- "use_math": False,
44
- "refs": [],
45
- "refs_file": []
46
- }
47
-
48
- from openai import OpenAI
49
-
50
- client = OpenAI(
51
- base_url="https://kimi.moonshot.cn",
52
- api_key="eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ1c2VyLWNlbnRlciIsImV4cCI6MTczOTY4NDk3NywiaWF0IjoxNzMxOTA4OTc3LCJqdGkiOiJjc3RkYXNmZDBwODBpaGtkNTY4ZyIsInR5cCI6ImFjY2VzcyIsImFwcF9pZCI6ImtpbWkiLCJzdWIiOiJja2kwOTRiM2Flc2xnbGo2Zm8zMCIsInNwYWNlX2lkIjoiY2tpMDk0YjNhZXNsZ2xqNmZvMmciLCJhYnN0cmFjdF91c2VyX2lkIjoiY2tpMDk0YjNhZXNsZ2xqNmZvMzAifQ.uhEQ3sB6SJLR_Duuu4w-WilRsvllI611flQ_uQoI5ufm_GWtLLJfHZ8rE9-RS2YtkprtYovvEf1U1E6ybcL1Jg"
13
+ # from meutils.apis
14
+ r = storage_to_cookie(
15
+ "cookies.json"
53
16
  )
54
- # "https://kimi.moonshot.cn/api/chat/ctb5lpaflk1f1dda5mv0/completion/stream"
55
- resp = client.post(
56
- "/api/chat/ctb5lpaflk1f1dda5mv0/completion/stream",
57
- cast_to=object,
58
- body=payload,
59
- stream=True
60
- )
61
-
@@ -72,7 +72,7 @@ class Completions(object):
72
72
  self.client = zhipuai_client
73
73
 
74
74
  elif "deepseek-r" in request.model:
75
- request.separate_reasoning = True
75
+ request.separate_reasoning = True # pp
76
76
  ###########################################################################
77
77
 
78
78
  data = to_openai_params(request)
@@ -82,7 +82,7 @@ class Completions(object):
82
82
  data.pop("frequency_penalty", None)
83
83
  data.pop("extra_body", None)
84
84
 
85
- if not request.reasoning_effort: # 默认关闭思考
85
+ if '2.5' in request.model and not request.reasoning_effort: # 默认关闭思考
86
86
  data['reasoning_effort'] = "none"
87
87
 
88
88
  if "thinking" in request.model:
@@ -56,10 +56,46 @@ def doc2text(filename):
56
56
  pass
57
57
 
58
58
 
59
+ def extract_images_from_pdf(file, output: Optional[str] = None):
60
+ import fitz
61
+
62
+ # 打开PDF文件
63
+
64
+ pdf_document = fitz.open(file)
65
+
66
+ # 遍历每一页
67
+
68
+ for page_number in range(pdf_document.page_count):
69
+
70
+ page = pdf_document.load_page(page_number)
71
+
72
+ image_list = page.get_images(full=True)
73
+
74
+ # 遍历每个图像
75
+
76
+ for image_index, img in enumerate(image_list):
77
+ xref = img[0]
78
+
79
+ base_image = pdf_document.extract_image(xref)
80
+
81
+ image_bytes = base_image["image"]
82
+
83
+ image_ext = base_image["ext"]
84
+
85
+ image_filename = f"{output or ''}/image{page_number + 1}_{image_index + 1}.{image_ext}"
86
+ Path(image_filename).parent.mkdir(parents=True, exist_ok=True)
87
+
88
+ # 将图像写入文件
89
+
90
+ with open(image_filename, "wb") as image_file:
91
+ image_file.write(image_bytes)
92
+
93
+
59
94
  if __name__ == '__main__':
60
95
  with timer():
61
- r = extract_text('x.pdf')
96
+ # r = extract_text('x.pdf')
62
97
 
98
+ r = extract_images_from_pdf('《锋利的jQuery》(高清扫描版-有书签)_副本_加水印.pdf', 'images')
63
99
 
64
100
  # import tiktoken
65
- # print(tiktoken.encoding_for_model('gpt-3.5-turbo'))
101
+ # print(tiktoken.encoding_for_model('gpt-3.5-turbo'))
meutils/pipe.py CHANGED
@@ -390,4 +390,7 @@ data: [DONE]"""
390
390
 
391
391
  # print()
392
392
 
393
- sse.splitlines() | xsse_parser(skip_strings=['DONE', 'TRACEID']) | xprint
393
+ # sse.splitlines() | xsse_parser(skip_strings=['DONE', 'TRACEID']) | xprint
394
+
395
+
396
+ a = [[{"a":1}]] | xgroup(2)
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Project : AI. @by PyCharm
4
+ # @File : dreamfaceapp_types
5
+ # @Time : 2025/5/23 13:42
6
+ # @Author : betterme
7
+ # @WeChat : meutils
8
+ # @Software : PyCharm
9
+ # @Description :
10
+
11
+ from meutils.pipe import *
12
+
@@ -66,8 +66,6 @@ MODEL_PRICE = {
66
66
  "minimax_video-01": MINIMAX_VIDEO,
67
67
  "minimax_video-01-live2d": MINIMAX_VIDEO,
68
68
 
69
- # free
70
-
71
69
  # chatfire
72
70
  "ppu-0001": 0.0001,
73
71
  "ppu-001": 0.001,
@@ -93,10 +91,12 @@ MODEL_PRICE = {
93
91
  "api-kolors-virtual-try-on": 0.1,
94
92
  "official-api-kolors-virtual-try-on": 0.8,
95
93
 
96
- # 语音克隆
94
+ # audio 语音克隆
97
95
  "official-api-fish-model": 0.1,
98
96
  "official-api-fish-tts": 0.01,
99
97
 
98
+ "tts-pro": 0.03,
99
+
100
100
  # 官方api
101
101
  "official-api-cogvideox": 0.1,
102
102
  "official-api-kling-image": 0.02,
@@ -179,6 +179,7 @@ MODEL_PRICE = {
179
179
  "flux-pro": 0.05,
180
180
  "flux-pro-max": 0.1,
181
181
  "flux.1.1-pro": 0.1,
182
+ "flux1.1-pro": 0.1,
182
183
  "black-forest-labs/flux.1.1-pro": 0.1,
183
184
 
184
185
  "step-1x-medium": 0.2,
@@ -412,9 +413,6 @@ MODEL_RATIO = {
412
413
  'baichuan3-turbo-128k': 12,
413
414
  'baichuan2-turbo': 4,
414
415
 
415
- "claude-3-5-haiku-20241022": 0.5,
416
- "anthropic/claude-3-5-haiku-20241022:beta": 0.5,
417
-
418
416
  # grok
419
417
  "grok-2": 1,
420
418
  "grok-2-1212": 1,
@@ -506,6 +504,7 @@ MODEL_RATIO = {
506
504
  "qwen3-32b": 1,
507
505
  "qwen3-30b-a3b": 0.75,
508
506
  "qwen3-235b-a22b": 2,
507
+ "qwen-math-plus": 2,
509
508
 
510
509
  "qwq-32b": 1,
511
510
  "qwq-plus": 0.8,
@@ -663,10 +662,13 @@ MODEL_RATIO = {
663
662
  "doubao-1-5-pro-thinking": 2,
664
663
 
665
664
  "doubao-1-5-vision-thinking": 2,
665
+ "doubao-1-5-thinking-vision-pro-250428": 1.5,
666
+
666
667
  "doubao-1-5-thinking-pro-250415": 2,
667
668
  "doubao-1-5-thinking-pro-vision": 2,
668
669
  "doubao-1-5-thinking-pro-vision-250415": 2,
669
670
  "doubao-1-5-thinking-pro-m-250415": 2,
671
+ "doubao-1-5-thinking-pro-m-250428": 2,
670
672
 
671
673
  # 商汤 https://platform.sensenova.cn/pricing
672
674
  # https://platform.sensenova.cn/doc?path=/pricingdoc/pricing.md
@@ -708,6 +710,11 @@ MODEL_RATIO = {
708
710
  "tts-1-hd-1106": 15,
709
711
  "whisper-1": 15,
710
712
 
713
+ # claude
714
+
715
+ "claude-3-5-haiku-20241022": 0.5,
716
+ "anthropic/claude-3-5-haiku-20241022:beta": 0.5,
717
+
711
718
  "claude-3-haiku-20240307": 0.125,
712
719
  "claude-3-sonnet-20240229": 1.5,
713
720
 
@@ -727,6 +734,11 @@ MODEL_RATIO = {
727
734
 
728
735
  "claude-3-7-sonnet-20250219": 1.5,
729
736
 
737
+ "claude-sonnet-4-20250514": 1.5,
738
+ "claude-sonnet-4-20250514-thinking": 1.5,
739
+ "claude-opus-4-20250514": 7.5,
740
+ "claude-opus-4-20250514-thinking": 7.5,
741
+
730
742
  "deepclaude": 1.5,
731
743
  "deep-claude": 1.5,
732
744
 
@@ -770,6 +782,7 @@ MODEL_RATIO = {
770
782
  "gemini-2.0-flash-thinking-exp-01-21": 0.075,
771
783
 
772
784
  "gemini-2.5-flash-preview-04-17": 0.075,
785
+ "gemini-2.5-flash-preview-05-20": 0.075,
773
786
 
774
787
  "gemini-2.0-pro": 0.625,
775
788
  "gemini-2.0-pro-exp": 0.625,
@@ -789,13 +802,14 @@ MODEL_RATIO = {
789
802
  "gemini-pro-vision": 1,
790
803
  "gemini-ultra": 1,
791
804
 
792
- "gemini-2.5-flash-thinking": 0.15,
793
- "gemini-2.5-flash-preview-04-17-thinking": 0.15 * 2,
794
- "gemini-2.5-pro-thinking": 0.625 * 2,
795
- "gemini-2.5-pro-exp-03-25-thinking": 0.625 * 2,
796
- "gemini-2.5-pro-preview-03-25-thinking": 0.625 * 2,
805
+ "gemini-2.5-flash-thinking": 0.075,
806
+ "gemini-2.5-flash-preview-04-17-thinking": 0.075,
807
+ "gemini-2.5-flash-preview-05-20-thinking": 0.075,
808
+ "gemini-2.5-pro-thinking": 0.625,
809
+ "gemini-2.5-pro-exp-03-25-thinking": 0.625,
810
+ "gemini-2.5-pro-preview-03-25-thinking": 0.625,
797
811
 
798
- "gemini-thinking": 0.625 * 2, # 逆向
812
+ "gemini-thinking": 0.625, # 逆向
799
813
 
800
814
  "gpt-3.5-turbo": 0.75,
801
815
  "gpt-3.5-turbo-0125": 0.25,
@@ -830,6 +844,7 @@ MODEL_RATIO = {
830
844
  "gpt-4o-all": 2.5, # 逆向
831
845
  "gpt-4o-2024-05-13": 1.25,
832
846
  "gpt-4o-mini": 0.075,
847
+ "gpt-4o-mini-tts": 0.3,
833
848
  "gpt-4o-mini-2024-07-18": 0.075,
834
849
  "gpt-4o-2024-08-06": 1.25,
835
850
  "gpt-4o-2024-11-20": 1.25,
@@ -875,6 +890,8 @@ MODEL_RATIO = {
875
890
  "llama-3.1-8b-instant": 0.01,
876
891
  "llama-3.1-70b-versatile": 3,
877
892
 
893
+ "llama-vision": 0.1,
894
+
878
895
  # sili
879
896
  "gemma2-9b-it": 0.1,
880
897
  "gemma2-27b-it": 0.5,
@@ -947,9 +964,6 @@ COMPLETION_RATIO = {
947
964
  "grok-3-mini-beta": 5 / 3,
948
965
  "grok-3-mini-fast-beta": 4 / 0.6,
949
966
 
950
- "claude-3-5-haiku-20241022": 5,
951
- "anthropic/claude-3-5-haiku-20241022:beta": 5,
952
-
953
967
  "gpt-4-all": 4,
954
968
  "gpt-4-gizmo-*": 4,
955
969
  "gpt-4o-all": 4,
@@ -967,6 +981,7 @@ COMPLETION_RATIO = {
967
981
  "gpt-4o-2024-11-20": 4,
968
982
 
969
983
  "gpt-4o-mini-audio-preview": 4,
984
+ "gpt-4o-mini-tts": 20,
970
985
 
971
986
  "gpt-4o-audio-preview": 4,
972
987
  "gpt-4o-audio-preview-2024-12-17": 4,
@@ -981,6 +996,9 @@ COMPLETION_RATIO = {
981
996
  "gpt-image-1": 8,
982
997
 
983
998
  # claude
999
+ "claude-3-5-haiku-20241022": 5,
1000
+ "anthropic/claude-3-5-haiku-20241022:beta": 5,
1001
+
984
1002
  "claude-3-opus-20240229": 5,
985
1003
  "anthropic/claude-3-opus:beta": 5, # openrouter
986
1004
 
@@ -992,6 +1010,11 @@ COMPLETION_RATIO = {
992
1010
  "claude-3-7-sonnet-20250219": 5,
993
1011
  "claude-3-7-sonnet-latest-thinking": 5,
994
1012
 
1013
+ "claude-sonnet-4-20250514": 5,
1014
+ "claude-sonnet-4-20250514-thinking": 5,
1015
+ "claude-opus-4-20250514": 5,
1016
+ "claude-opus-4-20250514-thinking": 5,
1017
+
995
1018
  "llama-3.1-70b-instruct": 2,
996
1019
  "meta-llama/Meta-Llama-3.1-70B-Instruct": 2,
997
1020
 
@@ -1003,6 +1026,8 @@ COMPLETION_RATIO = {
1003
1026
 
1004
1027
  "llama-3.3-70b-instruct": 4,
1005
1028
 
1029
+ "llama-vision": 4,
1030
+
1006
1031
  "command": 4,
1007
1032
  "command-light": 4,
1008
1033
  "command-light-nightly": 4,
@@ -1053,11 +1078,13 @@ COMPLETION_RATIO = {
1053
1078
  "gemma2-27b-it": 4,
1054
1079
  "google/gemma-3-27b-it": 4,
1055
1080
  # thinking
1056
- "gemini-2.5-flash-thinking": 8,
1057
- "gemini-2.5-flash-preview-04-17-thinking": 8,
1058
- "gemini-2.5-pro-thinking": 8,
1059
- "gemini-2.5-pro-exp-03-25-thinking": 8,
1060
- "gemini-2.5-pro-preview-03-25-thinking": 8,
1081
+ "gemini-2.5-flash-thinking": 23,
1082
+ "gemini-2.5-flash-preview-04-17-thinking": 23,
1083
+ "gemini-2.5-flash-preview-05-20-thinking": 23,
1084
+
1085
+ "gemini-2.5-pro-thinking": 23,
1086
+ "gemini-2.5-pro-exp-03-25-thinking": 23,
1087
+ "gemini-2.5-pro-preview-03-25-thinking": 23,
1061
1088
 
1062
1089
  "hunyuan-a52b-instruct": 5,
1063
1090
  "qwen2.5-coder-32b-instruct": 3,
@@ -1092,6 +1119,7 @@ COMPLETION_RATIO = {
1092
1119
  "qwq-max-search": 4,
1093
1120
  "qwen-max-search": 4,
1094
1121
  "qvq-max-2025-03-25": 4,
1122
+ "qwen-math-plus": 3,
1095
1123
 
1096
1124
  "qwen2.5-7b-instruct": 4,
1097
1125
  "qwen2.5-14b-instruct": 4,
@@ -1149,6 +1177,9 @@ COMPLETION_RATIO = {
1149
1177
  "doubao-1-5-thinking-pro-vision": 4,
1150
1178
  "doubao-1-5-thinking-pro-vision-250415": 4,
1151
1179
  "doubao-1-5-thinking-pro-m-250415": 4,
1180
+ "doubao-1-5-thinking-pro-m-250428": 4,
1181
+
1182
+ "doubao-1-5-thinking-vision-pro-250428": 3,
1152
1183
 
1153
1184
  "deepseek-prover-v2-671b": 4,
1154
1185
  "deepseek-r1:1.5b": 4,
@@ -1365,8 +1396,7 @@ REDIRECT_MODEL = {
1365
1396
  "todo": "gpt-4-vision-preview",
1366
1397
 
1367
1398
  # https://chat.tune.app/api/models
1368
- "claude-3-haiku-20240307": "anthropic/claude-3-haiku",
1369
- "claude-3-5-sonnet-20240620": "anthropic/claude-3.5-sonnet",
1399
+
1370
1400
  "gpt-4o": "openai/gpt-4o",
1371
1401
  "gpt-4o-mini": "openai/gpt-4o-mini",
1372
1402
  "mistral-large": "mistral/mistral-large",
@@ -426,16 +426,17 @@ class ImagesResponse(_ImagesResponse):
426
426
 
427
427
 
428
428
  class TTSRequest(BaseModel):
429
- input: str
430
429
  model: Optional[Union[str, Literal["tts-1", "tts-1-hd"]]] = 'tts'
431
430
  voice: Optional[Union[str, Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"]]] = ""
431
+
432
+ input: str
433
+ instructions: Optional[str] = None
434
+ # emotion: Optional[Literal["happy", "angry", "surprise", "coldness", "disgust", "fear", "excited", "hate"]] = None
435
+
432
436
  speed: Optional[float] = None
433
437
 
434
438
  response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm", "url"] = "mp3"
435
439
 
436
- # 新增
437
- emotion: Optional[Literal["happy", "angry", "surprise", "coldness", "disgust", "fear", "excited", "hate"]] = None
438
-
439
440
  class Config:
440
441
  json_schema_extra = {
441
442
  "examples": [
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- # @Project : AI. @by PyCharm
4
- # @File : images
5
- # @Time : 2024/12/16 17:46
6
- # @Author : betterme
7
- # @WeChat : meutils
8
- # @Software : PyCharm
9
- # @Description :
10
-
11
- from openai import AsyncClient
12
- from meutils.pipe import *
13
- from meutils.apis.jimeng.doubao_utils import generate_cookie
14
-
15
- from meutils.schemas.image_types import ImageRequest
16
-
17
- from meutils.schemas.jimeng_types import BASE_URL, MODELS_MAP, FEISHU_URL
18
- from meutils.apis.jimeng.common import create_draft_content, get_headers, check_token
19
- from meutils.config_utils.lark_utils import get_next_token_for_polling
20
-
21
-
22
- async def create_():
23
- headers = {
24
- 'agw-js-conv': 'str',
25
- 'Cookie': 's_v_web_id=verify_m4t9wrdc_qgbhUw0z_07iP_4GFV_8HA7_6jr0e9lLCqQO; passport_csrf_token=8a8aa82fa109ecb3cb25e7afa10de214; passport_csrf_token_default=8a8aa82fa109ecb3cb25e7afa10de214; oauth_token=e45378cb-5afd-4495-88f5-58440e321b48; n_mh=lG4jjJNpPRqpnflIMXQoPMflNZdP31M8fFqgdR9Id5g; uid_tt=1a11a8af13cf1c878482fa862287107c; uid_tt_ss=1a11a8af13cf1c878482fa862287107c; sid_tt=de2215a7bb8e442774cf388f03fac84c; sessionid=de2215a7bb8e442774cf388f03fac84c; sessionid_ss=de2215a7bb8e442774cf388f03fac84c; is_staff_user=false; store-region=cn-js; store-region-src=uid; odin_tt=774fcc6d25d5259fd2af19858e0518c64943eb788718658b403ad8eb13ebbc6ebcb4c42620e87a48b2efb45fe78dc163b82399750898bb201c89f324b9e25b94; passport_auth_status=042935fbff60617ac0735d3ba4cfb559%2C7c535e1ccd98b367728b6560feb66a2e; passport_auth_status_ss=042935fbff60617ac0735d3ba4cfb559%2C7c535e1ccd98b367728b6560feb66a2e; sid_guard=de2215a7bb8e442774cf388f03fac84c%7C1734489199%7C5184000%7CSun%2C+16-Feb-2025+02%3A33%3A19+GMT; sid_ucp_v1=1.0.0-KGQyN2NlYjIxNTA1NTc3ZjI3NWQ2MjZkY2FhNGM3MGM0NzdkNGVjZDMKHwjAreC708zWBBDv6Ii7BhjCsR4gDDDn782qBjgIQCYaAmxxIiBkZTIyMTVhN2JiOGU0NDI3NzRjZjM4OGYwM2ZhYzg0Yw; ssid_ucp_v1=1.0.0-KGQyN2NlYjIxNTA1NTc3ZjI3NWQ2MjZkY2FhNGM3MGM0NzdkNGVjZDMKHwjAreC708zWBBDv6Ii7BhjCsR4gDDDn782qBjgIQCYaAmxxIiBkZTIyMTVhN2JiOGU0NDI3NzRjZjM4OGYwM2ZhYzg0Yw; ttwid=1%7C4rAQ216JOophOdIJRX4cHa6E8FSBjbjqHCKmFCNrQuc%7C1734510550%7C6217dce55189d102c393a4de7022e9ee2e2fa75f211108551b349a0a04532921; passport_fe_beating_status=true; tt_scid=b.csKGNI6QALEo8gG9vJu3nCfptGnLkTxVXPX.wNPQ0q9PaXuKzXfuFQC0i2U7gVa974; gd_random_1831913=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; gd_random_1525008=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; gd_random_1831904=eyJtYXRjaCI6ZmFsc2UsInBlcmNlbnQiOjAuMjIzMzcxMDAwNzk1MzUxNzd9.NuOx3z2e4BUOJrwTMG9F3lxrnhmz9jNR6BrhQYU4BhI; msToken=enism5q1i_XLtL8VKKjkjidcvGhyW0U3EGJBI19P3fyqk8NsW4fXW4g8s4TnlgRaF-aWS0kHrmNnENw5L4mFRyyz6A5yZbpR3nCRYJrvBi3-GrtptyOBhznILSv4OO0',
26
- 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
27
- 'content-type': 'application/json'
28
- }
29
- payload = {
30
- "messages": [
31
- {
32
- "content": "{\"text\":\"颜色反转\"}",
33
- "content_type": 2009,
34
- "attachments": [
35
- {
36
- "type": "image",
37
- "key": "tos-cn-i-a9rns2rl98/b87240eb828f43f8a87952e8246f2143.png",
38
- "extra": {
39
- "refer_types": "style"
40
- },
41
- "identifier": "2c4b5ab0-bd1a-11ef-b0b0-d38662f7353b"
42
- }
43
- ]
44
- }
45
- ],
46
- "completion_option": {
47
- "is_regen": False,
48
- "with_suggest": False,
49
- "need_create_conversation": False,
50
- "launch_stage": 1,
51
- "is_replace": False,
52
- "is_delete": False,
53
- "message_from": 0,
54
- "event_id": "0"
55
- },
56
- "section_id": "533682637787650",
57
- "conversation_id": "533682637787394",
58
- "local_message_id": "71ee47b0-bd1c-11ef-b0b0-d38662f7353b"
59
- }
60
-
61
- client = AsyncClient(base_url="https://www.doubao.com/samantha", default_headers=headers, api_key='xx')
62
- response = await client.post("/chat/completion", body=payload, cast_to=object, stream=True)
63
- for i in response:
64
- print(i)
65
- # return response
66
-
67
- if __name__ == '__main__':
68
- arun(create())