@felores/kie-ai-mcp-server 1.7.1 → 1.7.3
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/README.md +139 -1
- package/dist/index.js +313 -2
- package/dist/kie-ai-client.d.ts +3 -1
- package/dist/kie-ai-client.js +55 -1
- package/dist/types.d.ts +143 -1
- package/dist/types.js +73 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Access the world's best AI models through a single, developer-friendly API. Gene
|
|
|
22
22
|
- **Nano Banana**: Lightning-fast image generation and editing
|
|
23
23
|
- **ElevenLabs**: Studio-quality text-to-speech and sound effects
|
|
24
24
|
- **ByteDance Seedance**: High-quality video with text-to-video and image-to-video
|
|
25
|
+
- **ByteDance Seedream V4**: Advanced image generation and editing with unified interface
|
|
26
|
+
- **Qwen**: Powerful image generation and editing with acceleration options
|
|
25
27
|
|
|
26
28
|
### 💰 **Affordable Pricing**
|
|
27
29
|
Pay-as-you-go credit system means you only pay for what you use. Good for startups and enterprises looking to reduce AI costs.
|
|
@@ -515,7 +517,143 @@ Video with specific ending frame:
|
|
|
515
517
|
|
|
516
518
|
**Note**: The `callBackUrl` is optional and will use the `KIE_AI_CALLBACK_URL` environment variable if not provided. Video generation typically takes 2-5 minutes depending on quality and complexity.
|
|
517
519
|
|
|
518
|
-
### 13. `
|
|
520
|
+
### 13. `bytedance_seedream_image`
|
|
521
|
+
Generate and edit images using ByteDance Seedream V4 models (unified tool for both text-to-image and image editing).
|
|
522
|
+
|
|
523
|
+
**Parameters:**
|
|
524
|
+
- `prompt` (string, required): Text prompt for image generation or editing (max 10000 chars)
|
|
525
|
+
- `image_urls` (array, optional): Array of image URLs for editing mode (1-10 images, if not provided, uses text-to-image)
|
|
526
|
+
- `image_size` (string, optional): Image aspect ratio (default: "1:1")
|
|
527
|
+
- Options: `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `21:9`, `9:21`, `3:2`, `2:3`
|
|
528
|
+
- `image_resolution` (string, optional): Image resolution (default: "1K")
|
|
529
|
+
- `1K`: Standard resolution (1024px on shortest side)
|
|
530
|
+
- `2K`: High resolution (2048px on shortest side)
|
|
531
|
+
- `4K`: Ultra high resolution (4096px on shortest side)
|
|
532
|
+
- `max_images` (integer, optional): Number of images to generate (1-6, default: 1)
|
|
533
|
+
- `seed` (integer, optional): Random seed for reproducible results (default: -1 for random)
|
|
534
|
+
- `callBackUrl` (string, optional): URL for task completion notifications
|
|
535
|
+
|
|
536
|
+
**Examples:**
|
|
537
|
+
|
|
538
|
+
Text-to-image generation:
|
|
539
|
+
```json
|
|
540
|
+
{
|
|
541
|
+
"prompt": "A majestic dragon perched atop a crystal mountain at sunset, digital art style",
|
|
542
|
+
"image_size": "16:9",
|
|
543
|
+
"image_resolution": "2K",
|
|
544
|
+
"max_images": 2,
|
|
545
|
+
"seed": 42
|
|
546
|
+
}
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
Image editing:
|
|
550
|
+
```json
|
|
551
|
+
{
|
|
552
|
+
"prompt": "Transform the day scene into a magical night with glowing stars and moonlight",
|
|
553
|
+
"image_urls": ["https://example.com/day-landscape.jpg"],
|
|
554
|
+
"image_size": "16:9",
|
|
555
|
+
"image_resolution": "2K",
|
|
556
|
+
"max_images": 1
|
|
557
|
+
}
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
Multiple image editing:
|
|
561
|
+
```json
|
|
562
|
+
{
|
|
563
|
+
"prompt": "Apply a consistent cyberpunk aesthetic to all images with neon lights and futuristic elements",
|
|
564
|
+
"image_urls": [
|
|
565
|
+
"https://example.com/character1.jpg",
|
|
566
|
+
"https://example.com/character2.jpg",
|
|
567
|
+
"https://example.com/background.jpg"
|
|
568
|
+
],
|
|
569
|
+
"image_resolution": "4K",
|
|
570
|
+
"max_images": 3
|
|
571
|
+
}
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
**Key Features:**
|
|
575
|
+
- **Unified Interface**: Single tool for both text-to-image and image editing
|
|
576
|
+
- **Smart Mode Detection**: Automatically detects mode based on presence of `image_urls`
|
|
577
|
+
- **High Resolution**: Support for 1K, 2K, and 4K output
|
|
578
|
+
- **Multiple Images**: Generate up to 6 images in a single request
|
|
579
|
+
- **Batch Editing**: Edit up to 10 images simultaneously with consistent style
|
|
580
|
+
- **Reproducible Results**: Seed control for consistent output
|
|
581
|
+
|
|
582
|
+
**Note**: The `callBackUrl` is optional and will use the `KIE_AI_CALLBACK_URL` environment variable if not provided. Image generation typically takes 30-120 seconds depending on resolution and complexity.
|
|
583
|
+
|
|
584
|
+
### 14. `qwen_image`
|
|
585
|
+
Generate and edit images using Qwen models (unified tool for both text-to-image and image editing).
|
|
586
|
+
|
|
587
|
+
**Parameters:**
|
|
588
|
+
- `prompt` (string, required): Text prompt for image generation or editing
|
|
589
|
+
- `image_url` (string, optional): URL of image to edit (if not provided, uses text-to-image)
|
|
590
|
+
- `image_size` (string, optional): Image size (default: "square_hd")
|
|
591
|
+
- Options: `square`, `square_hd`, `portrait_4_3`, `portrait_16_9`, `landscape_4_3`, `landscape_16_9`
|
|
592
|
+
- `num_inference_steps` (integer, optional): Number of inference steps (default: 30 for text-to-image, 25 for edit)
|
|
593
|
+
- Text-to-image: 2-250, Edit: 2-49
|
|
594
|
+
- `guidance_scale` (number, optional): CFG scale (default: 2.5 for text-to-image, 4 for edit)
|
|
595
|
+
- Range: 0-20
|
|
596
|
+
- `enable_safety_checker` (boolean, optional): Enable safety checker (default: true)
|
|
597
|
+
- `output_format` (string, optional): Output format (default: "png")
|
|
598
|
+
- Options: `png`, `jpeg`
|
|
599
|
+
- `negative_prompt` (string, optional): Negative prompt (max 500 chars, default: " ")
|
|
600
|
+
- `acceleration` (string, optional): Acceleration level (default: "none")
|
|
601
|
+
- Options: `none`, `regular`, `high`
|
|
602
|
+
- `num_images` (string, optional): Number of images (edit mode only)
|
|
603
|
+
- Options: `1`, `2`, `3`, `4`
|
|
604
|
+
- `sync_mode` (boolean, optional): Sync mode (edit mode only, default: false)
|
|
605
|
+
- `seed` (number, optional): Random seed for reproducible results
|
|
606
|
+
- `callBackUrl` (string, optional): URL for task completion notifications
|
|
607
|
+
|
|
608
|
+
**Examples:**
|
|
609
|
+
|
|
610
|
+
Text-to-image generation:
|
|
611
|
+
```json
|
|
612
|
+
{
|
|
613
|
+
"prompt": "A beautiful landscape with mountains and a lake at sunset",
|
|
614
|
+
"image_size": "landscape_16_9",
|
|
615
|
+
"num_inference_steps": 30,
|
|
616
|
+
"guidance_scale": 2.5,
|
|
617
|
+
"output_format": "png",
|
|
618
|
+
"seed": 42
|
|
619
|
+
}
|
|
620
|
+
```
|
|
621
|
+
|
|
622
|
+
Image editing:
|
|
623
|
+
```json
|
|
624
|
+
{
|
|
625
|
+
"prompt": "Change the day scene to night with stars and moonlight",
|
|
626
|
+
"image_url": "https://example.com/day-landscape.jpg",
|
|
627
|
+
"image_size": "landscape_16_9",
|
|
628
|
+
"num_inference_steps": 25,
|
|
629
|
+
"guidance_scale": 4,
|
|
630
|
+
"num_images": "2",
|
|
631
|
+
"output_format": "png"
|
|
632
|
+
}
|
|
633
|
+
```
|
|
634
|
+
|
|
635
|
+
High-acceleration generation:
|
|
636
|
+
```json
|
|
637
|
+
{
|
|
638
|
+
"prompt": "A futuristic city with flying cars",
|
|
639
|
+
"image_size": "square_hd",
|
|
640
|
+
"acceleration": "high",
|
|
641
|
+
"enable_safety_checker": true,
|
|
642
|
+
"negative_prompt": "blurry, low quality"
|
|
643
|
+
}
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**Key Features:**
|
|
647
|
+
- **Unified Interface**: Single tool for both text-to-image and image editing
|
|
648
|
+
- **Smart Mode Detection**: Automatically detects mode based on presence of `image_url`
|
|
649
|
+
- **Flexible Sizing**: Support for multiple aspect ratios and resolutions
|
|
650
|
+
- **Acceleration Options**: Speed up generation with acceleration levels
|
|
651
|
+
- **Batch Generation**: Generate multiple images in edit mode
|
|
652
|
+
- **Reproducible Results**: Seed control for consistent output
|
|
653
|
+
|
|
654
|
+
**Note**: The `callBackUrl` is optional and will use the `KIE_AI_CALLBACK_URL` environment variable if not provided. Image generation typically takes 10-60 seconds depending on settings and acceleration level.
|
|
655
|
+
|
|
656
|
+
### 15. `runway_aleph_video`
|
|
519
657
|
Transform videos using Runway Aleph video-to-video generation with AI-powered editing.
|
|
520
658
|
|
|
521
659
|
**Parameters:**
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } f
|
|
|
5
5
|
import { KieAiClient } from './kie-ai-client.js';
|
|
6
6
|
import { TaskDatabase } from './database.js';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { NanoBananaGenerateSchema, NanoBananaEditSchema, NanoBananaUpscaleSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, RunwayAlephVideoSchema, WanVideoSchema } from './types.js';
|
|
8
|
+
import { NanoBananaGenerateSchema, NanoBananaEditSchema, NanoBananaUpscaleSchema, Veo3GenerateSchema, SunoGenerateSchema, ElevenLabsTTSSchema, ElevenLabsSoundEffectsSchema, ByteDanceSeedanceVideoSchema, ByteDanceSeedreamImageSchema, QwenImageSchema, RunwayAlephVideoSchema, WanVideoSchema } from './types.js';
|
|
9
9
|
class KieAiMcpServer {
|
|
10
10
|
server;
|
|
11
11
|
client;
|
|
@@ -13,7 +13,7 @@ class KieAiMcpServer {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
this.server = new Server({
|
|
15
15
|
name: 'kie-ai-mcp-server',
|
|
16
|
-
version: '1.7.
|
|
16
|
+
version: '1.7.3',
|
|
17
17
|
});
|
|
18
18
|
// Initialize client with config from environment
|
|
19
19
|
const config = {
|
|
@@ -551,6 +551,143 @@ class KieAiMcpServer {
|
|
|
551
551
|
required: ['prompt']
|
|
552
552
|
}
|
|
553
553
|
},
|
|
554
|
+
{
|
|
555
|
+
name: 'bytedance_seedream_image',
|
|
556
|
+
description: 'Generate and edit images using ByteDance Seedream V4 models (unified tool for both text-to-image and image editing)',
|
|
557
|
+
inputSchema: {
|
|
558
|
+
type: 'object',
|
|
559
|
+
properties: {
|
|
560
|
+
prompt: {
|
|
561
|
+
type: 'string',
|
|
562
|
+
description: 'Text prompt for image generation or editing (max 10000 characters)',
|
|
563
|
+
minLength: 1,
|
|
564
|
+
maxLength: 10000
|
|
565
|
+
},
|
|
566
|
+
image_urls: {
|
|
567
|
+
type: 'array',
|
|
568
|
+
description: 'Array of image URLs for editing mode (optional - if not provided, uses text-to-image)',
|
|
569
|
+
items: {
|
|
570
|
+
type: 'string',
|
|
571
|
+
format: 'uri'
|
|
572
|
+
},
|
|
573
|
+
minItems: 1,
|
|
574
|
+
maxItems: 10
|
|
575
|
+
},
|
|
576
|
+
image_size: {
|
|
577
|
+
type: 'string',
|
|
578
|
+
description: 'Image aspect ratio',
|
|
579
|
+
enum: ['1:1', '4:3', '3:4', '16:9', '9:16', '21:9', '9:21', '3:2', '2:3'],
|
|
580
|
+
default: '1:1'
|
|
581
|
+
},
|
|
582
|
+
image_resolution: {
|
|
583
|
+
type: 'string',
|
|
584
|
+
description: 'Image resolution',
|
|
585
|
+
enum: ['1K', '2K', '4K'],
|
|
586
|
+
default: '1K'
|
|
587
|
+
},
|
|
588
|
+
max_images: {
|
|
589
|
+
type: 'integer',
|
|
590
|
+
description: 'Number of images to generate',
|
|
591
|
+
minimum: 1,
|
|
592
|
+
maximum: 6,
|
|
593
|
+
default: 1
|
|
594
|
+
},
|
|
595
|
+
seed: {
|
|
596
|
+
type: 'integer',
|
|
597
|
+
description: 'Random seed for reproducible results (use -1 for random)',
|
|
598
|
+
default: -1
|
|
599
|
+
},
|
|
600
|
+
callBackUrl: {
|
|
601
|
+
type: 'string',
|
|
602
|
+
description: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)',
|
|
603
|
+
format: 'uri'
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
required: ['prompt']
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
name: 'qwen_image',
|
|
611
|
+
description: 'Generate and edit images using Qwen models (unified tool for both text-to-image and image editing)',
|
|
612
|
+
inputSchema: {
|
|
613
|
+
type: 'object',
|
|
614
|
+
properties: {
|
|
615
|
+
prompt: {
|
|
616
|
+
type: 'string',
|
|
617
|
+
description: 'Text prompt for image generation or editing',
|
|
618
|
+
minLength: 1
|
|
619
|
+
},
|
|
620
|
+
image_url: {
|
|
621
|
+
type: 'string',
|
|
622
|
+
description: 'URL of image to edit (optional - if not provided, uses text-to-image)',
|
|
623
|
+
format: 'uri'
|
|
624
|
+
},
|
|
625
|
+
image_size: {
|
|
626
|
+
type: 'string',
|
|
627
|
+
description: 'Image size',
|
|
628
|
+
enum: ['square', 'square_hd', 'portrait_4_3', 'portrait_16_9', 'landscape_4_3', 'landscape_16_9'],
|
|
629
|
+
default: 'square_hd'
|
|
630
|
+
},
|
|
631
|
+
num_inference_steps: {
|
|
632
|
+
type: 'integer',
|
|
633
|
+
description: 'Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
634
|
+
minimum: 2,
|
|
635
|
+
maximum: 250,
|
|
636
|
+
default: 30
|
|
637
|
+
},
|
|
638
|
+
guidance_scale: {
|
|
639
|
+
type: 'number',
|
|
640
|
+
description: 'CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
641
|
+
minimum: 0,
|
|
642
|
+
maximum: 20,
|
|
643
|
+
default: 2.5
|
|
644
|
+
},
|
|
645
|
+
enable_safety_checker: {
|
|
646
|
+
type: 'boolean',
|
|
647
|
+
description: 'Enable safety checker',
|
|
648
|
+
default: true
|
|
649
|
+
},
|
|
650
|
+
output_format: {
|
|
651
|
+
type: 'string',
|
|
652
|
+
description: 'Output format',
|
|
653
|
+
enum: ['png', 'jpeg'],
|
|
654
|
+
default: 'png'
|
|
655
|
+
},
|
|
656
|
+
negative_prompt: {
|
|
657
|
+
type: 'string',
|
|
658
|
+
description: 'Negative prompt (max 500 characters)',
|
|
659
|
+
maxLength: 500,
|
|
660
|
+
default: ' '
|
|
661
|
+
},
|
|
662
|
+
acceleration: {
|
|
663
|
+
type: 'string',
|
|
664
|
+
description: 'Acceleration level',
|
|
665
|
+
enum: ['none', 'regular', 'high'],
|
|
666
|
+
default: 'none'
|
|
667
|
+
},
|
|
668
|
+
num_images: {
|
|
669
|
+
type: 'string',
|
|
670
|
+
description: 'Number of images (1-4, edit mode only)',
|
|
671
|
+
enum: ['1', '2', '3', '4']
|
|
672
|
+
},
|
|
673
|
+
sync_mode: {
|
|
674
|
+
type: 'boolean',
|
|
675
|
+
description: 'Sync mode (edit mode only)',
|
|
676
|
+
default: false
|
|
677
|
+
},
|
|
678
|
+
seed: {
|
|
679
|
+
type: 'number',
|
|
680
|
+
description: 'Random seed for reproducible results'
|
|
681
|
+
},
|
|
682
|
+
callBackUrl: {
|
|
683
|
+
type: 'string',
|
|
684
|
+
description: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)',
|
|
685
|
+
format: 'uri'
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
required: ['prompt']
|
|
689
|
+
}
|
|
690
|
+
},
|
|
554
691
|
{
|
|
555
692
|
name: 'runway_aleph_video',
|
|
556
693
|
description: 'Transform videos using Runway Aleph video-to-video generation with AI-powered editing',
|
|
@@ -693,6 +830,10 @@ class KieAiMcpServer {
|
|
|
693
830
|
return await this.handleElevenLabsSoundEffects(args);
|
|
694
831
|
case 'bytedance_seedance_video':
|
|
695
832
|
return await this.handleByteDanceSeedanceVideo(args);
|
|
833
|
+
case 'bytedance_seedream_image':
|
|
834
|
+
return await this.handleByteDanceSeedreamImage(args);
|
|
835
|
+
case 'qwen_image':
|
|
836
|
+
return await this.handleQwenImage(args);
|
|
696
837
|
case 'runway_aleph_video':
|
|
697
838
|
return await this.handleRunwayAlephVideo(args);
|
|
698
839
|
case 'wan_video':
|
|
@@ -1383,6 +1524,176 @@ class KieAiMcpServer {
|
|
|
1383
1524
|
});
|
|
1384
1525
|
}
|
|
1385
1526
|
}
|
|
1527
|
+
async handleByteDanceSeedreamImage(args) {
|
|
1528
|
+
try {
|
|
1529
|
+
const request = ByteDanceSeedreamImageSchema.parse(args);
|
|
1530
|
+
// Use environment variable as fallback if callBackUrl not provided
|
|
1531
|
+
if (!request.callBackUrl && process.env.KIE_AI_CALLBACK_URL) {
|
|
1532
|
+
request.callBackUrl = process.env.KIE_AI_CALLBACK_URL;
|
|
1533
|
+
}
|
|
1534
|
+
const response = await this.client.generateByteDanceSeedreamImage(request);
|
|
1535
|
+
if (response.code === 200 && response.data?.taskId) {
|
|
1536
|
+
// Determine mode for user feedback
|
|
1537
|
+
const isEdit = !!request.image_urls && request.image_urls.length > 0;
|
|
1538
|
+
const mode = isEdit ? 'Image Editing' : 'Text-to-Image';
|
|
1539
|
+
// Store task in database
|
|
1540
|
+
await this.db.createTask({
|
|
1541
|
+
task_id: response.data.taskId,
|
|
1542
|
+
api_type: 'bytedance-seedream-image',
|
|
1543
|
+
status: 'pending'
|
|
1544
|
+
});
|
|
1545
|
+
return {
|
|
1546
|
+
content: [
|
|
1547
|
+
{
|
|
1548
|
+
type: 'text',
|
|
1549
|
+
text: JSON.stringify({
|
|
1550
|
+
success: true,
|
|
1551
|
+
task_id: response.data.taskId,
|
|
1552
|
+
message: `ByteDance Seedream V4 ${mode} task created successfully`,
|
|
1553
|
+
parameters: {
|
|
1554
|
+
mode: mode,
|
|
1555
|
+
prompt: request.prompt.substring(0, 100) + (request.prompt.length > 100 ? '...' : ''),
|
|
1556
|
+
image_size: request.image_size || '1:1',
|
|
1557
|
+
image_resolution: request.image_resolution || '1K',
|
|
1558
|
+
max_images: request.max_images || 1,
|
|
1559
|
+
seed: request.seed !== undefined ? request.seed : -1,
|
|
1560
|
+
...(isEdit && { image_urls_count: request.image_urls?.length || 0 })
|
|
1561
|
+
},
|
|
1562
|
+
next_steps: [
|
|
1563
|
+
`Use get_task_status with task_id: ${response.data.taskId} to check progress`,
|
|
1564
|
+
'Generated images will be available when status is "completed"'
|
|
1565
|
+
],
|
|
1566
|
+
usage_examples: [
|
|
1567
|
+
`get_task_status: {"task_id": "${response.data.taskId}"}`,
|
|
1568
|
+
`list_tasks: {"limit": 10}`
|
|
1569
|
+
]
|
|
1570
|
+
}, null, 2)
|
|
1571
|
+
}
|
|
1572
|
+
]
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
else {
|
|
1576
|
+
throw new Error(response.msg || 'Failed to create ByteDance Seedream V4 image task');
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
catch (error) {
|
|
1580
|
+
if (error instanceof z.ZodError) {
|
|
1581
|
+
return this.formatError('bytedance_seedream_image', error, {
|
|
1582
|
+
prompt: 'Required: Text prompt for image generation or editing (max 10000 characters)',
|
|
1583
|
+
image_urls: 'Optional: Array of image URLs for editing mode (1-10 images)',
|
|
1584
|
+
image_size: 'Optional: Image aspect ratio (default: 1:1)',
|
|
1585
|
+
image_resolution: 'Optional: Image resolution - 1K/2K/4K (default: 1K)',
|
|
1586
|
+
max_images: 'Optional: Number of images to generate (1-6, default: 1)',
|
|
1587
|
+
seed: 'Optional: Random seed for reproducible results (default: -1 for random)',
|
|
1588
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
return this.formatError('bytedance_seedream_image', error, {
|
|
1592
|
+
prompt: 'Required: Text prompt for image generation or editing (max 10000 characters)',
|
|
1593
|
+
image_urls: 'Optional: Array of image URLs for editing mode (1-10 images)',
|
|
1594
|
+
image_size: 'Optional: Image aspect ratio (default: 1:1)',
|
|
1595
|
+
image_resolution: 'Optional: Image resolution - 1K/2K/4K (default: 1K)',
|
|
1596
|
+
max_images: 'Optional: Number of images to generate (1-6, default: 1)',
|
|
1597
|
+
seed: 'Optional: Random seed for reproducible results (default: -1 for random)',
|
|
1598
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
async handleQwenImage(args) {
|
|
1603
|
+
try {
|
|
1604
|
+
const request = QwenImageSchema.parse(args);
|
|
1605
|
+
// Use environment variable as fallback if callBackUrl not provided
|
|
1606
|
+
if (!request.callBackUrl && process.env.KIE_AI_CALLBACK_URL) {
|
|
1607
|
+
request.callBackUrl = process.env.KIE_AI_CALLBACK_URL;
|
|
1608
|
+
}
|
|
1609
|
+
const response = await this.client.generateQwenImage(request);
|
|
1610
|
+
if (response.code === 200 && response.data?.taskId) {
|
|
1611
|
+
// Determine mode for user feedback
|
|
1612
|
+
const isEdit = !!request.image_url;
|
|
1613
|
+
const mode = isEdit ? 'Image Editing' : 'Text-to-Image';
|
|
1614
|
+
// Store task in database
|
|
1615
|
+
await this.db.createTask({
|
|
1616
|
+
task_id: response.data.taskId,
|
|
1617
|
+
api_type: 'qwen-image',
|
|
1618
|
+
status: 'pending'
|
|
1619
|
+
});
|
|
1620
|
+
return {
|
|
1621
|
+
content: [
|
|
1622
|
+
{
|
|
1623
|
+
type: 'text',
|
|
1624
|
+
text: JSON.stringify({
|
|
1625
|
+
success: true,
|
|
1626
|
+
task_id: response.data.taskId,
|
|
1627
|
+
message: `Qwen ${mode} task created successfully`,
|
|
1628
|
+
parameters: {
|
|
1629
|
+
mode: mode,
|
|
1630
|
+
prompt: request.prompt.substring(0, 100) + (request.prompt.length > 100 ? '...' : ''),
|
|
1631
|
+
image_size: request.image_size || 'square_hd',
|
|
1632
|
+
num_inference_steps: request.num_inference_steps || (isEdit ? 25 : 30),
|
|
1633
|
+
guidance_scale: request.guidance_scale || (isEdit ? 4 : 2.5),
|
|
1634
|
+
enable_safety_checker: request.enable_safety_checker !== false,
|
|
1635
|
+
output_format: request.output_format || 'png',
|
|
1636
|
+
negative_prompt: request.negative_prompt || (isEdit ? 'blurry, ugly' : ' '),
|
|
1637
|
+
acceleration: request.acceleration || 'none',
|
|
1638
|
+
seed: request.seed,
|
|
1639
|
+
...(isEdit && {
|
|
1640
|
+
image_url: request.image_url,
|
|
1641
|
+
num_images: request.num_images,
|
|
1642
|
+
sync_mode: request.sync_mode
|
|
1643
|
+
})
|
|
1644
|
+
},
|
|
1645
|
+
next_steps: [
|
|
1646
|
+
`Use get_task_status with task_id: ${response.data.taskId} to check progress`,
|
|
1647
|
+
'Generated images will be available when status is "completed"'
|
|
1648
|
+
],
|
|
1649
|
+
usage_examples: [
|
|
1650
|
+
`get_task_status: {"task_id": "${response.data.taskId}"}`,
|
|
1651
|
+
`list_tasks: {"limit": 10}`
|
|
1652
|
+
]
|
|
1653
|
+
}, null, 2)
|
|
1654
|
+
}
|
|
1655
|
+
]
|
|
1656
|
+
};
|
|
1657
|
+
}
|
|
1658
|
+
else {
|
|
1659
|
+
throw new Error(response.msg || 'Failed to create Qwen image task');
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
catch (error) {
|
|
1663
|
+
if (error instanceof z.ZodError) {
|
|
1664
|
+
return this.formatError('qwen_image', error, {
|
|
1665
|
+
prompt: 'Required: Text prompt for image generation or editing',
|
|
1666
|
+
image_url: 'Optional: URL of image to edit (required for edit mode)',
|
|
1667
|
+
image_size: 'Optional: Image size (square, square_hd, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9)',
|
|
1668
|
+
num_inference_steps: 'Optional: Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
1669
|
+
guidance_scale: 'Optional: CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
1670
|
+
enable_safety_checker: 'Optional: Enable safety checker (default: true)',
|
|
1671
|
+
output_format: 'Optional: Output format (png/jpeg, default: png)',
|
|
1672
|
+
negative_prompt: 'Optional: Negative prompt (max 500 chars)',
|
|
1673
|
+
acceleration: 'Optional: Acceleration level (none/regular/high, default: none)',
|
|
1674
|
+
num_images: 'Optional: Number of images (1-4, edit mode only)',
|
|
1675
|
+
sync_mode: 'Optional: Sync mode (edit mode only)',
|
|
1676
|
+
seed: 'Optional: Random seed for reproducible results',
|
|
1677
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1678
|
+
});
|
|
1679
|
+
}
|
|
1680
|
+
return this.formatError('qwen_image', error, {
|
|
1681
|
+
prompt: 'Required: Text prompt for image generation or editing',
|
|
1682
|
+
image_url: 'Optional: URL of image to edit (required for edit mode)',
|
|
1683
|
+
image_size: 'Optional: Image size (square, square_hd, portrait_4_3, portrait_16_9, landscape_4_3, landscape_16_9)',
|
|
1684
|
+
num_inference_steps: 'Optional: Number of inference steps (2-250 for text-to-image, 2-49 for edit)',
|
|
1685
|
+
guidance_scale: 'Optional: CFG scale (0-20, default: 2.5 for text-to-image, 4 for edit)',
|
|
1686
|
+
enable_safety_checker: 'Optional: Enable safety checker (default: true)',
|
|
1687
|
+
output_format: 'Optional: Output format (png/jpeg, default: png)',
|
|
1688
|
+
negative_prompt: 'Optional: Negative prompt (max 500 chars)',
|
|
1689
|
+
acceleration: 'Optional: Acceleration level (none/regular/high, default: none)',
|
|
1690
|
+
num_images: 'Optional: Number of images (1-4, edit mode only)',
|
|
1691
|
+
sync_mode: 'Optional: Sync mode (edit mode only)',
|
|
1692
|
+
seed: 'Optional: Random seed for reproducible results',
|
|
1693
|
+
callBackUrl: 'Optional: URL for task completion notifications (uses KIE_AI_CALLBACK_URL env var if not provided)'
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1386
1697
|
async handleRunwayAlephVideo(args) {
|
|
1387
1698
|
try {
|
|
1388
1699
|
const request = RunwayAlephVideoSchema.parse(args);
|
package/dist/kie-ai-client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KieAiConfig, KieAiResponse, NanoBananaGenerateRequest, NanaBananaEditRequest, NanoBananaUpscaleRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ImageResponse, TaskResponse } from './types.js';
|
|
1
|
+
import { KieAiConfig, KieAiResponse, NanoBananaGenerateRequest, NanaBananaEditRequest, NanoBananaUpscaleRequest, Veo3GenerateRequest, SunoGenerateRequest, ElevenLabsTTSRequest, ElevenLabsSoundEffectsRequest, ByteDanceSeedanceVideoRequest, RunwayAlephVideoRequest, WanVideoRequest, ByteDanceSeedreamImageRequest, QwenImageRequest, ImageResponse, TaskResponse } from './types.js';
|
|
2
2
|
export declare class KieAiClient {
|
|
3
3
|
private config;
|
|
4
4
|
constructor(config: KieAiConfig);
|
|
@@ -14,5 +14,7 @@ export declare class KieAiClient {
|
|
|
14
14
|
generateByteDanceSeedanceVideo(request: ByteDanceSeedanceVideoRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
15
15
|
generateRunwayAlephVideo(request: RunwayAlephVideoRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
16
16
|
generateWanVideo(request: WanVideoRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
17
|
+
generateByteDanceSeedreamImage(request: ByteDanceSeedreamImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
18
|
+
generateQwenImage(request: QwenImageRequest): Promise<KieAiResponse<TaskResponse>>;
|
|
17
19
|
getVeo1080pVideo(taskId: string, index?: number): Promise<KieAiResponse<any>>;
|
|
18
20
|
}
|
package/dist/kie-ai-client.js
CHANGED
|
@@ -80,7 +80,7 @@ export class KieAiClient {
|
|
|
80
80
|
else if (apiType === 'suno') {
|
|
81
81
|
return this.makeRequest(`/generate/record-info?taskId=${taskId}`, 'GET');
|
|
82
82
|
}
|
|
83
|
-
else if (apiType === 'elevenlabs-tts' || apiType === 'elevenlabs-sound-effects' || apiType === 'bytedance-seedance-video' || apiType === 'wan-video') {
|
|
83
|
+
else if (apiType === 'elevenlabs-tts' || apiType === 'elevenlabs-sound-effects' || apiType === 'bytedance-seedance-video' || apiType === 'bytedance-seedream-image' || apiType === 'qwen-image' || apiType === 'wan-video') {
|
|
84
84
|
return this.makeRequest(`/jobs/recordInfo?taskId=${taskId}`, 'GET');
|
|
85
85
|
}
|
|
86
86
|
else if (apiType === 'runway-aleph-video') {
|
|
@@ -232,6 +232,60 @@ export class KieAiClient {
|
|
|
232
232
|
};
|
|
233
233
|
return this.makeRequest('/jobs/createTask', 'POST', jobRequest);
|
|
234
234
|
}
|
|
235
|
+
async generateByteDanceSeedreamImage(request) {
|
|
236
|
+
// Determine mode based on presence of image_urls
|
|
237
|
+
const isEdit = !!request.image_urls && request.image_urls.length > 0;
|
|
238
|
+
const model = isEdit ? 'bytedance/seedream-v4-edit' : 'bytedance/seedream-v4-text-to-image';
|
|
239
|
+
const input = {
|
|
240
|
+
prompt: request.prompt,
|
|
241
|
+
image_size: request.image_size || '1:1',
|
|
242
|
+
image_resolution: request.image_resolution || '1K',
|
|
243
|
+
max_images: request.max_images || 1,
|
|
244
|
+
seed: request.seed !== undefined ? request.seed : -1
|
|
245
|
+
};
|
|
246
|
+
// Add edit-specific parameters
|
|
247
|
+
if (isEdit) {
|
|
248
|
+
input.image_urls = request.image_urls;
|
|
249
|
+
}
|
|
250
|
+
const jobRequest = {
|
|
251
|
+
model,
|
|
252
|
+
input,
|
|
253
|
+
callBackUrl: request.callBackUrl || process.env.KIE_AI_CALLBACK_URL
|
|
254
|
+
};
|
|
255
|
+
return this.makeRequest('/jobs/createTask', 'POST', jobRequest);
|
|
256
|
+
}
|
|
257
|
+
async generateQwenImage(request) {
|
|
258
|
+
// Determine mode based on presence of image_url
|
|
259
|
+
const isEdit = !!request.image_url;
|
|
260
|
+
const model = isEdit ? 'qwen/image-edit' : 'qwen/text-to-image';
|
|
261
|
+
const input = {
|
|
262
|
+
prompt: request.prompt,
|
|
263
|
+
image_size: request.image_size || 'square_hd',
|
|
264
|
+
num_inference_steps: request.num_inference_steps || (isEdit ? 25 : 30),
|
|
265
|
+
seed: request.seed,
|
|
266
|
+
guidance_scale: request.guidance_scale || (isEdit ? 4 : 2.5),
|
|
267
|
+
enable_safety_checker: request.enable_safety_checker !== false,
|
|
268
|
+
output_format: request.output_format || 'png',
|
|
269
|
+
negative_prompt: request.negative_prompt || (isEdit ? 'blurry, ugly' : ' '),
|
|
270
|
+
acceleration: request.acceleration || 'none'
|
|
271
|
+
};
|
|
272
|
+
// Add edit-specific parameters
|
|
273
|
+
if (isEdit) {
|
|
274
|
+
input.image_url = request.image_url;
|
|
275
|
+
if (request.num_images) {
|
|
276
|
+
input.num_images = request.num_images;
|
|
277
|
+
}
|
|
278
|
+
if (request.sync_mode !== undefined) {
|
|
279
|
+
input.sync_mode = request.sync_mode;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const jobRequest = {
|
|
283
|
+
model,
|
|
284
|
+
input,
|
|
285
|
+
callBackUrl: request.callBackUrl || process.env.KIE_AI_CALLBACK_URL
|
|
286
|
+
};
|
|
287
|
+
return this.makeRequest('/jobs/createTask', 'POST', jobRequest);
|
|
288
|
+
}
|
|
235
289
|
async getVeo1080pVideo(taskId, index) {
|
|
236
290
|
const params = new URLSearchParams({ taskId });
|
|
237
291
|
if (index !== undefined) {
|
package/dist/types.d.ts
CHANGED
|
@@ -402,6 +402,146 @@ export declare const WanVideoSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
402
402
|
negative_prompt?: string | undefined;
|
|
403
403
|
enable_prompt_expansion?: boolean | undefined;
|
|
404
404
|
}>;
|
|
405
|
+
export declare const ByteDanceSeedreamImageSchema: z.ZodEffects<z.ZodObject<{
|
|
406
|
+
prompt: z.ZodString;
|
|
407
|
+
image_urls: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
408
|
+
image_size: z.ZodOptional<z.ZodDefault<z.ZodEnum<["square", "square_hd", "portrait_4_3", "portrait_3_2", "portrait_16_9", "landscape_4_3", "landscape_3_2", "landscape_16_9", "landscape_21_9"]>>>;
|
|
409
|
+
image_resolution: z.ZodOptional<z.ZodDefault<z.ZodEnum<["1K", "2K", "4K"]>>>;
|
|
410
|
+
max_images: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
411
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
412
|
+
callBackUrl: z.ZodOptional<z.ZodString>;
|
|
413
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
|
+
prompt: string;
|
|
415
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_3_2" | "portrait_16_9" | "landscape_4_3" | "landscape_3_2" | "landscape_16_9" | "landscape_21_9" | undefined;
|
|
416
|
+
image_urls?: string[] | undefined;
|
|
417
|
+
callBackUrl?: string | undefined;
|
|
418
|
+
seed?: number | undefined;
|
|
419
|
+
image_resolution?: "1K" | "2K" | "4K" | undefined;
|
|
420
|
+
max_images?: number | undefined;
|
|
421
|
+
}, {
|
|
422
|
+
prompt: string;
|
|
423
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_3_2" | "portrait_16_9" | "landscape_4_3" | "landscape_3_2" | "landscape_16_9" | "landscape_21_9" | undefined;
|
|
424
|
+
image_urls?: string[] | undefined;
|
|
425
|
+
callBackUrl?: string | undefined;
|
|
426
|
+
seed?: number | undefined;
|
|
427
|
+
image_resolution?: "1K" | "2K" | "4K" | undefined;
|
|
428
|
+
max_images?: number | undefined;
|
|
429
|
+
}>, {
|
|
430
|
+
prompt: string;
|
|
431
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_3_2" | "portrait_16_9" | "landscape_4_3" | "landscape_3_2" | "landscape_16_9" | "landscape_21_9" | undefined;
|
|
432
|
+
image_urls?: string[] | undefined;
|
|
433
|
+
callBackUrl?: string | undefined;
|
|
434
|
+
seed?: number | undefined;
|
|
435
|
+
image_resolution?: "1K" | "2K" | "4K" | undefined;
|
|
436
|
+
max_images?: number | undefined;
|
|
437
|
+
}, {
|
|
438
|
+
prompt: string;
|
|
439
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_3_2" | "portrait_16_9" | "landscape_4_3" | "landscape_3_2" | "landscape_16_9" | "landscape_21_9" | undefined;
|
|
440
|
+
image_urls?: string[] | undefined;
|
|
441
|
+
callBackUrl?: string | undefined;
|
|
442
|
+
seed?: number | undefined;
|
|
443
|
+
image_resolution?: "1K" | "2K" | "4K" | undefined;
|
|
444
|
+
max_images?: number | undefined;
|
|
445
|
+
}>;
|
|
446
|
+
export declare const QwenImageSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
447
|
+
prompt: z.ZodString;
|
|
448
|
+
image_url: z.ZodOptional<z.ZodString>;
|
|
449
|
+
image_size: z.ZodOptional<z.ZodDefault<z.ZodEnum<["square", "square_hd", "portrait_4_3", "portrait_16_9", "landscape_4_3", "landscape_16_9"]>>>;
|
|
450
|
+
num_inference_steps: z.ZodOptional<z.ZodNumber>;
|
|
451
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
452
|
+
guidance_scale: z.ZodOptional<z.ZodNumber>;
|
|
453
|
+
enable_safety_checker: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
454
|
+
output_format: z.ZodOptional<z.ZodDefault<z.ZodEnum<["png", "jpeg"]>>>;
|
|
455
|
+
negative_prompt: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
456
|
+
acceleration: z.ZodOptional<z.ZodDefault<z.ZodEnum<["none", "regular", "high"]>>>;
|
|
457
|
+
num_images: z.ZodOptional<z.ZodEnum<["1", "2", "3", "4"]>>;
|
|
458
|
+
sync_mode: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
459
|
+
callBackUrl: z.ZodOptional<z.ZodString>;
|
|
460
|
+
}, "strip", z.ZodTypeAny, {
|
|
461
|
+
prompt: string;
|
|
462
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
463
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
464
|
+
callBackUrl?: string | undefined;
|
|
465
|
+
image_url?: string | undefined;
|
|
466
|
+
seed?: number | undefined;
|
|
467
|
+
enable_safety_checker?: boolean | undefined;
|
|
468
|
+
negative_prompt?: string | undefined;
|
|
469
|
+
num_inference_steps?: number | undefined;
|
|
470
|
+
guidance_scale?: number | undefined;
|
|
471
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
472
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
473
|
+
sync_mode?: boolean | undefined;
|
|
474
|
+
}, {
|
|
475
|
+
prompt: string;
|
|
476
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
477
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
478
|
+
callBackUrl?: string | undefined;
|
|
479
|
+
image_url?: string | undefined;
|
|
480
|
+
seed?: number | undefined;
|
|
481
|
+
enable_safety_checker?: boolean | undefined;
|
|
482
|
+
negative_prompt?: string | undefined;
|
|
483
|
+
num_inference_steps?: number | undefined;
|
|
484
|
+
guidance_scale?: number | undefined;
|
|
485
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
486
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
487
|
+
sync_mode?: boolean | undefined;
|
|
488
|
+
}>, {
|
|
489
|
+
prompt: string;
|
|
490
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
491
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
492
|
+
callBackUrl?: string | undefined;
|
|
493
|
+
image_url?: string | undefined;
|
|
494
|
+
seed?: number | undefined;
|
|
495
|
+
enable_safety_checker?: boolean | undefined;
|
|
496
|
+
negative_prompt?: string | undefined;
|
|
497
|
+
num_inference_steps?: number | undefined;
|
|
498
|
+
guidance_scale?: number | undefined;
|
|
499
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
500
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
501
|
+
sync_mode?: boolean | undefined;
|
|
502
|
+
}, {
|
|
503
|
+
prompt: string;
|
|
504
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
505
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
506
|
+
callBackUrl?: string | undefined;
|
|
507
|
+
image_url?: string | undefined;
|
|
508
|
+
seed?: number | undefined;
|
|
509
|
+
enable_safety_checker?: boolean | undefined;
|
|
510
|
+
negative_prompt?: string | undefined;
|
|
511
|
+
num_inference_steps?: number | undefined;
|
|
512
|
+
guidance_scale?: number | undefined;
|
|
513
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
514
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
515
|
+
sync_mode?: boolean | undefined;
|
|
516
|
+
}>, {
|
|
517
|
+
prompt: string;
|
|
518
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
519
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
520
|
+
callBackUrl?: string | undefined;
|
|
521
|
+
image_url?: string | undefined;
|
|
522
|
+
seed?: number | undefined;
|
|
523
|
+
enable_safety_checker?: boolean | undefined;
|
|
524
|
+
negative_prompt?: string | undefined;
|
|
525
|
+
num_inference_steps?: number | undefined;
|
|
526
|
+
guidance_scale?: number | undefined;
|
|
527
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
528
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
529
|
+
sync_mode?: boolean | undefined;
|
|
530
|
+
}, {
|
|
531
|
+
prompt: string;
|
|
532
|
+
output_format?: "png" | "jpeg" | undefined;
|
|
533
|
+
image_size?: "square" | "square_hd" | "portrait_4_3" | "portrait_16_9" | "landscape_4_3" | "landscape_16_9" | undefined;
|
|
534
|
+
callBackUrl?: string | undefined;
|
|
535
|
+
image_url?: string | undefined;
|
|
536
|
+
seed?: number | undefined;
|
|
537
|
+
enable_safety_checker?: boolean | undefined;
|
|
538
|
+
negative_prompt?: string | undefined;
|
|
539
|
+
num_inference_steps?: number | undefined;
|
|
540
|
+
guidance_scale?: number | undefined;
|
|
541
|
+
acceleration?: "none" | "regular" | "high" | undefined;
|
|
542
|
+
num_images?: "1" | "2" | "3" | "4" | undefined;
|
|
543
|
+
sync_mode?: boolean | undefined;
|
|
544
|
+
}>;
|
|
405
545
|
export type NanoBananaGenerateRequest = z.infer<typeof NanoBananaGenerateSchema>;
|
|
406
546
|
export type NanaBananaEditRequest = z.infer<typeof NanoBananaEditSchema>;
|
|
407
547
|
export type NanoBananaUpscaleRequest = z.infer<typeof NanoBananaUpscaleSchema>;
|
|
@@ -412,6 +552,8 @@ export type ElevenLabsSoundEffectsRequest = z.infer<typeof ElevenLabsSoundEffect
|
|
|
412
552
|
export type ByteDanceSeedanceVideoRequest = z.infer<typeof ByteDanceSeedanceVideoSchema>;
|
|
413
553
|
export type RunwayAlephVideoRequest = z.infer<typeof RunwayAlephVideoSchema>;
|
|
414
554
|
export type WanVideoRequest = z.infer<typeof WanVideoSchema>;
|
|
555
|
+
export type ByteDanceSeedreamImageRequest = z.infer<typeof ByteDanceSeedreamImageSchema>;
|
|
556
|
+
export type QwenImageRequest = z.infer<typeof QwenImageSchema>;
|
|
415
557
|
export interface KieAiResponse<T = any> {
|
|
416
558
|
code: number;
|
|
417
559
|
msg: string;
|
|
@@ -427,7 +569,7 @@ export interface TaskResponse {
|
|
|
427
569
|
export interface TaskRecord {
|
|
428
570
|
id?: number;
|
|
429
571
|
task_id: string;
|
|
430
|
-
api_type: 'nano-banana' | 'nano-banana-edit' | 'nano-banana-upscale' | 'veo3' | 'suno' | 'elevenlabs-tts' | 'elevenlabs-sound-effects' | 'bytedance-seedance-video' | 'runway-aleph-video' | 'wan-video';
|
|
572
|
+
api_type: 'nano-banana' | 'nano-banana-edit' | 'nano-banana-upscale' | 'veo3' | 'suno' | 'elevenlabs-tts' | 'elevenlabs-sound-effects' | 'bytedance-seedance-video' | 'runway-aleph-video' | 'wan-video' | 'bytedance-seedream-image' | 'qwen-image';
|
|
431
573
|
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
432
574
|
created_at: string;
|
|
433
575
|
updated_at: string;
|
package/dist/types.js
CHANGED
|
@@ -180,3 +180,76 @@ export const WanVideoSchema = z.object({
|
|
|
180
180
|
message: "Invalid aspect_ratio for image-to-video mode. Valid options: 16:9, 9:16, 1:1",
|
|
181
181
|
path: ["aspect_ratio"]
|
|
182
182
|
});
|
|
183
|
+
export const ByteDanceSeedreamImageSchema = z.object({
|
|
184
|
+
prompt: z.string().min(1).max(5000),
|
|
185
|
+
image_urls: z.array(z.string().url()).min(1).max(10).optional(),
|
|
186
|
+
image_size: z.enum([
|
|
187
|
+
'square', 'square_hd', 'portrait_4_3', 'portrait_3_2', 'portrait_16_9',
|
|
188
|
+
'landscape_4_3', 'landscape_3_2', 'landscape_16_9', 'landscape_21_9'
|
|
189
|
+
]).default('square_hd').optional(),
|
|
190
|
+
image_resolution: z.enum(['1K', '2K', '4K']).default('1K').optional(),
|
|
191
|
+
max_images: z.number().int().min(1).max(6).default(1).optional(),
|
|
192
|
+
seed: z.number().optional(),
|
|
193
|
+
callBackUrl: z.string().url().optional()
|
|
194
|
+
}).refine((data) => {
|
|
195
|
+
// Check if callBackUrl is provided directly or via environment variable
|
|
196
|
+
const hasCallBackUrl = data.callBackUrl || process.env.KIE_AI_CALLBACK_URL;
|
|
197
|
+
if (!hasCallBackUrl) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return true;
|
|
201
|
+
}, {
|
|
202
|
+
message: "callBackUrl is required (either directly or via KIE_AI_CALLBACK_URL environment variable)",
|
|
203
|
+
path: ["callBackUrl"]
|
|
204
|
+
});
|
|
205
|
+
export const QwenImageSchema = z.object({
|
|
206
|
+
prompt: z.string().min(1),
|
|
207
|
+
image_url: z.string().url().optional(), // Required for edit mode, optional for text-to-image
|
|
208
|
+
image_size: z.enum([
|
|
209
|
+
'square', 'square_hd', 'portrait_4_3', 'portrait_16_9',
|
|
210
|
+
'landscape_4_3', 'landscape_16_9'
|
|
211
|
+
]).default('square_hd').optional(),
|
|
212
|
+
num_inference_steps: z.number().int().min(2).max(250).optional(),
|
|
213
|
+
seed: z.number().optional(),
|
|
214
|
+
guidance_scale: z.number().min(0).max(20).optional(),
|
|
215
|
+
enable_safety_checker: z.boolean().default(true).optional(),
|
|
216
|
+
output_format: z.enum(['png', 'jpeg']).default('png').optional(),
|
|
217
|
+
negative_prompt: z.string().max(500).default(' ').optional(),
|
|
218
|
+
acceleration: z.enum(['none', 'regular', 'high']).default('none').optional(),
|
|
219
|
+
// Edit-specific parameters
|
|
220
|
+
num_images: z.enum(['1', '2', '3', '4']).optional(),
|
|
221
|
+
sync_mode: z.boolean().default(false).optional(),
|
|
222
|
+
callBackUrl: z.string().url().optional()
|
|
223
|
+
}).refine((data) => {
|
|
224
|
+
// Check if callBackUrl is provided directly or via environment variable
|
|
225
|
+
const hasCallBackUrl = data.callBackUrl || process.env.KIE_AI_CALLBACK_URL;
|
|
226
|
+
if (!hasCallBackUrl) {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
return true;
|
|
230
|
+
}, {
|
|
231
|
+
message: "callBackUrl is required (either directly or via KIE_AI_CALLBACK_URL environment variable)",
|
|
232
|
+
path: ["callBackUrl"]
|
|
233
|
+
}).refine((data) => {
|
|
234
|
+
// Validate edit mode requirements
|
|
235
|
+
const isEditMode = !!data.image_url;
|
|
236
|
+
if (isEditMode) {
|
|
237
|
+
// Edit mode specific validations
|
|
238
|
+
if (data.num_inference_steps && (data.num_inference_steps < 2 || data.num_inference_steps > 49)) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
if (data.prompt && data.prompt.length > 2000) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
// Text-to-image mode specific validations
|
|
247
|
+
if (data.prompt && data.prompt.length > 5000) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return true;
|
|
252
|
+
}, {
|
|
253
|
+
message: "Invalid parameters for detected mode",
|
|
254
|
+
path: []
|
|
255
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@felores/kie-ai-mcp-server",
|
|
3
|
-
"version": "1.7.
|
|
4
|
-
"description": "MCP server for Kie.ai APIs (Nano Banana image generation/editing, Veo3 video generation, Suno music generation, and ElevenLabs text-to-speech)",
|
|
3
|
+
"version": "1.7.3",
|
|
4
|
+
"description": "MCP server for Kie.ai APIs (Nano Banana image generation/editing, ByteDance Seedream V4 image generation/editing, Veo3 video generation, Suno music generation, and ElevenLabs text-to-speech)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"kie-ai-mcp-server": "dist/index.js"
|