getaiapi 2.1.0 → 2.1.1

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 CHANGED
@@ -115,8 +115,8 @@ const result = await kling.imageToVideoV3Pro({
115
115
  cfg_scale?: number
116
116
  sound?: 'on' | 'off'
117
117
  image_tail?: string // end frame image URL
118
- voice_list?: Array<{ voice_id: string }>
119
- element_list?: Array<{ id: string; image: string }>
118
+ voice_list?: Array<{ voice_id: string }> // mutually exclusive with element_list
119
+ element_list?: Array<{ element_id: number }> // mutually exclusive with voice_list
120
120
  }
121
121
  ```
122
122
 
@@ -163,7 +163,7 @@ const result = await kling.omniVideoO3ProTextToVideo({
163
163
  aspect_ratio?: string
164
164
  cfg_scale?: number
165
165
  sound?: 'on' | 'off'
166
- element_list?: Array<{ id: string; image: string }>
166
+ element_list?: Array<{ element_id: number }>
167
167
  }
168
168
  ```
169
169
 
@@ -320,7 +320,7 @@ const result = await kling.motionControlV3Pro({
320
320
  prompt?: string
321
321
  keep_original_sound?: boolean
322
322
  character_orientation?: string
323
- element_list?: Array<{ id: string; image: string }>
323
+ element_list?: Array<{ element_id: number }>
324
324
  }
325
325
  ```
326
326
 
@@ -595,10 +595,10 @@ const el = await kling.createElement({
595
595
  })
596
596
 
597
597
  // Use element_id in video generation
598
- await kling.imageToVideoV2_1Master({
598
+ await kling.imageToVideoV3Pro({
599
599
  image: 'https://example.com/scene.jpg',
600
600
  prompt: 'Character walks forward',
601
- element_list: [{ id: el.element_id, image: 'https://example.com/frontal.jpg' }],
601
+ element_list: [{ element_id: Number(el.element_id) }],
602
602
  })
603
603
 
604
604
  // List all custom elements (paginated)
@@ -668,6 +668,57 @@ const result = await kling.queryVoice('task-id')
668
668
  await kling.deleteVoice('voice-id')
669
669
  ```
670
670
 
671
+ ### Character Speaking with Custom Voice
672
+
673
+ `element_list` and `voice_list` are mutually exclusive on all video endpoints — you cannot pass both at once. To get a character (element) to speak in their own custom voice, use a two-step approach: generate TTS audio first, then drive an avatar with the character's image.
674
+
675
+ **Use case A — Character video with custom voice (avatar)**
676
+
677
+ ```typescript
678
+ import { kling } from 'getaiapi'
679
+
680
+ // Step 1: Generate speech audio from your custom voice
681
+ const audio = await kling.tts({
682
+ text: 'Hello, welcome to my world.',
683
+ voice_id: 'your-custom-voice-id',
684
+ voice_language: 'en',
685
+ })
686
+
687
+ // Step 2: Animate the character image with that audio (lip-synced)
688
+ const video = await kling.avatarV2Pro({
689
+ image: element.element_image_list.frontal_image, // element's frontal image
690
+ audio_id: audio.audios[0].id, // TTS result audio ID
691
+ prompt: 'looking at the camera, friendly expression',
692
+ })
693
+
694
+ console.log(video.videos[0].url)
695
+ ```
696
+
697
+ **Use case B — Character video with element (no custom voice)**
698
+
699
+ When you only need visual character consistency and don't need a specific voice:
700
+
701
+ ```typescript
702
+ const video = await kling.imageToVideoV3Pro({
703
+ image: 'https://example.com/scene.jpg',
704
+ prompt: 'Character walks through a forest',
705
+ element_list: [{ element_id: Number(el.element_id) }],
706
+ sound: 'on', // Kling generates audio automatically
707
+ })
708
+ ```
709
+
710
+ **Use case C — Character video with voice (no element)**
711
+
712
+ When you only need a specific voice track and don't need element-based character consistency:
713
+
714
+ ```typescript
715
+ const video = await kling.imageToVideoV3Pro({
716
+ image: 'https://example.com/character.jpg',
717
+ prompt: '<<<voice_1>>> Hello, welcome to my world.',
718
+ voice_list: [{ voice_id: 'your-custom-voice-id' }],
719
+ })
720
+ ```
721
+
671
722
  ### Multi-Elements Video Workflow
672
723
 
673
724
  ```typescript
package/dist/index.d.ts CHANGED
@@ -33,8 +33,7 @@ interface ImageToVideoInput extends PollOptions {
33
33
  voice_id: string;
34
34
  }>;
35
35
  element_list?: Array<{
36
- id: string;
37
- image: string;
36
+ element_id: number;
38
37
  }>;
39
38
  options?: Record<string, unknown>;
40
39
  }
@@ -47,8 +46,7 @@ interface OmniVideoInput extends PollOptions {
47
46
  cfg_scale?: number;
48
47
  sound?: 'on' | 'off';
49
48
  element_list?: Array<{
50
- id: string;
51
- image: string;
49
+ element_id: number;
52
50
  }>;
53
51
  options?: Record<string, unknown>;
54
52
  }
@@ -106,8 +104,7 @@ interface MotionControlInput extends PollOptions {
106
104
  keep_original_sound?: 'yes' | 'no';
107
105
  character_orientation?: string;
108
106
  element_list?: Array<{
109
- id: string;
110
- image: string;
107
+ element_id: number;
111
108
  }>;
112
109
  options?: Record<string, unknown>;
113
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaiapi",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "type": "module",
5
5
  "description": "Unified AI API Gateway - one function to call any AI model",
6
6
  "main": "./dist/index.js",