sage/scripts/hunyuan_models_migration.sql

84 lines
8.8 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ============================================================
-- 腾讯混元大模型接入: Hunyuan via tokenhub.tencentmaas.com
--
-- 模型:
-- 1. hy3 — 混元 Hy3 (旗舰对话模型)
-- 2. hy-vision-2.0-instruct — HY-Vision 2.0 (视觉理解)
-- 3. hy-image-3.0-plus — HY Image 3.0 Plus (文生图)
-- 4. hy-video-1.5-i2v — HY Video 1.5 I2V (图生视频)
-- 5. hy-video-1.5-t2v — HY Video 1.5 T2V (文生视频)
--
-- 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')
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_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":"分辨率"}}')
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
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 =====================
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,'文生视频·按秒计费')
ON DUPLICATE KEY UPDATE name=VALUES(name);
-- ===================== Part 5: 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',
'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',
'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',
'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',
'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',
'2025-01-01','9999-12-31')
ON DUPLICATE KEY UPDATE ppid=VALUES(ppid), pricing_data=VALUES(pricing_data);