From a5d06c80854caedd5287eaa727d5fea4f50836b5 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 8 Jul 2026 17:07:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=B7=E5=85=83=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=AE=9A=E4=BB=B7=E6=94=B9=E4=B8=BA=E8=85=BE=E8=AE=AF=E5=AE=98?= =?UTF-8?q?=E6=96=B9(hy3/vision/image/video)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/hunyuan_models_migration.sql | 63 +++++++++++++++------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/scripts/hunyuan_models_migration.sql b/scripts/hunyuan_models_migration.sql index 208073d2..bb70d016 100644 --- a/scripts/hunyuan_models_migration.sql +++ b/scripts/hunyuan_models_migration.sql @@ -8,76 +8,79 @@ -- 4. hy-video-1.5-i2v — HY Video 1.5 I2V (图生视频) -- 5. hy-video-1.5-t2v — HY Video 1.5 T2V (文生视频) -- +-- 定价来源: 腾讯官方文档 https://cloud.tencent.com/document/product/1823/130080 -- Provider: 腾讯 (wNME9nrITooowlmCuR_XB) -- Upapp: hunyun (5QXZ-AMP0K0NrcpZiTomA, baseurl: https://tokenhub.tencentmaas.com/v1) --- 端点: OpenAI 兼容 /v1/chat/completions -- ============================================================ -- ===================== Part 1: llm ===================== INSERT INTO llm (id,name,model,description,iconid,upappid,providerid,ownerid,enabled_date,expired_date,min_balance,status) VALUES ('llm_hunyuan_hy3','hy3','hy3','混元 Hy3 — 旗舰对话模型,295B参数,128K上下文',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), ('llm_hunyuan_vision2','hy-vision-2.0-instruct','hy-vision-2.0-instruct','HY-Vision 2.0 — 视觉理解模型,406B参数',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), -('llm_hunyuan_image3','hy-image-3.0-plus','hy-image-3.0-plus','HY Image 3.0 Plus — 文生图模型',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), -('llm_hunyuan_video_i2v','hy-video-1.5-i2v','hy-video-1.5-i2v','HY Video 1.5 I2V — 图生视频模型',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), -('llm_hunyuan_video_t2v','hy-video-1.5-t2v','hy-video-1.5-t2v','HY Video 1.5 T2V — 文生视频模型',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published') +('llm_hunyuan_image3','hy-image-3.0-plus','hy-image-v3.0','HY Image 3.0 Plus — 文生图模型',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), +('llm_hunyuan_video_i2v','hy-video-1.5-i2v','hy-video-1.5','HY Video 1.5 — 图生视频',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published'), +('llm_hunyuan_video_t2v','hy-video-1.5-t2v','hy-video-1.5','HY Video 1.5 — 文生视频',NULL,'5QXZ-AMP0K0NrcpZiTomA','wNME9nrITooowlmCuR_XB','0','2025-01-01','2099-12-31',0.00,'published') ON DUPLICATE KEY UPDATE model=VALUES(model), description=VALUES(description); -- ===================== Part 2: llm_api_map ===================== INSERT INTO llm_api_map (id,llmid,llmcatelogid,apiname,query_apiname,query_period,ppid,isdefaultcatelog) VALUES ('map_hunyuan_hy3','llm_hunyuan_hy3','t2t','t2t',NULL,NULL,'pp_hunyuan_hy3','1'), ('map_hunyuan_vision2','llm_hunyuan_vision2','vision','ti2t',NULL,NULL,'pp_hunyuan_vision2','1'), -('map_hunyuan_image3','llm_hunyuan_image3','t2i','t2t',NULL,NULL,'pp_hunyuan_image3','1'), +('map_hunyuan_image3','llm_hunyuan_image3','t2i','hunyuan-image-tokenhub',NULL,NULL,'pp_hunyuan_image3','1'), ('map_hunyuan_video_i2v','llm_hunyuan_video_i2v','t2v','t2t',NULL,NULL,'pp_hunyuan_video_i2v','1'), ('map_hunyuan_video_t2v','llm_hunyuan_video_t2v','t2v','t2t',NULL,NULL,'pp_hunyuan_video_t2v','1') ON DUPLICATE KEY UPDATE apiname=VALUES(apiname), ppid=VALUES(ppid); -- ===================== Part 3: uapiio ===================== INSERT INTO uapiio (id,name,description,input_fields) VALUES -('hunyuan_chat_io','混元文本对话','文本对话输入输出','{"prompt":{"type":"string","required":true,"description":"用户输入文本"},"sys_prompt":{"type":"string","required":false,"description":"系统提示词"},"image_file":{"type":"string","required":false,"description":"图像URL(多模态)"},"max_tokens":{"type":"integer","required":false,"default":1024,"description":"最大输出token数"},"stream":{"type":"boolean","required":false,"description":"流式输出"}}'), -('hunyuan_vision_io','混元视觉理解','视觉理解输入输出','{"prompt":{"type":"string","required":true,"description":"用户输入文本"},"image_file":{"type":"string","required":true,"description":"图像URL"},"sys_prompt":{"type":"string","required":false,"description":"系统提示词"},"max_tokens":{"type":"integer","required":false,"default":1024,"description":"最大输出token数"}}'), -('hunyuan_image_io','混元图像生成','文生图输入输出','{"prompt":{"type":"string","required":true,"description":"图像描述文本"},"size":{"type":"string","required":false,"default":"1024x1024","description":"图像尺寸"},"n":{"type":"integer","required":false,"default":1,"description":"生成数量"}}'), -('hunyuan_video_i2v_io','混元图生视频','图生视频输入输出','{"image_file":{"type":"string","required":true,"description":"输入图像URL"},"prompt":{"type":"string","required":false,"description":"视频描述文本"},"duration":{"type":"integer","required":false,"default":5,"description":"视频时长(秒)"},"resolution":{"type":"string","required":false,"default":"720P","description":"分辨率"}}'), -('hunyuan_video_t2v_io','混元文生视频','文生视频输入输出','{"prompt":{"type":"string","required":true,"description":"视频描述文本"},"duration":{"type":"integer","required":false,"default":5,"description":"视频时长(秒)"},"resolution":{"type":"string","required":false,"default":"720P","description":"分辨率"}}') +('hunyuan_chat_io','混元文本对话','文本对话输入输出','[{"name":"prompt","label":"用户输入","uitype":"text","required":true},{"name":"sys_prompt","label":"系统提示词","uitype":"text","required":false},{"name":"image_file","label":"图像URL","uitype":"image","required":false},{"name":"max_tokens","label":"最大输出Token","uitype":"number","required":false,"default":1024},{"name":"stream","label":"流式输出","uitype":"switch","required":false}]'), +('hunyuan_vision_io','混元视觉理解','视觉理解输入输出','[{"name":"prompt","label":"用户输入","uitype":"text","required":true},{"name":"image_file","label":"图像URL","uitype":"image","required":true},{"name":"sys_prompt","label":"系统提示词","uitype":"text","required":false},{"name":"max_tokens","label":"最大输出Token","uitype":"number","required":false,"default":1024}]'), +('hunyuan_image_io','混元图像生成','文生图输入输出','[{"name":"prompt","label":"图像描述","uitype":"text","required":true},{"name":"size","label":"图像尺寸","uitype":"text","required":false,"default":"1024x1024"},{"name":"n","label":"生成数量","uitype":"number","required":false,"default":1}]'), +('hunyuan_video_i2v_io','混元图生视频','图生视频输入输出','[{"name":"image_file","label":"输入图像","uitype":"image","required":true},{"name":"prompt","label":"视频描述","uitype":"text","required":false},{"name":"duration","label":"视频时长(秒)","uitype":"number","required":false,"default":5},{"name":"resolution","label":"分辨率","uitype":"text","required":false,"default":"720P"}]'), +('hunyuan_video_t2v_io','混元文生视频','文生视频输入输出','[{"name":"prompt","label":"视频描述","uitype":"text","required":true},{"name":"duration","label":"视频时长(秒)","uitype":"number","required":false,"default":5},{"name":"resolution","label":"分辨率","uitype":"text","required":false,"default":"720P"}]') ON DUPLICATE KEY UPDATE description=VALUES(description),input_fields=VALUES(input_fields); --- ===================== Part 3b: uapi (link ioid) ===================== --- Reuse existing t2t/ti2t uapi for hunyun upapp; add image/video-specific ones if needed +-- Link existing uapi to uapiio UPDATE uapi SET ioid='hunyuan_chat_io' WHERE id='AP29-fYCll4l-byxm3DHN' AND upappid='5QXZ-AMP0K0NrcpZiTomA'; UPDATE uapi SET ioid='hunyuan_vision_io' WHERE id='qStjXm_Meu0nBjiRzdPew' AND upappid='5QXZ-AMP0K0NrcpZiTomA'; --- ===================== Part 4: pricing_program ===================== +-- ===================== Part 4: image uapi (tokenhub) ===================== +INSERT INTO uapi (id,name,title,description,need_auth,stream,path,httpmethod,headers,data,response,ioid,upappid) VALUES +('uapi_hunyuan_tokenhub_image','hunyuan-image-tokenhub','混元Image','Hunyuan Image via TokenHub','0','async','/images/generations','POST', +'{"Content-Type":"application/json"}', +'{"model":"{{model}}","prompt":{{json.dumps(prompt,ensure_ascii=False)}}{%if size%},"size":"{{size}}"{%endif%}{%if n%},"n":{{n}}{%endif%}}', +'{"taskid":"{{id}}","taskstatus":"PENDING","status":"PENDING"}', +'hunyuan_image_io','5QXZ-AMP0K0NrcpZiTomA') +ON DUPLICATE KEY UPDATE data=VALUES(data),response=VALUES(response); + +-- ===================== Part 5: pricing_program ===================== INSERT INTO pricing_program (id,name,ownerid,providerid,pricing_belong,description) VALUES ('pp_hunyuan_hy3','混元Hy3旗舰对话',NULL,'wNME9nrITooowlmCuR_XB',NULL,'295B参数·128K上下文·按token计费'), ('pp_hunyuan_vision2','HY-Vision 2.0视觉',NULL,'wNME9nrITooowlmCuR_XB',NULL,'406B参数·视觉理解·按token计费'), -('pp_hunyuan_image3','HY Image 3.0 Plus',NULL,'wNME9nrITooowlmCuR_XB',NULL,'文生图·按张计费'), -('pp_hunyuan_video_i2v','HY Video 1.5 I2V',NULL,'wNME9nrITooowlmCuR_XB',NULL,'图生视频·按秒计费'), -('pp_hunyuan_video_t2v','HY Video 1.5 T2V',NULL,'wNME9nrITooowlmCuR_XB',NULL,'文生视频·按秒计费') +('pp_hunyuan_image3','HY Image V3.0',NULL,'wNME9nrITooowlmCuR_XB',NULL,'文生图·0.2元/张'), +('pp_hunyuan_video_i2v','HY Video 1.5',NULL,'wNME9nrITooowlmCuR_XB',NULL,'视频生成·1.5元/次(积分)'), +('pp_hunyuan_video_t2v','HY Video 1.5',NULL,'wNME9nrITooowlmCuR_XB',NULL,'视频生成·1.5元/次(积分)') ON DUPLICATE KEY UPDATE name=VALUES(name); --- ===================== Part 5: pricing_program_timing ===================== +-- ===================== Part 6: pricing_program_timing ===================== INSERT INTO pricing_program_timing (id,ppid,name,pricing_data,enabled_date,expired_date) VALUES --- Hy3: 输入0.015元/1K, 输出0.06元/1K (对标HY2.0 Think定价) ('pt_hunyuan_hy3','pp_hunyuan_hy3','混元Hy3定价', -'unit_values:\n completion_tokens: 1000\n prompt_tokens: 1000\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: completion_tokens\n unit_prices: 0.06\n unit: 1K tokens\n- price_factors: prompt_tokens\n unit_prices: 0.015\n unit: 1K tokens', +'unit_values:\n completion_tokens: 1000\n prompt_tokens: 1000\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: completion_tokens\n unit_prices: 0.004\n unit: 1K tokens\n- price_factors: prompt_tokens\n unit_prices: 0.001\n unit: 1K tokens', '2025-01-01','9999-12-31'), --- HY-Vision 2.0: 输入0.003元/1K, 输出0.009元/1K ('pt_hunyuan_vision2','pp_hunyuan_vision2','HY-Vision 2.0定价', -'unit_values:\n completion_tokens: 1000\n prompt_tokens: 1000\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: completion_tokens\n unit_prices: 0.009\n unit: 1K tokens\n- price_factors: prompt_tokens\n unit_prices: 0.003\n unit: 1K tokens', +'unit_values:\n completion_tokens: 1000\n prompt_tokens: 1000\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: completion_tokens\n unit_prices: 0.0175\n unit: 1K tokens\n- price_factors: prompt_tokens\n unit_prices: 0.0075\n unit: 1K tokens', '2025-01-01','9999-12-31'), --- HY Image 3.0 Plus: 0.02元/张 -('pt_hunyuan_image3','pp_hunyuan_image3','HY Image 3.0 Plus定价', -'unit_values:\n image_count: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: image_count\n unit_prices: 0.02\n unit: image_count', +('pt_hunyuan_image3','pp_hunyuan_image3','HY Image V3.0定价', +'unit_values:\n image_count: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: image_count\n unit_prices: 0.2\n unit: image_count', '2025-01-01','9999-12-31'), --- HY Video 1.5 I2V: 0.15元/秒 -('pt_hunyuan_video_i2v','pp_hunyuan_video_i2v','HY Video 1.5 I2V定价', -'unit_values:\n video_seconds: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: video_seconds\n unit_prices: 0.15\n unit: video_seconds', +('pt_hunyuan_video_i2v','pp_hunyuan_video_i2v','HY-Video 1.5定价', +'unit_values:\n video_count: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: video_count\n unit_prices: 1.5\n unit: video_count', '2025-01-01','9999-12-31'), --- HY Video 1.5 T2V: 0.10元/秒 -('pt_hunyuan_video_t2v','pp_hunyuan_video_t2v','HY Video 1.5 T2V定价', -'unit_values:\n video_seconds: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: video_seconds\n unit_prices: 0.10\n unit: video_seconds', +('pt_hunyuan_video_t2v','pp_hunyuan_video_t2v','HY-Video 1.5定价', +'unit_values:\n video_count: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: video_count\n unit_prices: 1.5\n unit: video_count', '2025-01-01','9999-12-31') ON DUPLICATE KEY UPDATE ppid=VALUES(ppid), pricing_data=VALUES(pricing_data);