getaiapi 1.0.4 → 1.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/cli.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  generate,
5
5
  listModels,
6
6
  resolveModel
7
- } from "./chunk-4KILZBQH.js";
7
+ } from "./chunk-3V2PDK26.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import { parseArgs } from "util";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  type OutputType = 'image' | 'video' | 'audio' | 'text' | '3d' | 'segmentation';
2
2
  type InputType = 'text' | 'image' | 'audio' | 'video';
3
- type ProviderName = 'fal-ai' | 'replicate' | 'wavespeed' | 'openrouter';
3
+ type ProviderName = 'fal-ai' | 'replicate' | 'wavespeed' | 'openrouter' | 'kling';
4
4
  interface ModelEntry {
5
5
  canonical_name: string;
6
6
  aliases: string[];
@@ -16,6 +16,7 @@ interface ProviderBinding {
16
16
  endpoint: string;
17
17
  auth_env: string;
18
18
  param_map: Record<string, string | string[]>;
19
+ defaults?: Record<string, unknown>;
19
20
  output_map: OutputMapping;
20
21
  }
21
22
  interface OutputMapping {
@@ -44,7 +45,113 @@ interface GenerateRequest {
44
45
  format?: 'png' | 'jpeg' | 'webp' | 'mp4' | 'mp3' | 'wav' | 'obj' | 'glb';
45
46
  quality?: number;
46
47
  safety?: boolean;
47
- options?: Record<string, unknown>;
48
+ duration?: string;
49
+ options?: Record<string, unknown> | KlingOptions;
50
+ }
51
+ type KlingVideoModel = 'kling-v1' | 'kling-v1-5' | 'kling-v1-6' | 'kling-v2-master' | 'kling-v2-1' | 'kling-v2-1-master' | 'kling-v2-5-turbo' | 'kling-v2-6' | 'kling-v3' | 'kling-v3-omni' | 'kling-video-o1';
52
+ type KlingImageModel = 'kling-v1' | 'kling-v1-5' | 'kling-v2' | 'kling-v2-1' | 'kling-v3' | 'kling-v3-omni' | 'kling-v3-remaster' | 'kling-image-o1' | 'kling-image-o3';
53
+ interface KlingCameraControl {
54
+ type: 'simple' | 'combined';
55
+ config?: {
56
+ horizontal?: number;
57
+ vertical?: number;
58
+ pan?: number;
59
+ tilt?: number;
60
+ roll?: number;
61
+ zoom?: number;
62
+ };
63
+ }
64
+ interface KlingOptions {
65
+ /** Model version for video/image generation. */
66
+ model_name?: KlingVideoModel | KlingImageModel | string;
67
+ /** Quality mode — 'std' (standard) or 'pro'. */
68
+ mode?: 'std' | 'pro';
69
+ /** Enable audio generation on video output. */
70
+ sound?: 'on' | 'off';
71
+ /** Camera movement control. */
72
+ camera_control?: KlingCameraControl;
73
+ /** Enable storyboard multi-shot mode. */
74
+ multi_shot?: boolean;
75
+ /** Shot generation method when multi_shot is true. */
76
+ shot_type?: 'customize' | 'intelligence';
77
+ /** Per-shot prompt descriptions for multi-shot mode. */
78
+ multi_prompt?: Array<{
79
+ prompt: string;
80
+ }>;
81
+ /** Aspect ratio for output (e.g., '16:9', '9:16', '1:1'). */
82
+ aspect_ratio?: string;
83
+ /** Image resolution for image generation. */
84
+ resolution?: '1k' | '2k' | '4k';
85
+ /** Image reference mode for image generation. */
86
+ image_reference?: 'subject' | 'face';
87
+ /** Image reference fidelity [0, 1]. */
88
+ image_fidelity?: number;
89
+ /** Human face similarity [0, 1]. */
90
+ human_fidelity?: number;
91
+ /** Reference elements list. */
92
+ element_list?: Array<{
93
+ id: string;
94
+ image: string;
95
+ }>;
96
+ /** End frame image for image-to-video. */
97
+ image_tail?: string;
98
+ /** Static brush mask for image-to-video. */
99
+ static_mask?: string;
100
+ /** Motion brush masks for image-to-video. */
101
+ dynamic_masks?: Array<{
102
+ mask: string;
103
+ trajectory: Array<{
104
+ x: number;
105
+ y: number;
106
+ }>;
107
+ }>;
108
+ /** Clothing image for virtual try-on. */
109
+ cloth_image?: string;
110
+ /** Video effects scene name (e.g., 'flash_drive', 'hug', 'kiss_pro'). */
111
+ effect_scene?: string;
112
+ /** TTS voice identifier. */
113
+ voice_id?: string;
114
+ /** TTS language code. */
115
+ voice_language?: 'zh' | 'en' | string;
116
+ /** TTS speech rate [0.8, 2.0]. */
117
+ voice_speed?: number;
118
+ /** Custom voice name for voice cloning (max 20 chars). */
119
+ voice_name?: string;
120
+ /** Expansion ratios for image outpainting [0, 2]. */
121
+ up_expansion_ratio?: number;
122
+ down_expansion_ratio?: number;
123
+ left_expansion_ratio?: number;
124
+ right_expansion_ratio?: number;
125
+ /** Sound effect prompt for video-to-audio. */
126
+ sound_effect_prompt?: string;
127
+ /** Background music prompt for video-to-audio. */
128
+ bgm_prompt?: string;
129
+ /** ASMR enhancement mode for video-to-audio. */
130
+ asmr_mode?: boolean;
131
+ /** Face ID for lip sync (from facial recognition API). */
132
+ face_id?: string;
133
+ /** Audio timing for lip sync (milliseconds). */
134
+ sound_start_time?: number;
135
+ sound_end_time?: number;
136
+ sound_insert_time?: number;
137
+ /** Audio volume [0, 2]. */
138
+ sound_volume?: number;
139
+ /** Original video audio volume [0, 2]. */
140
+ original_audio_volume?: number;
141
+ /** Element frontal image for multi-shot. */
142
+ element_frontal_image?: string;
143
+ /** Enable watermark. */
144
+ watermark_info?: {
145
+ watermark: boolean;
146
+ };
147
+ /** Async callback URL for result notification. */
148
+ callback_url?: string;
149
+ /** User-defined external task ID for tracking. */
150
+ external_task_id?: string;
151
+ /** Request timeout in milliseconds. */
152
+ timeout?: number;
153
+ /** Re-upload binary URLs to R2 before sending. */
154
+ reupload?: boolean;
48
155
  }
49
156
  interface GenerateResponse {
50
157
  id: string;
@@ -190,6 +297,8 @@ declare function presignAsset(key: string, options?: {
190
297
  }): string;
191
298
  declare function deleteAsset(key: string): Promise<void>;
192
299
 
300
+ declare const klingAdapter: ProviderAdapter;
301
+
193
302
  declare class GetAIApiError extends Error {
194
303
  constructor(message: string);
195
304
  }
@@ -239,4 +348,4 @@ declare class StorageError extends GetAIApiError {
239
348
  constructor(operation: StorageOperation, message: string, statusCode?: number);
240
349
  }
241
350
 
242
- export { AuthError, type ConfigureOptions, type GenerateRequest, type GenerateResponse, GetAIApiError, type InputType, type ListModelsFilters, type ModelEntry, ModelNotFoundError, NoProviderError, type OutputItem, type OutputMapping, type OutputType, type PollResponse, type ProviderAdapter, type ProviderBinding, ProviderError, type ProviderName, type ProviderResponse, RateLimitError, type StorageConfig, StorageError, type SubmitResponse, TimeoutError, type UploadOptions, type UploadResult, ValidationError, clearRegistryCache, configure, configureAuth, configureStorage, deleteAsset, deriveCategory, generate, listModels, loadRegistry, mapInput, mapOutput, poll, presignAsset, resolveModel, submit, submitAndPoll, uploadAsset };
351
+ export { AuthError, type ConfigureOptions, type GenerateRequest, type GenerateResponse, GetAIApiError, type InputType, type KlingCameraControl, type KlingImageModel, type KlingOptions, type KlingVideoModel, type ListModelsFilters, type ModelEntry, ModelNotFoundError, NoProviderError, type OutputItem, type OutputMapping, type OutputType, type PollResponse, type ProviderAdapter, type ProviderBinding, ProviderError, type ProviderName, type ProviderResponse, RateLimitError, type StorageConfig, StorageError, type SubmitResponse, TimeoutError, type UploadOptions, type UploadResult, ValidationError, clearRegistryCache, configure, configureAuth, configureStorage, deleteAsset, deriveCategory, generate, klingAdapter, listModels, loadRegistry, mapInput, mapOutput, poll, presignAsset, resolveModel, submit, submitAndPoll, uploadAsset };
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  deleteAsset,
15
15
  deriveCategory,
16
16
  generate,
17
+ klingAdapter,
17
18
  listModels,
18
19
  loadRegistry,
19
20
  mapInput,
@@ -24,7 +25,7 @@ import {
24
25
  submit,
25
26
  submitAndPoll,
26
27
  uploadAsset
27
- } from "./chunk-4KILZBQH.js";
28
+ } from "./chunk-3V2PDK26.js";
28
29
 
29
30
  // src/configure.ts
30
31
  function configure(options) {
@@ -52,6 +53,7 @@ export {
52
53
  deleteAsset,
53
54
  deriveCategory,
54
55
  generate,
56
+ klingAdapter,
55
57
  listModels,
56
58
  loadRegistry,
57
59
  mapInput,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/configure.ts"],"sourcesContent":["import type { ConfigureOptions } from \"./types.js\";\nimport { configureAuth } from \"./auth.js\";\nimport { configureStorage } from \"./storage.js\";\n\nexport function configure(options: ConfigureOptions): void {\n if (options.keys) {\n configureAuth(options.keys);\n }\n if (options.storage) {\n configureStorage(options.storage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,SAAiC;AACzD,MAAI,QAAQ,MAAM;AAChB,kBAAc,QAAQ,IAAI;AAAA,EAC5B;AACA,MAAI,QAAQ,SAAS;AACnB,qBAAiB,QAAQ,OAAO;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/configure.ts"],"sourcesContent":["import type { ConfigureOptions } from \"./types.js\";\nimport { configureAuth } from \"./auth.js\";\nimport { configureStorage } from \"./storage.js\";\n\nexport function configure(options: ConfigureOptions): void {\n if (options.keys) {\n configureAuth(options.keys);\n }\n if (options.storage) {\n configureStorage(options.storage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,SAAS,UAAU,SAAiC;AACzD,MAAI,QAAQ,MAAM;AAChB,kBAAc,QAAQ,IAAI;AAAA,EAC5B;AACA,MAAI,QAAQ,SAAS;AACnB,qBAAiB,QAAQ,OAAO;AAAA,EAClC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "getaiapi",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Unified AI API Gateway - one function to call any AI model",
6
6
  "main": "./dist/index.js",
@@ -60,6 +60,7 @@
60
60
  "@fal-ai/client": "^1.9.4",
61
61
  "@types/node": "^25.5.0",
62
62
  "@vitest/coverage-v8": "^3.2.4",
63
+ "playwright": "^1.59.1",
63
64
  "replicate": "^1.4.0",
64
65
  "tsup": "^8.4.0",
65
66
  "tsx": "^4.19.0",