UPDATE `provider_configs` SET `config_json` = JSON_REMOVE( JSON_SET( COALESCE(`config_json`, JSON_OBJECT()), '$.driver', 'kling_v3_image_to_video', '$.auth_type', 'bearer', '$.api_key_env', 'KLING_API_KEY', '$.base_url', 'https://api-singapore.klingai.com', '$.timeout_ms', 600000, '$.create_endpoint', '/v1/videos/image2video', '$.task_endpoint_template', '/v1/videos/image2video/{task_id}', '$.poll_interval_ms', 10000, '$.max_poll_attempts', 120, '$.aspect_ratio', '9:16', '$.mode', CASE WHEN `provider_code` = 'kling-v3-native-audio-720p-video' THEN 'std' ELSE 'pro' END, '$.resolution', CASE WHEN `provider_code` = 'kling-v3-native-audio-720p-video' THEN '720p' ELSE '1080p' END, '$.duration', 5, '$.allowed_modes', JSON_ARRAY('std', 'pro', '4k'), '$.allowed_resolutions', JSON_ARRAY('720p', '1080p', '4k'), '$.allowed_durations', JSON_ARRAY(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), '$.max_prompt_length', 2500, '$.max_multi_prompt_length', 512, '$.max_multi_shots', 6, '$.max_image_inputs', 2, '$.web_max_image_inputs', 2, '$.max_elements', 3, '$.max_voices', 2, '$.input_image_formats', JSON_ARRAY('jpg', 'jpeg', 'png'), '$.input_image_mime_types', JSON_ARRAY('image/jpeg', 'image/png'), '$.input_image_max_mb', 10, '$.input_image_min_dimension', 300, '$.input_image_min_aspect_ratio', 0.4, '$.input_image_max_aspect_ratio', 2.5, '$.video_modes', JSON_ARRAY('first_frame', 'end_frame', 'start_end_frame'), '$.extra_body_json', JSON_OBJECT('sound', 'on', 'watermark_info', JSON_OBJECT('enabled', false)), '$.supports_4k', true, '$.supports_reference_image', true, '$.supports_start_end_frame', true, '$.supports_elements', true, '$.supports_voices', true, '$.supports_multi_shot', true, '$.supports_audio', true, '$.supports_lipsync', true, '$.supports_character_reference', true, '$.supports_multi_character', true, '$.supports_style_reference', false, '$.capability_version', 'kling_video_capabilities_2026-07-15', '$.formal_splus_model', true, '$.official_doc_url', 'https://kling.ai/document-api/api/video/3-0-omni/image-to-video', '$.note', 'Kling v3 官方 image2video 适配器:首帧/尾帧、最多3个元素、最多2个音色、自定义或智能多镜头、原生音频与4K。' ), '$.access_key_env', '$.secret_key_env', '$.jwt_ttl_seconds', '$.jwt_nbf_skew_seconds', '$.model_field', '$.image_field', '$.prompt_field', '$.duration_field', '$.aspect_ratio_field', '$.resolution_field', '$.reference_images_field', '$.max_reference_images', '$.reference_image_limit' ), `updated_at` = NOW(3) WHERE `provider_type` = 'VideoProvider' AND `provider_code` IN ( 'kling-v3-native-audio-720p-video', 'kling-v3-native-audio-video' ); INSERT INTO `provider_configs` (`provider_type`, `provider_code`, `display_name`, `mode`, `model_name`, `config_json`, `is_enabled`, `priority`, `rate_limit_json`, `cost_rule_json`, `created_at`, `updated_at`) VALUES ( 'VideoProvider', 'kling-v3-native-audio-4k-video', '可灵 v3 原生音频 4K 图生视频', 'real', 'kling-v3', JSON_OBJECT( 'driver', 'kling_v3_image_to_video', 'auth_type', 'bearer', 'api_key_env', 'KLING_API_KEY', 'base_url', 'https://api-singapore.klingai.com', 'timeout_ms', 600000, 'create_endpoint', '/v1/videos/image2video', 'task_endpoint_template', '/v1/videos/image2video/{task_id}', 'poll_interval_ms', 10000, 'max_poll_attempts', 120, 'aspect_ratio', '9:16', 'mode', '4k', 'resolution', '4k', 'duration', 5, 'allowed_modes', JSON_ARRAY('std', 'pro', '4k'), 'allowed_resolutions', JSON_ARRAY('720p', '1080p', '4k'), 'allowed_durations', JSON_ARRAY(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15), 'max_prompt_length', 2500, 'max_multi_prompt_length', 512, 'max_multi_shots', 6, 'max_image_inputs', 2, 'web_max_image_inputs', 2, 'max_elements', 3, 'max_voices', 2, 'input_image_formats', JSON_ARRAY('jpg', 'jpeg', 'png'), 'input_image_mime_types', JSON_ARRAY('image/jpeg', 'image/png'), 'input_image_max_mb', 10, 'input_image_min_dimension', 300, 'input_image_min_aspect_ratio', 0.4, 'input_image_max_aspect_ratio', 2.5, 'video_modes', JSON_ARRAY('first_frame', 'end_frame', 'start_end_frame'), 'extra_body_json', JSON_OBJECT('sound', 'on', 'watermark_info', JSON_OBJECT('enabled', false)), 'supports_4k', true, 'supports_reference_image', true, 'supports_start_end_frame', true, 'supports_elements', true, 'supports_voices', true, 'supports_multi_shot', true, 'supports_audio', true, 'supports_lipsync', true, 'supports_character_reference', true, 'supports_multi_character', true, 'supports_style_reference', false, 'capability_version', 'kling_video_capabilities_2026-07-15', 'formal_splus_model', true, 'official_doc_url', 'https://kling.ai/document-api/api/video/3-0-omni/image-to-video', 'note', '默认禁用。Kling v3 官方图生视频4K模式;正式批量前需单镜头验证。' ), false, 43, JSON_OBJECT('rpm', 5, 'concurrency', 1), JSON_OBJECT( 'flat_cost', 0, 'unit', 'video_seconds', 'price_per_second', 0.504, 'currency', 'USD', 'cny_fx_rate', 6.79, 'max_cost_per_call', 8, 'daily_cost_limit', 120, 'estimated_seconds', 10, 'note', 'Kling v3 原生音频4K暂估 $0.504/s,10s约 $5.04 / ¥34.22;最终以Kling账单为准。' ), NOW(3), NOW(3) ) ON DUPLICATE KEY UPDATE `display_name` = VALUES(`display_name`), `mode` = VALUES(`mode`), `model_name` = VALUES(`model_name`), `priority` = VALUES(`priority`), `rate_limit_json` = VALUES(`rate_limit_json`), `cost_rule_json` = VALUES(`cost_rule_json`), `updated_at` = NOW(3); UPDATE `provider_configs` SET `config_json` = JSON_SET( COALESCE(`config_json`, JSON_OBJECT()), '$.capability_version', 'kling_video_capabilities_2026-07-15', '$.formal_splus_model', true, '$.official_doc_url', 'https://kling.ai/document-api/api/video/3-0-omni/video-omni', '$.reference_video_default_type', 'base', '$.reference_video_character_policy', 'reject_with_reference_video', '$.custom_multi_shot_omits_top_prompt', true ), `updated_at` = NOW(3) WHERE `provider_type` = 'VideoProvider' AND `provider_code` IN ( 'kling-v3-omni-native-audio-720p-video', 'kling-v3-omni-native-audio-1080p-video', 'kling-v3-omni-native-audio-4k-video' ); UPDATE `provider_configs` SET `config_json` = JSON_SET( COALESCE(`config_json`, JSON_OBJECT()), '$.formal_splus_model', false, '$.splus_usage', 'legacy_or_experiment_only' ), `updated_at` = NOW(3) WHERE `provider_type` = 'VideoProvider' AND `provider_code` LIKE 'kling%' AND `provider_code` NOT IN ( 'kling-v3-native-audio-720p-video', 'kling-v3-native-audio-video', 'kling-v3-native-audio-4k-video', 'kling-v3-omni-native-audio-720p-video', 'kling-v3-omni-native-audio-1080p-video', 'kling-v3-omni-native-audio-4k-video' ); UPDATE `system_configs` SET `config_value` = JSON_SET( COALESCE(`config_value`, JSON_OBJECT()), '$.splus_live_action_video', JSON_OBJECT( 'capability_version', 'kling_video_capabilities_2026-07-15', 'formal_provider_codes', JSON_ARRAY( 'kling-v3-omni-native-audio-720p-video', 'kling-v3-omni-native-audio-1080p-video', 'kling-v3-omni-native-audio-4k-video', 'kling-v3-native-audio-720p-video', 'kling-v3-native-audio-video', 'kling-v3-native-audio-4k-video' ), 'zh-CN', JSON_OBJECT( 'thresholds', JSON_OBJECT('premium_importance_gt', 7, 'premium_action_gt', 5), 'normal', JSON_OBJECT( 'provider_code', 'kling-v3-omni-native-audio-1080p-video', 'fallback_chain', JSON_ARRAY('kling-v3-omni-native-audio-1080p-video', 'kling-v3-native-audio-video') ), 'premium', JSON_OBJECT( 'provider_code', 'kling-v3-omni-native-audio-1080p-video', 'fallback_chain', JSON_ARRAY('kling-v3-omni-native-audio-1080p-video', 'kling-v3-native-audio-video') ) ) ) ), `updated_at` = NOW(3) WHERE `config_key` = 'ai.router.v1';