@felores/kie-ai-mcp-server 3.0.0 → 3.1.0
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.
- package/dist/index.js +248 -81
- package/dist/kie-ai-client.d.ts +2 -1
- package/dist/kie-ai-client.js +40 -27
- package/dist/types.d.ts +126 -97
- package/dist/types.js +29 -24
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, ListResources
|
|
|
5
5
|
import { KieAiClient } from "./kie-ai-client.js";
|
|
6
6
|
import { TaskDatabase } from "./database.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { NanoBananaImageSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, ByteDanceSeedreamImageSchema, QwenImageSchema, RunwayAlephVideoSchema, WanVideoSchema, MidjourneyGenerateSchema, OpenAI4oImageSchema, FluxKontextImageSchema, RecraftRemoveBackgroundSchema, IdeogramReframeSchema, KlingVideoSchema, HailuoVideoSchema, SoraVideoSchema, Flux2ImageSchema, WanAnimateSchema, ZImageSchema, GrokImagineSchema, InfiniTalkSchema, KlingAvatarSchema, } from "./types.js";
|
|
8
|
+
import { NanoBananaImageSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, ByteDanceSeedreamImageSchema, QwenImageSchema, RunwayAlephVideoSchema, WanVideoSchema, MidjourneyGenerateSchema, OpenAI4oImageSchema, FluxKontextImageSchema, RecraftRemoveBackgroundSchema, IdeogramReframeSchema, KlingVideoSchema, HailuoVideoSchema, SoraVideoSchema, Flux2ImageSchema, WanAnimateSchema, ZImageSchema, GrokImagineSchema, InfiniTalkSchema, KlingAvatarSchema, TopazUpscaleImageSchema, } from "./types.js";
|
|
9
9
|
class KieAiMcpServer {
|
|
10
10
|
server;
|
|
11
11
|
client;
|
|
@@ -21,6 +21,7 @@ class KieAiMcpServer {
|
|
|
21
21
|
"flux_kontext_image",
|
|
22
22
|
"flux2_image",
|
|
23
23
|
"z_image",
|
|
24
|
+
"topaz_upscale_image",
|
|
24
25
|
"recraft_remove_background",
|
|
25
26
|
"ideogram_reframe",
|
|
26
27
|
"midjourney_generate", // Also generates images (6 modes: txt2img, img2img, style ref, omni ref, video SD/HD)
|
|
@@ -52,7 +53,7 @@ class KieAiMcpServer {
|
|
|
52
53
|
constructor() {
|
|
53
54
|
this.server = new Server({
|
|
54
55
|
name: "kie-ai-mcp-server",
|
|
55
|
-
version: "3.
|
|
56
|
+
version: "3.1.0",
|
|
56
57
|
});
|
|
57
58
|
// Initialize client with config from environment
|
|
58
59
|
this.config = {
|
|
@@ -613,66 +614,92 @@ class KieAiMcpServer {
|
|
|
613
614
|
},
|
|
614
615
|
{
|
|
615
616
|
name: "bytedance_seedance_video",
|
|
616
|
-
description: "Generate videos
|
|
617
|
+
description: "Generate videos with ByteDance Seedance 2.0 — multimodal inputs (image/video/audio references), native audio generation, standard and fast modes",
|
|
617
618
|
inputSchema: {
|
|
618
619
|
type: "object",
|
|
619
620
|
properties: {
|
|
620
621
|
prompt: {
|
|
621
622
|
type: "string",
|
|
622
|
-
description: "Text prompt for video generation (
|
|
623
|
-
minLength:
|
|
624
|
-
maxLength:
|
|
623
|
+
description: "Text prompt for video generation (3-20000 characters)",
|
|
624
|
+
minLength: 3,
|
|
625
|
+
maxLength: 20000,
|
|
625
626
|
},
|
|
626
|
-
|
|
627
|
+
mode: {
|
|
627
628
|
type: "string",
|
|
628
|
-
description: "
|
|
629
|
+
description: "Generation mode — standard (seedance-2, higher quality) or fast (seedance-2-fast, iterative workflows)",
|
|
630
|
+
enum: ["standard", "fast"],
|
|
631
|
+
default: "standard",
|
|
632
|
+
},
|
|
633
|
+
first_frame_url: {
|
|
634
|
+
type: "string",
|
|
635
|
+
description: "URL of image to use as the first frame (optional)",
|
|
629
636
|
format: "uri",
|
|
630
637
|
},
|
|
631
|
-
|
|
638
|
+
last_frame_url: {
|
|
632
639
|
type: "string",
|
|
633
|
-
description: "
|
|
634
|
-
|
|
635
|
-
|
|
640
|
+
description: "URL of image to use as the last frame (optional)",
|
|
641
|
+
format: "uri",
|
|
642
|
+
},
|
|
643
|
+
reference_image_urls: {
|
|
644
|
+
type: "array",
|
|
645
|
+
description: "Reference images for style/subject guidance (up to 9)",
|
|
646
|
+
items: { type: "string", format: "uri" },
|
|
647
|
+
maxItems: 9,
|
|
648
|
+
},
|
|
649
|
+
reference_video_urls: {
|
|
650
|
+
type: "array",
|
|
651
|
+
description: "Reference videos for motion/style guidance (up to 3)",
|
|
652
|
+
items: { type: "string", format: "uri" },
|
|
653
|
+
maxItems: 3,
|
|
654
|
+
},
|
|
655
|
+
reference_audio_urls: {
|
|
656
|
+
type: "array",
|
|
657
|
+
description: "Reference audio for sound-guided generation (up to 3)",
|
|
658
|
+
items: { type: "string", format: "uri" },
|
|
659
|
+
maxItems: 3,
|
|
636
660
|
},
|
|
637
661
|
aspect_ratio: {
|
|
638
662
|
type: "string",
|
|
639
663
|
description: "Aspect ratio of the generated video",
|
|
640
|
-
enum: [
|
|
664
|
+
enum: [
|
|
665
|
+
"1:1",
|
|
666
|
+
"9:16",
|
|
667
|
+
"16:9",
|
|
668
|
+
"4:3",
|
|
669
|
+
"3:4",
|
|
670
|
+
"21:9",
|
|
671
|
+
"9:21",
|
|
672
|
+
"adaptive",
|
|
673
|
+
],
|
|
641
674
|
default: "16:9",
|
|
642
675
|
},
|
|
643
676
|
resolution: {
|
|
644
677
|
type: "string",
|
|
645
|
-
description: "Video resolution
|
|
646
|
-
enum: ["480p", "720p"
|
|
678
|
+
description: "Video resolution — 480p for faster, 720p for balance",
|
|
679
|
+
enum: ["480p", "720p"],
|
|
647
680
|
default: "720p",
|
|
648
681
|
},
|
|
649
682
|
duration: {
|
|
650
|
-
type: "string",
|
|
651
|
-
description: "Duration of video in seconds (2-12)",
|
|
652
|
-
pattern: "^[2-9]|1[0-2]$",
|
|
653
|
-
default: "5",
|
|
654
|
-
},
|
|
655
|
-
camera_fixed: {
|
|
656
|
-
type: "boolean",
|
|
657
|
-
description: "Whether to fix the camera position",
|
|
658
|
-
default: false,
|
|
659
|
-
},
|
|
660
|
-
seed: {
|
|
661
683
|
type: "integer",
|
|
662
|
-
description: "
|
|
663
|
-
minimum:
|
|
664
|
-
maximum:
|
|
665
|
-
default:
|
|
684
|
+
description: "Duration of video in seconds (4-15)",
|
|
685
|
+
minimum: 4,
|
|
686
|
+
maximum: 15,
|
|
687
|
+
default: 5,
|
|
666
688
|
},
|
|
667
|
-
|
|
689
|
+
generate_audio: {
|
|
668
690
|
type: "boolean",
|
|
669
|
-
description: "
|
|
691
|
+
description: "Generate native audio for the video",
|
|
670
692
|
default: true,
|
|
671
693
|
},
|
|
672
|
-
|
|
673
|
-
type: "
|
|
674
|
-
description: "
|
|
675
|
-
|
|
694
|
+
web_search: {
|
|
695
|
+
type: "boolean",
|
|
696
|
+
description: "Enable web search to enhance prompt understanding",
|
|
697
|
+
default: false,
|
|
698
|
+
},
|
|
699
|
+
nsfw_checker: {
|
|
700
|
+
type: "boolean",
|
|
701
|
+
description: "Enable NSFW content filtering",
|
|
702
|
+
default: false,
|
|
676
703
|
},
|
|
677
704
|
callBackUrl: {
|
|
678
705
|
type: "string",
|
|
@@ -1405,6 +1432,32 @@ class KieAiMcpServer {
|
|
|
1405
1432
|
required: ["prompt"],
|
|
1406
1433
|
},
|
|
1407
1434
|
},
|
|
1435
|
+
{
|
|
1436
|
+
name: "topaz_upscale_image",
|
|
1437
|
+
description: "Upscale and enhance images using Topaz Labs AI upscaler. Increases resolution with high-fidelity detail restoration, natural texture reconstruction, and improved clarity. Supports 1x-8x upscaling (max output 20,000px per side). Pricing: 10 credits (≤2K), 20 credits (4K), 40 credits (8K).",
|
|
1438
|
+
inputSchema: {
|
|
1439
|
+
type: "object",
|
|
1440
|
+
properties: {
|
|
1441
|
+
image_url: {
|
|
1442
|
+
type: "string",
|
|
1443
|
+
description: "URL of image to upscale (JPEG, PNG, WEBP, max 10MB)",
|
|
1444
|
+
format: "uri",
|
|
1445
|
+
},
|
|
1446
|
+
upscale_factor: {
|
|
1447
|
+
type: "string",
|
|
1448
|
+
description: "Upscale factor: 1x (enhance only), 2x (default), 4x, or 8x. Max output dimension is 20,000px.",
|
|
1449
|
+
enum: ["1", "2", "4", "8"],
|
|
1450
|
+
default: "2",
|
|
1451
|
+
},
|
|
1452
|
+
callBackUrl: {
|
|
1453
|
+
type: "string",
|
|
1454
|
+
description: "Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)",
|
|
1455
|
+
format: "uri",
|
|
1456
|
+
},
|
|
1457
|
+
},
|
|
1458
|
+
required: ["image_url"],
|
|
1459
|
+
},
|
|
1460
|
+
},
|
|
1408
1461
|
{
|
|
1409
1462
|
name: "recraft_remove_background",
|
|
1410
1463
|
description: "Remove backgrounds from images using Recraft AI background removal model",
|
|
@@ -1837,6 +1890,8 @@ class KieAiMcpServer {
|
|
|
1837
1890
|
return await this.handleRunwayAlephVideo(args);
|
|
1838
1891
|
case "wan_video":
|
|
1839
1892
|
return await this.handleWanVideo(args);
|
|
1893
|
+
case "topaz_upscale_image":
|
|
1894
|
+
return await this.handleTopazUpscaleImage(args);
|
|
1840
1895
|
case "recraft_remove_background":
|
|
1841
1896
|
return await this.handleRecraftRemoveBackground(args);
|
|
1842
1897
|
case "ideogram_reframe":
|
|
@@ -1931,8 +1986,8 @@ class KieAiMcpServer {
|
|
|
1931
1986
|
},
|
|
1932
1987
|
{
|
|
1933
1988
|
uri: "kie://models/bytedance-seedance",
|
|
1934
|
-
name: "ByteDance Seedance",
|
|
1935
|
-
description: "
|
|
1989
|
+
name: "ByteDance Seedance 2.0",
|
|
1990
|
+
description: "Multimodal video generation with native audio, image/video/audio references, standard and fast modes",
|
|
1936
1991
|
mimeType: "text/markdown",
|
|
1937
1992
|
annotations: {
|
|
1938
1993
|
audience: ["assistant"],
|
|
@@ -2020,6 +2075,16 @@ class KieAiMcpServer {
|
|
|
2020
2075
|
},
|
|
2021
2076
|
},
|
|
2022
2077
|
// Specialized Tools
|
|
2078
|
+
{
|
|
2079
|
+
uri: "kie://models/topaz-upscale",
|
|
2080
|
+
name: "Topaz Image Upscale",
|
|
2081
|
+
description: "AI-powered image upscaling with detail restoration (1x-8x)",
|
|
2082
|
+
mimeType: "text/markdown",
|
|
2083
|
+
annotations: {
|
|
2084
|
+
audience: ["assistant"],
|
|
2085
|
+
priority: 0.5,
|
|
2086
|
+
},
|
|
2087
|
+
},
|
|
2023
2088
|
{
|
|
2024
2089
|
uri: "kie://models/recraft-bg-removal",
|
|
2025
2090
|
name: "Recraft Background Removal",
|
|
@@ -2429,6 +2494,33 @@ class KieAiMcpServer {
|
|
|
2429
2494
|
errorMessage = apiData.errorMessage;
|
|
2430
2495
|
}
|
|
2431
2496
|
}
|
|
2497
|
+
else if (localTask?.api_type === "topaz-upscale") {
|
|
2498
|
+
// Topaz Image Upscale-specific status mapping
|
|
2499
|
+
const state = apiData.state;
|
|
2500
|
+
if (state === "success")
|
|
2501
|
+
status = "completed";
|
|
2502
|
+
else if (state === "fail")
|
|
2503
|
+
status = "failed";
|
|
2504
|
+
else if (state === "waiting")
|
|
2505
|
+
status = "processing";
|
|
2506
|
+
// Parse resultJson for Topaz Image Upscale
|
|
2507
|
+
if (apiData.resultJson) {
|
|
2508
|
+
try {
|
|
2509
|
+
parsedResult = JSON.parse(apiData.resultJson);
|
|
2510
|
+
if (parsedResult.resultUrls &&
|
|
2511
|
+
parsedResult.resultUrls.length > 0) {
|
|
2512
|
+
resultUrl = parsedResult.resultUrls[0];
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
catch (e) {
|
|
2516
|
+
// Invalid JSON in resultJson
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
// Extract error message for Topaz Image Upscale
|
|
2520
|
+
if (apiData.failMsg) {
|
|
2521
|
+
errorMessage = apiData.failMsg;
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2432
2524
|
else if (localTask?.api_type === "recraft-remove-background") {
|
|
2433
2525
|
// Recraft Remove Background-specific status mapping
|
|
2434
2526
|
const state = apiData.state;
|
|
@@ -2530,6 +2622,7 @@ class KieAiMcpServer {
|
|
|
2530
2622
|
"qwen-image",
|
|
2531
2623
|
"openai-4o-image",
|
|
2532
2624
|
"flux-kontext-image",
|
|
2625
|
+
"topaz-upscale",
|
|
2533
2626
|
"recraft-remove-background",
|
|
2534
2627
|
"ideogram-reframe",
|
|
2535
2628
|
"midjourney",
|
|
@@ -2962,10 +3055,8 @@ class KieAiMcpServer {
|
|
|
2962
3055
|
request.callBackUrl = this.getCallbackUrl(request.callBackUrl);
|
|
2963
3056
|
const response = await this.client.generateByteDanceSeedanceVideo(request);
|
|
2964
3057
|
if (response.code === 200 && response.data?.taskId) {
|
|
2965
|
-
|
|
2966
|
-
const
|
|
2967
|
-
const mode = isImageToVideo ? "Image-to-Video" : "Text-to-Video";
|
|
2968
|
-
const quality = request.quality || "lite";
|
|
3058
|
+
const mode = request.mode || "standard";
|
|
3059
|
+
const hasFrameInput = !!request.first_frame_url;
|
|
2969
3060
|
// Store task in database
|
|
2970
3061
|
await this.db.createTask({
|
|
2971
3062
|
task_id: response.data.taskId,
|
|
@@ -2979,24 +3070,35 @@ class KieAiMcpServer {
|
|
|
2979
3070
|
text: JSON.stringify({
|
|
2980
3071
|
success: true,
|
|
2981
3072
|
task_id: response.data.taskId,
|
|
2982
|
-
message: `ByteDance Seedance ${mode} generation task created successfully`,
|
|
3073
|
+
message: `ByteDance Seedance 2.0 ${mode} generation task created successfully`,
|
|
2983
3074
|
parameters: {
|
|
2984
|
-
mode
|
|
2985
|
-
quality: quality,
|
|
3075
|
+
mode,
|
|
2986
3076
|
prompt: request.prompt.substring(0, 100) +
|
|
2987
3077
|
(request.prompt.length > 100 ? "..." : ""),
|
|
2988
3078
|
aspect_ratio: request.aspect_ratio || "16:9",
|
|
2989
3079
|
resolution: request.resolution || "720p",
|
|
2990
|
-
duration: request.duration ||
|
|
2991
|
-
|
|
2992
|
-
...(
|
|
2993
|
-
|
|
3080
|
+
duration: request.duration || 5,
|
|
3081
|
+
generate_audio: request.generate_audio !== false,
|
|
3082
|
+
...(hasFrameInput && {
|
|
3083
|
+
first_frame_url: request.first_frame_url,
|
|
3084
|
+
}),
|
|
3085
|
+
...(request.last_frame_url && {
|
|
3086
|
+
last_frame_url: request.last_frame_url,
|
|
3087
|
+
}),
|
|
3088
|
+
...(request.reference_image_urls?.length && {
|
|
3089
|
+
reference_images: request.reference_image_urls.length,
|
|
3090
|
+
}),
|
|
3091
|
+
...(request.reference_video_urls?.length && {
|
|
3092
|
+
reference_videos: request.reference_video_urls.length,
|
|
3093
|
+
}),
|
|
3094
|
+
...(request.reference_audio_urls?.length && {
|
|
3095
|
+
reference_audios: request.reference_audio_urls.length,
|
|
2994
3096
|
}),
|
|
2995
3097
|
},
|
|
2996
3098
|
next_steps: [
|
|
2997
3099
|
"Use get_task_status to check generation progress",
|
|
2998
3100
|
"Task completion will be sent to the provided callback URL",
|
|
2999
|
-
`${mode} generation typically takes 2-5 minutes depending on
|
|
3101
|
+
`${mode} mode generation typically takes 2-5 minutes depending on duration and complexity`,
|
|
3000
3102
|
],
|
|
3001
3103
|
}, null, 2),
|
|
3002
3104
|
},
|
|
@@ -3011,26 +3113,28 @@ class KieAiMcpServer {
|
|
|
3011
3113
|
catch (error) {
|
|
3012
3114
|
if (error instanceof z.ZodError) {
|
|
3013
3115
|
return this.formatError("bytedance_seedance_video", error, {
|
|
3014
|
-
prompt: "Required: Text prompt for video generation (
|
|
3015
|
-
|
|
3016
|
-
|
|
3116
|
+
prompt: "Required: Text prompt for video generation (3-20000 characters)",
|
|
3117
|
+
mode: 'Optional: Generation mode — "standard" or "fast" (default: standard)',
|
|
3118
|
+
first_frame_url: "Optional: URL of image to use as first frame",
|
|
3119
|
+
last_frame_url: "Optional: URL of image to use as last frame",
|
|
3120
|
+
reference_image_urls: "Optional: Reference images for style guidance (up to 9)",
|
|
3121
|
+
reference_video_urls: "Optional: Reference videos for motion guidance (up to 3)",
|
|
3122
|
+
reference_audio_urls: "Optional: Reference audio for sound-guided generation (up to 3)",
|
|
3017
3123
|
aspect_ratio: "Optional: Video aspect ratio (default: 16:9)",
|
|
3018
|
-
resolution:
|
|
3019
|
-
duration: "Optional: Video duration in seconds
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
callBackUrl: "Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)",
|
|
3124
|
+
resolution: 'Optional: Video resolution — "480p" or "720p" (default: 720p)',
|
|
3125
|
+
duration: "Optional: Video duration in seconds 4-15 (default: 5)",
|
|
3126
|
+
generate_audio: "Optional: Generate native audio (default: true)",
|
|
3127
|
+
web_search: "Optional: Enable web search for prompt enhancement (default: false)",
|
|
3128
|
+
nsfw_checker: "Optional: Enable NSFW content filtering (default: false)",
|
|
3129
|
+
callBackUrl: "Optional: URL for task completion notifications",
|
|
3025
3130
|
});
|
|
3026
3131
|
}
|
|
3027
3132
|
return this.formatError("bytedance_seedance_video", error, {
|
|
3028
|
-
prompt: "Required: Text prompt for video generation
|
|
3029
|
-
|
|
3030
|
-
quality: "Optional: Model quality - lite or pro",
|
|
3133
|
+
prompt: "Required: Text prompt for video generation",
|
|
3134
|
+
mode: 'Optional: "standard" or "fast"',
|
|
3031
3135
|
aspect_ratio: "Optional: Video aspect ratio",
|
|
3032
|
-
resolution:
|
|
3033
|
-
duration: "Optional:
|
|
3136
|
+
resolution: 'Optional: "480p" or "720p"',
|
|
3137
|
+
duration: "Optional: Duration in seconds 4-15",
|
|
3034
3138
|
callBackUrl: "Optional: URL for task completion notifications",
|
|
3035
3139
|
});
|
|
3036
3140
|
}
|
|
@@ -3924,6 +4028,61 @@ class KieAiMcpServer {
|
|
|
3924
4028
|
});
|
|
3925
4029
|
}
|
|
3926
4030
|
}
|
|
4031
|
+
async handleTopazUpscaleImage(args) {
|
|
4032
|
+
try {
|
|
4033
|
+
const request = TopazUpscaleImageSchema.parse(args);
|
|
4034
|
+
// Use intelligent callback URL fallback
|
|
4035
|
+
request.callBackUrl = this.getCallbackUrl(request.callBackUrl);
|
|
4036
|
+
const response = await this.client.generateTopazUpscaleImage(request);
|
|
4037
|
+
if (response.code === 200 && response.data?.taskId) {
|
|
4038
|
+
// Store task in database
|
|
4039
|
+
await this.db.createTask({
|
|
4040
|
+
task_id: response.data.taskId,
|
|
4041
|
+
api_type: "topaz-upscale",
|
|
4042
|
+
status: "pending",
|
|
4043
|
+
});
|
|
4044
|
+
return {
|
|
4045
|
+
content: [
|
|
4046
|
+
{
|
|
4047
|
+
type: "text",
|
|
4048
|
+
text: JSON.stringify({
|
|
4049
|
+
success: true,
|
|
4050
|
+
task_id: response.data.taskId,
|
|
4051
|
+
message: "Topaz Image Upscale task created successfully",
|
|
4052
|
+
parameters: {
|
|
4053
|
+
image_url: request.image_url,
|
|
4054
|
+
upscale_factor: request.upscale_factor,
|
|
4055
|
+
callBackUrl: request.callBackUrl,
|
|
4056
|
+
},
|
|
4057
|
+
next_steps: [
|
|
4058
|
+
"Use get_task_status to check generation progress",
|
|
4059
|
+
"Task completion will be sent to the provided callback URL",
|
|
4060
|
+
"Upscaling typically takes 30-90 seconds depending on image size and upscale factor",
|
|
4061
|
+
],
|
|
4062
|
+
}, null, 2),
|
|
4063
|
+
},
|
|
4064
|
+
],
|
|
4065
|
+
};
|
|
4066
|
+
}
|
|
4067
|
+
else {
|
|
4068
|
+
throw new Error(response.msg || "Failed to create Topaz Image Upscale task");
|
|
4069
|
+
}
|
|
4070
|
+
}
|
|
4071
|
+
catch (error) {
|
|
4072
|
+
if (error instanceof z.ZodError) {
|
|
4073
|
+
return this.formatError("topaz_upscale_image", error, {
|
|
4074
|
+
image_url: "Required: URL of image to upscale (JPEG, PNG, WEBP, max 10MB)",
|
|
4075
|
+
upscale_factor: 'Optional: Upscale factor "1", "2" (default), "4", or "8". Max output dimension is 20,000px.',
|
|
4076
|
+
callBackUrl: "Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)",
|
|
4077
|
+
});
|
|
4078
|
+
}
|
|
4079
|
+
return this.formatError("topaz_upscale_image", error, {
|
|
4080
|
+
image_url: "Required: URL of image to upscale",
|
|
4081
|
+
upscale_factor: 'Optional: Upscale factor "1", "2", "4", or "8"',
|
|
4082
|
+
callBackUrl: "Optional: URL for task completion notifications",
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
}
|
|
3927
4086
|
async handleRecraftRemoveBackground(args) {
|
|
3928
4087
|
try {
|
|
3929
4088
|
const request = RecraftRemoveBackgroundSchema.parse(args);
|
|
@@ -4537,6 +4696,12 @@ class KieAiMcpServer {
|
|
|
4537
4696
|
category: "image",
|
|
4538
4697
|
quality: "premium",
|
|
4539
4698
|
},
|
|
4699
|
+
{
|
|
4700
|
+
name: "topaz_upscale_image",
|
|
4701
|
+
status: "available",
|
|
4702
|
+
category: "image",
|
|
4703
|
+
quality: "professional",
|
|
4704
|
+
},
|
|
4540
4705
|
{
|
|
4541
4706
|
name: "recraft_remove_background",
|
|
4542
4707
|
status: "available",
|
|
@@ -4722,10 +4887,10 @@ The system automatically detects user intent:
|
|
|
4722
4887
|
## 🔧 Intelligent Parameter Selection
|
|
4723
4888
|
|
|
4724
4889
|
### **Video Parameters**
|
|
4725
|
-
- **ByteDance Seedance**:
|
|
4726
|
-
- Default: \`
|
|
4727
|
-
-
|
|
4728
|
-
-
|
|
4890
|
+
- **ByteDance Seedance 2.0**:
|
|
4891
|
+
- Default: \`mode: "standard"\`, \`resolution: "720p"\`, \`generate_audio: true\`
|
|
4892
|
+
- Fast/Iterative: \`mode: "fast"\`, \`resolution: "480p"\`
|
|
4893
|
+
- Higher Quality: \`mode: "standard"\`, \`resolution: "720p"\`
|
|
4729
4894
|
|
|
4730
4895
|
- **Veo3**:
|
|
4731
4896
|
- Default: \`model: "veo3_fast"\`
|
|
@@ -4873,7 +5038,7 @@ These guidelines ensure optimal balance between quality requirements and cost ma
|
|
|
4873
5038
|
| Model | Max Resolution | Quality Modes | Duration | Speed | Key Strengths |
|
|
4874
5039
|
|-------|---------------|---------------|----------|-------|---------------|
|
|
4875
5040
|
| **Google Veo3** | 1080p | veo3/veo3_fast | Default | Medium | Premium cinematic quality, 1080p support |
|
|
4876
|
-
| **ByteDance Seedance** |
|
|
5041
|
+
| **ByteDance Seedance 2.0** | 720p | standard/fast | 4-15s | Medium | Multimodal refs, native audio, adaptive aspect |
|
|
4877
5042
|
| **Wan Video 2.5** | 1080p | Single | 5-10s | Fast | Quick generation, social media |
|
|
4878
5043
|
| **Runway Aleph** | 1080p | Single | Source | Medium | Video-to-video editing, style transfer |
|
|
4879
5044
|
|
|
@@ -4881,32 +5046,33 @@ These guidelines ensure optimal balance between quality requirements and cost ma
|
|
|
4881
5046
|
|
|
4882
5047
|
### Default Settings (Cost-Effective)
|
|
4883
5048
|
- **Resolution**: 720p (unless user requests high quality)
|
|
4884
|
-
- **Quality Mode**:
|
|
4885
|
-
- **Model**: ByteDance Seedance
|
|
5049
|
+
- **Quality Mode**: standard/fast (unless user requests "fast" explicitly)
|
|
5050
|
+
- **Model**: ByteDance Seedance 2.0 standard as default
|
|
4886
5051
|
|
|
4887
5052
|
### High Quality Upgrades
|
|
4888
|
-
- **User says "high quality"**:
|
|
4889
|
-
- **User says "high quality in 720p"**: Pro models + 720p
|
|
5053
|
+
- **User says "high quality"**: Standard mode + 720p (already default)
|
|
4890
5054
|
- **User says "cinematic"**: Veo3 model
|
|
4891
|
-
- **User says "fast/quick"**:
|
|
5055
|
+
- **User says "fast/quick"**: Seedance fast mode + 480p
|
|
4892
5056
|
|
|
4893
5057
|
## Use Case Recommendations
|
|
4894
5058
|
|
|
4895
5059
|
- **Cinematic/Premium Content**: Veo3 (model: "veo3")
|
|
4896
|
-
- **Professional/Commercial**: ByteDance Seedance (
|
|
4897
|
-
- **Social Media/Fast**:
|
|
5060
|
+
- **Professional/Commercial**: ByteDance Seedance 2.0 (mode: "standard")
|
|
5061
|
+
- **Social Media/Fast**: ByteDance Seedance 2.0 fast or Wan Video 2.5
|
|
5062
|
+
- **Multimodal (refs + audio)**: ByteDance Seedance 2.0 with reference URLs
|
|
4898
5063
|
- **Video Editing**: Runway Aleph (existing video transformation)
|
|
4899
5064
|
|
|
4900
5065
|
## Parameter Mapping
|
|
4901
5066
|
|
|
4902
5067
|
### Input Methods
|
|
4903
5068
|
- **Text-to-Video**: All models (prompt only)
|
|
4904
|
-
- **Image-to-Video**: Veo3 (imageUrls),
|
|
5069
|
+
- **Image-to-Video**: Veo3 (imageUrls), Seedance (first_frame_url), Wan (image_url)
|
|
4905
5070
|
- **Video-to-Video**: Runway Aleph (videoUrl)
|
|
5071
|
+
- **Multimodal Refs**: Seedance 2.0 (reference_image/video/audio_urls)
|
|
4906
5072
|
|
|
4907
5073
|
### Quality Control
|
|
4908
5074
|
- **Veo3**: model selection (veo3 vs veo3_fast)
|
|
4909
|
-
- **
|
|
5075
|
+
- **Seedance 2.0**: mode (standard vs fast) + resolution
|
|
4910
5076
|
- **Wan**: resolution parameter only
|
|
4911
5077
|
- **Runway**: implicit (no quality settings)
|
|
4912
5078
|
|
|
@@ -4925,7 +5091,7 @@ These guidelines ensure optimal balance between quality requirements and cost ma
|
|
|
4925
5091
|
### **CRITICAL COST CONTROL RULES**
|
|
4926
5092
|
- **Resolution**: ALWAYS use \`"720p"\` unless user explicitly requests high quality
|
|
4927
5093
|
- **Quality Level**: ALWAYS use **lite/fast** versions unless user requests "high quality"
|
|
4928
|
-
- **Model Selection**: bytedance_seedance_video with \`
|
|
5094
|
+
- **Model Selection**: bytedance_seedance_video with \`mode: "standard"\` as default
|
|
4929
5095
|
|
|
4930
5096
|
### **Quality Upgrade Logic**
|
|
4931
5097
|
|
|
@@ -5025,11 +5191,12 @@ These guidelines ensure optimal balance between quality requirements and cost ma
|
|
|
5025
5191
|
"flux-kontext": "flux_kontext_image.md",
|
|
5026
5192
|
"openai-4o-image": "openai_4o-image.md",
|
|
5027
5193
|
"nano-banana": "google_nano-banana.md",
|
|
5194
|
+
"topaz-upscale": "topaz_image-upscale.md",
|
|
5028
5195
|
"recraft-bg-removal": "recraft_remove_background.md",
|
|
5029
5196
|
"ideogram-reframe": "ideogram_reframe_image.md",
|
|
5030
5197
|
// Video models
|
|
5031
5198
|
veo3: "google_veo3-text-to-image.md",
|
|
5032
|
-
"bytedance-seedance": "bytedance_seedance-
|
|
5199
|
+
"bytedance-seedance": "bytedance_seedance-2.md",
|
|
5033
5200
|
"wan-video": "wan_2-5-text-to-video.md",
|
|
5034
5201
|
"runway-aleph": "runway_aleph_video.md",
|
|
5035
5202
|
"kling-v2-1": "kling_v2-1-pro.md",
|
package/dist/kie-ai-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KieAiConfig, KieAiResponse, NanoBananaImageRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ByteDanceSeedreamImageRequest, QwenImageRequest, MidjourneyGenerateRequest, OpenAI4oImageRequest, FluxKontextImageRequest, RecraftRemoveBackgroundRequest, IdeogramReframeRequest, KlingVideoRequest, HailuoVideoRequest, SoraVideoRequest, Flux2ImageRequest, WanAnimateRequest, ZImageRequest, GrokImagineRequest, InfiniTalkRequest, KlingAvatarRequest, ImageResponse, TaskResponse } from "./types.js";
|
|
1
|
+
import { KieAiConfig, KieAiResponse, NanoBananaImageRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ByteDanceSeedreamImageRequest, QwenImageRequest, MidjourneyGenerateRequest, OpenAI4oImageRequest, FluxKontextImageRequest, RecraftRemoveBackgroundRequest, IdeogramReframeRequest, KlingVideoRequest, HailuoVideoRequest, SoraVideoRequest, Flux2ImageRequest, WanAnimateRequest, ZImageRequest, GrokImagineRequest, InfiniTalkRequest, KlingAvatarRequest, TopazUpscaleImageRequest, ImageResponse, TaskResponse } from "./types.js";
|
|
2
2
|
export declare class KieAiClient {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config: KieAiConfig);
|
|
@@ -28,5 +28,6 @@ export declare class KieAiClient {
|
|
|
28
28
|
generateZImage(request: ZImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
29
29
|
generateGrokImagine(request: GrokImagineRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
30
30
|
generateInfiniTalk(request: InfiniTalkRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
31
|
+
generateTopazUpscaleImage(request: TopazUpscaleImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
31
32
|
generateKlingAvatar(request: KlingAvatarRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
32
33
|
}
|
package/dist/kie-ai-client.js
CHANGED
|
@@ -84,7 +84,8 @@ export class KieAiClient {
|
|
|
84
84
|
apiType === "hailuo" ||
|
|
85
85
|
apiType === "sora-video" ||
|
|
86
86
|
apiType === "flux2-image" ||
|
|
87
|
-
apiType === "wan-animate"
|
|
87
|
+
apiType === "wan-animate" ||
|
|
88
|
+
apiType === "topaz-upscale") {
|
|
88
89
|
return this.makeRequest(`/jobs/recordInfo?taskId=${taskId}`, "GET");
|
|
89
90
|
}
|
|
90
91
|
else if (apiType === "runway-aleph-video") {
|
|
@@ -186,37 +187,38 @@ export class KieAiClient {
|
|
|
186
187
|
return this.makeRequest("/jobs/createTask", "POST", jobRequest);
|
|
187
188
|
}
|
|
188
189
|
async generateByteDanceSeedanceVideo(request) {
|
|
189
|
-
//
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (isImageToVideo) {
|
|
194
|
-
model =
|
|
195
|
-
quality === "pro"
|
|
196
|
-
? "bytedance/v1-pro-image-to-video"
|
|
197
|
-
: "bytedance/v1-lite-image-to-video";
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
model =
|
|
201
|
-
quality === "pro"
|
|
202
|
-
? "bytedance/v1-pro-text-to-video"
|
|
203
|
-
: "bytedance/v1-lite-text-to-video";
|
|
204
|
-
}
|
|
190
|
+
// Seedance 2.0: two model variants
|
|
191
|
+
const model = request.mode === "fast"
|
|
192
|
+
? "bytedance/seedance-2-fast"
|
|
193
|
+
: "bytedance/seedance-2";
|
|
205
194
|
const input = {
|
|
206
195
|
prompt: request.prompt,
|
|
207
196
|
aspect_ratio: request.aspect_ratio || "16:9",
|
|
208
197
|
resolution: request.resolution || "720p",
|
|
209
|
-
duration: request.duration ||
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
enable_safety_checker: request.enable_safety_checker === true,
|
|
198
|
+
duration: request.duration || 5,
|
|
199
|
+
generate_audio: request.generate_audio !== false,
|
|
200
|
+
nsfw_checker: request.nsfw_checker === true,
|
|
213
201
|
};
|
|
214
|
-
//
|
|
215
|
-
if (
|
|
216
|
-
input.
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
202
|
+
// Frame control
|
|
203
|
+
if (request.first_frame_url) {
|
|
204
|
+
input.first_frame_url = request.first_frame_url;
|
|
205
|
+
}
|
|
206
|
+
if (request.last_frame_url) {
|
|
207
|
+
input.last_frame_url = request.last_frame_url;
|
|
208
|
+
}
|
|
209
|
+
// Multimodal references
|
|
210
|
+
if (request.reference_image_urls?.length) {
|
|
211
|
+
input.reference_image_urls = request.reference_image_urls;
|
|
212
|
+
}
|
|
213
|
+
if (request.reference_video_urls?.length) {
|
|
214
|
+
input.reference_video_urls = request.reference_video_urls;
|
|
215
|
+
}
|
|
216
|
+
if (request.reference_audio_urls?.length) {
|
|
217
|
+
input.reference_audio_urls = request.reference_audio_urls;
|
|
218
|
+
}
|
|
219
|
+
// Web search
|
|
220
|
+
if (request.web_search) {
|
|
221
|
+
input.web_search = true;
|
|
220
222
|
}
|
|
221
223
|
const jobRequest = {
|
|
222
224
|
model,
|
|
@@ -773,6 +775,17 @@ export class KieAiClient {
|
|
|
773
775
|
};
|
|
774
776
|
return this.makeRequest("/jobs/createTask", "POST", jobRequest);
|
|
775
777
|
}
|
|
778
|
+
async generateTopazUpscaleImage(request) {
|
|
779
|
+
const jobRequest = {
|
|
780
|
+
model: "topaz/image-upscale",
|
|
781
|
+
input: {
|
|
782
|
+
image_url: request.image_url,
|
|
783
|
+
upscale_factor: request.upscale_factor || "2",
|
|
784
|
+
},
|
|
785
|
+
callBackUrl: request.callBackUrl || process.env.KIE_AI_CALLBACK_URL,
|
|
786
|
+
};
|
|
787
|
+
return this.makeRequest("/jobs/createTask", "POST", jobRequest);
|
|
788
|
+
}
|
|
776
789
|
async generateKlingAvatar(request) {
|
|
777
790
|
const quality = request.quality || "standard";
|
|
778
791
|
const model = quality === "pro" ? "kling/ai-avatar-v1-pro" : "kling/v1-avatar-standard";
|