seacloud-sdk 0.11.0 → 0.11.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 +168 -0
- package/dist/cli.js +21 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +186 -3
- package/dist/index.js +113 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ interface SeacloudConfig {
|
|
|
13
13
|
fetch?: typeof fetch;
|
|
14
14
|
/** 请求超时时间(毫秒),默认 30000 */
|
|
15
15
|
timeout?: number;
|
|
16
|
+
/** X-Project header 值,用于 Agent API 访问标识,默认为 'SeaVerse' */
|
|
17
|
+
xProject?: string;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* 任务状态
|
|
@@ -115,6 +117,7 @@ interface InitOptions {
|
|
|
115
117
|
intervalMs?: number;
|
|
116
118
|
maxAttempts?: number;
|
|
117
119
|
timeout?: number;
|
|
120
|
+
xProject?: string;
|
|
118
121
|
}
|
|
119
122
|
/**
|
|
120
123
|
* 初始化 SDK(可选)
|
|
@@ -9825,6 +9828,158 @@ interface ViduQ2Resource {
|
|
|
9825
9828
|
*/
|
|
9826
9829
|
declare function viduQ2(params: ViduQ2Params): Promise<ViduQ2Resource[]>;
|
|
9827
9830
|
|
|
9831
|
+
/**
|
|
9832
|
+
* 主体定义,用于在提示词中引用
|
|
9833
|
+
*/
|
|
9834
|
+
interface ViduQ2ReferenceSubject {
|
|
9835
|
+
/**
|
|
9836
|
+
* 主体id,在提示词中可以通过 @主体id 的方式使用
|
|
9837
|
+
*/
|
|
9838
|
+
id: string;
|
|
9839
|
+
/**
|
|
9840
|
+
* 该主体对应的图片url列表,每个主体最多支持3张图片
|
|
9841
|
+
*/
|
|
9842
|
+
images: string[];
|
|
9843
|
+
}
|
|
9844
|
+
interface ViduQ2I2vReferenceParams {
|
|
9845
|
+
/**
|
|
9846
|
+
* 文本提示词,必填
|
|
9847
|
+
* 可以通过@主体id 来表示主体内容
|
|
9848
|
+
* 例如:"@1 和 @2 在一起吃火锅,并且旁白音说火锅大家都爱吃。"
|
|
9849
|
+
* 注:字符长度不能超过 2000 个字符
|
|
9850
|
+
*/
|
|
9851
|
+
prompt: string;
|
|
9852
|
+
/**
|
|
9853
|
+
* 参考图像列表(URL或Base64),与subjects参数互斥
|
|
9854
|
+
* 支持1-7张参考图片
|
|
9855
|
+
*/
|
|
9856
|
+
images?: string[];
|
|
9857
|
+
/**
|
|
9858
|
+
* 主体列表,与images参数互斥
|
|
9859
|
+
* 每个主体可以有多张图片(最多3张),并在prompt中通过@主体id引用
|
|
9860
|
+
*/
|
|
9861
|
+
subjects?: ViduQ2ReferenceSubject[];
|
|
9862
|
+
/**
|
|
9863
|
+
* 音色ID,使用预设音色或复刻音色
|
|
9864
|
+
* 为空时系统会自动推荐音色并使用
|
|
9865
|
+
*/
|
|
9866
|
+
voice_id?: string;
|
|
9867
|
+
/**
|
|
9868
|
+
* 是否使用音视频直出能力,默认false
|
|
9869
|
+
* - true:使用音视频直出能力,同时bgm参数不生效
|
|
9870
|
+
* - false:不使用音视频直出能力,且bgm参数生效
|
|
9871
|
+
* @default false
|
|
9872
|
+
*/
|
|
9873
|
+
audio?: boolean;
|
|
9874
|
+
/**
|
|
9875
|
+
* 视频时长(秒),范围1-8秒
|
|
9876
|
+
* @range 1 - 8
|
|
9877
|
+
*/
|
|
9878
|
+
duration?: number;
|
|
9879
|
+
/**
|
|
9880
|
+
* 分辨率参数,默认值依据模型和视频时长而定
|
|
9881
|
+
* viduq2(1-10秒):默认 720p, 可选:540p、720p、1080p
|
|
9882
|
+
* @default "720p"
|
|
9883
|
+
* @values 540p | 720p | 1080p
|
|
9884
|
+
*/
|
|
9885
|
+
resolution?: '540p' | '720p' | '1080p';
|
|
9886
|
+
/**
|
|
9887
|
+
* 随机种子,默认0(随机)
|
|
9888
|
+
* @default 0
|
|
9889
|
+
*/
|
|
9890
|
+
seed?: number;
|
|
9891
|
+
/**
|
|
9892
|
+
* 宽高比,默认16:9
|
|
9893
|
+
* @default "16:9"
|
|
9894
|
+
* @values 16:9 | 9:16 | 1:1
|
|
9895
|
+
*/
|
|
9896
|
+
aspect_ratio?: '16:9' | '9:16' | '1:1';
|
|
9897
|
+
/**
|
|
9898
|
+
* 运动幅度,默认auto
|
|
9899
|
+
* @default "auto"
|
|
9900
|
+
* @values auto | small | medium | large
|
|
9901
|
+
*/
|
|
9902
|
+
movement_amplitude?: 'auto' | 'small' | 'medium' | 'large';
|
|
9903
|
+
/**
|
|
9904
|
+
* 是否添加背景音乐,默认false
|
|
9905
|
+
* 当audio=true时此参数不生效
|
|
9906
|
+
* @default false
|
|
9907
|
+
*/
|
|
9908
|
+
bgm?: boolean;
|
|
9909
|
+
/**
|
|
9910
|
+
* 是否在非高峰时段处理,默认false
|
|
9911
|
+
* @default false
|
|
9912
|
+
*/
|
|
9913
|
+
off_peak?: boolean;
|
|
9914
|
+
/**
|
|
9915
|
+
* 是否添加水印,默认false
|
|
9916
|
+
* @default false
|
|
9917
|
+
*/
|
|
9918
|
+
watermark?: boolean;
|
|
9919
|
+
/**
|
|
9920
|
+
* 透传参数,最大1048576字符
|
|
9921
|
+
*/
|
|
9922
|
+
payload?: string;
|
|
9923
|
+
/**
|
|
9924
|
+
* 回调URL,必须以http://或https://开头
|
|
9925
|
+
*/
|
|
9926
|
+
callback_url?: string;
|
|
9927
|
+
}
|
|
9928
|
+
interface ViduQ2I2vReferenceResource {
|
|
9929
|
+
type: string;
|
|
9930
|
+
url: string;
|
|
9931
|
+
size?: number;
|
|
9932
|
+
jobId?: string;
|
|
9933
|
+
[key: string]: any;
|
|
9934
|
+
}
|
|
9935
|
+
/**
|
|
9936
|
+
* viduq2_i2v_reference
|
|
9937
|
+
*
|
|
9938
|
+
* Vidu Q2 Reference-to-Video generation implementation.
|
|
9939
|
+
*
|
|
9940
|
+
* Model: viduq2 (最新模型)
|
|
9941
|
+
* Features: 最新模型,支持参考图生视频,高质量输出,支持主体一致性
|
|
9942
|
+
* Duration: 1-8秒 (可选)
|
|
9943
|
+
* Resolution: 根据时长动态调整
|
|
9944
|
+
* Images: 1-7张参考图片,或使用subjects定义多个主体
|
|
9945
|
+
*
|
|
9946
|
+
* API Documentation: https://platform.vidu.cn/docs/reference-to-video
|
|
9947
|
+
* Status API: https://platform.vidu.cn/docs/get-generation
|
|
9948
|
+
*
|
|
9949
|
+
* @example
|
|
9950
|
+
* ```typescript
|
|
9951
|
+
* import { initSeacloud, viduQ2I2vReference } from 'seacloud-sdk';
|
|
9952
|
+
*
|
|
9953
|
+
* initSeacloud('your-api-key');
|
|
9954
|
+
*
|
|
9955
|
+
* // 方式1: 使用普通参考图片列表
|
|
9956
|
+
* const result1 = await viduQ2I2vReference({
|
|
9957
|
+
* prompt: '一只可爱的小猫在花园里玩耍',
|
|
9958
|
+
* images: ['https://example.com/cat.jpg'],
|
|
9959
|
+
* duration: 5,
|
|
9960
|
+
* resolution: '720p',
|
|
9961
|
+
* });
|
|
9962
|
+
*
|
|
9963
|
+
* // 方式2: 使用主体列表(支持多主体和主体引用)
|
|
9964
|
+
* const result2 = await viduQ2I2vReference({
|
|
9965
|
+
* prompt: '@1 和 @2 在一起吃火锅,并且旁白音说火锅大家都爱吃。',
|
|
9966
|
+
* subjects: [
|
|
9967
|
+
* { id: '1', images: ['https://example.com/person1.jpg'] },
|
|
9968
|
+
* { id: '2', images: ['https://example.com/person2.jpg'] }
|
|
9969
|
+
* ],
|
|
9970
|
+
* audio: true,
|
|
9971
|
+
* voice_id: 'voice_123',
|
|
9972
|
+
* duration: 8,
|
|
9973
|
+
* });
|
|
9974
|
+
*
|
|
9975
|
+
* console.log(result); // 返回生成的资源列表
|
|
9976
|
+
* ```
|
|
9977
|
+
*
|
|
9978
|
+
* @param params 请求参数,详见 ViduQ2I2vReferenceParams 接口定义
|
|
9979
|
+
* @returns 生成的资源列表
|
|
9980
|
+
*/
|
|
9981
|
+
declare function viduQ2I2vReference(params: ViduQ2I2vReferenceParams): Promise<ViduQ2I2vReferenceResource[]>;
|
|
9982
|
+
|
|
9828
9983
|
interface ViduTemplateParams {
|
|
9829
9984
|
/**
|
|
9830
9985
|
* 模板名称,必填参数。支持的模板: turn_into_zombie (变成僵尸效果), head_to_balloon (头部变气球效果), wednesdays_vibe (星期三氛围效果), covered_liquid_metal (液态金属覆盖效果)
|
|
@@ -11654,8 +11809,13 @@ interface VolcesSeedream45MultiBlendParams {
|
|
|
11654
11809
|
prompt: string;
|
|
11655
11810
|
/**
|
|
11656
11811
|
* 输入图片列表,支持 URL 地址或 Base64 编码的图片数据(必须为列表格式,至少2张,最多14张图片)
|
|
11812
|
+
* 支持 image 或 images 参数名
|
|
11657
11813
|
*/
|
|
11658
|
-
image
|
|
11814
|
+
image?: string[];
|
|
11815
|
+
/**
|
|
11816
|
+
* 输入图片列表(别名),与 image 参数相同
|
|
11817
|
+
*/
|
|
11818
|
+
images?: string[];
|
|
11659
11819
|
/**
|
|
11660
11820
|
* 图片尺寸,例如:"2K"、"1024x1024" 等
|
|
11661
11821
|
*/
|
|
@@ -12116,7 +12276,7 @@ declare function llmChatCompletions(params: LlmChatCompletionsParams & {
|
|
|
12116
12276
|
* - For tool calls (image/video generation), streaming is RECOMMENDED
|
|
12117
12277
|
*
|
|
12118
12278
|
* 4. AUTHENTICATION:
|
|
12119
|
-
* - Requires 'X-Project
|
|
12279
|
+
* - Requires 'X-Project' header (configured via initSeacloud({ xProject: 'SeaArt' }))
|
|
12120
12280
|
* - Uses Bearer token authentication
|
|
12121
12281
|
*
|
|
12122
12282
|
* 5. SESSION MANAGEMENT:
|
|
@@ -13985,4 +14145,27 @@ interface YouchuanVideoUpscaleResource {
|
|
|
13985
14145
|
*/
|
|
13986
14146
|
declare function youchuanVideoUpscale(params: YouchuanVideoUpscaleParams): Promise<YouchuanVideoUpscaleResource[]>;
|
|
13987
14147
|
|
|
13988
|
-
export { type AgentArtifact, type AgentChatCompletionChoice, type AgentChatCompletionChunk, type AgentChatCompletionChunkChoice, type AgentChatCompletionDelta, type AgentChatCompletionResponse, type AgentChatCompletionsParams, type AgentContentFilterResult, type AgentMessage, type AgentMessageContent, type AgentMessageContentType, type AgentMessageRole, type AgentResponseMessage, type AgentTool, type AgentToolCall, type AgentToolFunction, type AgentUsage, type AlibabaAnimateAnyoneDetectParams, type AlibabaAnimateAnyoneDetectResource, type AlibabaAnimateAnyoneTemplateParams, type AlibabaAnimateAnyoneTemplateResource, type AlibabaAnimateAnyoneVideoParams, type AlibabaAnimateAnyoneVideoResource, type AlibabaQianwenImageParams, type AlibabaQianwenImageResource, type AlibabaWan22T2iFlashParams, type AlibabaWan22T2iFlashResource, type AlibabaWan22T2iPlusParams, type AlibabaWan22T2iPlusResource, type AlibabaWan25I2iPreviewParams, type AlibabaWan25I2iPreviewResource, type AlibabaWan25T2iPreviewParams, type AlibabaWan25T2iPreviewResource, type AlibabaWanx20T2iTurboParams, type AlibabaWanx20T2iTurboResource, type AlibabaWanx21I2vPlusParams, type AlibabaWanx21I2vPlusResource, type AlibabaWanx21I2vTurboParams, type AlibabaWanx21I2vTurboResource, type AlibabaWanx21T2iPlusParams, type AlibabaWanx21T2iPlusResource, type AlibabaWanx21T2iTurboParams, type AlibabaWanx21T2iTurboResource, type AlibabaWanx21T2vPlusParams, type AlibabaWanx21T2vPlusResource, type AlibabaWanx21T2vTurboParams, type AlibabaWanx21T2vTurboResource, type AlibabaWanx22I2vFlashParams, type AlibabaWanx22I2vFlashResource, type AlibabaWanx22I2vPlusParams, type AlibabaWanx22I2vPlusResource, type AlibabaWanx22T2vPlusParams, type AlibabaWanx22T2vPlusResource, type AlibabaWanx25I2vPreviewParams, type AlibabaWanx25I2vPreviewResource, type AlibabaWanx25T2vPreviewParams, type AlibabaWanx25T2vPreviewResource, type AlibabaWanx26I2vParams, type AlibabaWanx26I2vResource, type AlibabaWanx26ReferenceParams, type AlibabaWanx26ReferenceResource, type AlibabaWanx26T2vParams, type AlibabaWanx26T2vResource, type AppGenerationInput, type AppGenerationParams, type AppGenerationResource, type AppGenerationResult, type AppSearchParams, type AppSearchResponse, type BlackforestlabsFlux11ProParams, type BlackforestlabsFlux11ProResource, type BlackforestlabsFlux1ProParams, type BlackforestlabsFlux1ProResource, type BlackforestlabsFlux2FlexEditParams, type BlackforestlabsFlux2FlexEditResource, type BlackforestlabsFlux2FlexParams, type BlackforestlabsFlux2FlexResource, type BlackforestlabsFlux2ProEditParams, type BlackforestlabsFlux2ProEditResource, type BlackforestlabsFlux2ProParams, type BlackforestlabsFlux2ProResource, type BlackforestlabsFluxKontextMaxParams, type BlackforestlabsFluxKontextMaxResource, type BlackforestlabsFluxKontextProParams, type BlackforestlabsFluxKontextProResource, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionChunkChoice, type ChatCompletionChunkDelta, type ChatCompletionResponse, type ChatCompletionUsage, type ChatMessage, type ChatMessageRole, type ElevenlabsTtsGeneratorParams, type ElevenlabsTtsGeneratorResource, type FrameResult, type GoogleGemini3ProImageParams, type GoogleGemini3ProImageResource, type GoogleGeminiImageParams, type GoogleGeminiImageResource, type GoogleImagen4FastGenerateParams, type GoogleImagen4FastGenerateResource, type GoogleImagen4GenerateParams, type GoogleImagen4GenerateResource, type GoogleImagen4UltraGenerateParams, type GoogleImagen4UltraGenerateResource, type GoogleVeo20Generate001Params, type GoogleVeo20Generate001Resource, type GoogleVeo20GenerateExpParams, type GoogleVeo20GenerateExpResource, type GoogleVeo20GeneratePreviewParams, type GoogleVeo20GeneratePreviewResource, type GoogleVeo30FastGenerate001Params, type GoogleVeo30FastGenerate001Resource, type GoogleVeo30Generate001Params, type GoogleVeo30Generate001Resource, type GoogleVeo31Params, type GoogleVeo31Resource, type InitOptions, type KlingAvatarParams, type KlingAvatarResource, type KlingDurationExtensionParams, type KlingDurationExtensionResource, type KlingEffectsMultiV15Params, type KlingEffectsMultiV15Resource, type KlingEffectsMultiV16Params, type KlingEffectsMultiV16Resource, type KlingEffectsMultiV1Params, type KlingEffectsMultiV1Resource, type KlingEffectsSingleParams, type KlingEffectsSingleResource, type KlingLipsyncParams, type KlingLipsyncResource, type KlingOmniImageParams, type KlingOmniImageResource, type KlingOmniVideoParams, type KlingOmniVideoResource, type KlingV15I2vParams, type KlingV15I2vResource, type KlingV15Params, type KlingV15Resource, type KlingV16I2vParams, type KlingV16I2vResource, type KlingV16Params, type KlingV16Resource, type KlingV1I2vParams, type KlingV1I2vResource, type KlingV1Params, type KlingV1Resource, type KlingV21I2vParams, type KlingV21I2vResource, type KlingV21MasterI2vParams, type KlingV21MasterI2vResource, type KlingV21MasterParams, type KlingV21MasterResource, type KlingV25TurboI2vParams, type KlingV25TurboI2vResource, type KlingV25TurboParams, type KlingV25TurboResource, type KlingV26I2vParams, type KlingV26I2vResource, type KlingV26Params, type KlingV26Resource, type KlingV2MasterI2vParams, type KlingV2MasterI2vResource, type KlingV2MasterParams, type KlingV2MasterResource, type LabelItem, type LlmChatCompletionsParams, type MicrosoftGptImage15Params, type MicrosoftGptImage15Resource, type MicrosoftGptImage1Params, type MicrosoftGptImage1Resource, type MicrosoftSora2Params, type MicrosoftSora2Resource, type MinimaxHailuo02I2vParams, type MinimaxHailuo02I2vResource, type MinimaxHailuo02Params, type MinimaxHailuo02Resource, type MinimaxHailuo23FastI2vParams, type MinimaxHailuo23FastI2vResource, type MinimaxHailuo23I2vParams, type MinimaxHailuo23I2vResource, type MinimaxI2v01DirectorParams, type MinimaxI2v01DirectorResource, type MinimaxI2v01LiveParams, type MinimaxI2v01LiveResource, type MinimaxI2v01Params, type MinimaxI2v01Resource, type MinimaxT2aParams, type MinimaxT2aResource, type MinimaxT2v01DirectorParams, type MinimaxT2v01DirectorResource, type MinimaxT2v01Params, type MinimaxT2v01Resource, type PixverseV35I2vParams, type PixverseV35I2vResource, type PixverseV35T2vParams, type PixverseV35T2vResource, type PixverseV35TransitionParams, type PixverseV35TransitionResource, type PixverseV45I2vParams, type PixverseV45I2vResource, type PixverseV45T2vParams, type PixverseV45T2vResource, type PixverseV45TransitionParams, type PixverseV45TransitionResource, type PixverseV4I2vParams, type PixverseV4I2vResource, type PixverseV4T2vParams, type PixverseV4T2vResource, type PixverseV4TransitionParams, type PixverseV4TransitionResource, type PixverseV55I2vParams, type PixverseV55I2vResource, type PixverseV55T2vParams, type PixverseV55T2vResource, type PixverseV55TransitionParams, type PixverseV55TransitionResource, type PixverseV5I2vParams, type PixverseV5I2vResource, type PixverseV5T2vParams, type PixverseV5T2vResource, type PixverseV5TransitionParams, type PixverseV5TransitionResource, type PollingOptions, type RiskType, type RunwayGen3aTurboI2vParams, type RunwayGen3aTurboI2vResource, type ScanParams, type ScanResponse, SeacloudClient, type SeacloudConfig, SeacloudError, type TaskError, type TaskResult, type TaskStatus, type TemplateSpec, type TemplateSpecConstraint, type TemplateSpecInput, type TemplateSpecOutput, type TemplateSpecsParams, type TemplateSpecsResponse, type TencentHunyuan3dParams, type TencentHunyuan3dProParams, type TencentHunyuan3dProResource, type TencentHunyuan3dRapidParams, type TencentHunyuan3dRapidResource, type TencentHunyuan3dResource, type TencentImageCreation3Params, type TencentImageCreation3Resource, type TencentMpsSuperResolutionParams, type TencentMpsSuperResolutionResource, type Vidu15I2vParams, type Vidu15I2vResource, type Vidu15Params, type Vidu15Resource, type Vidu20I2vParams, type Vidu20I2vResource, type ViduQ1I2vParams, type ViduQ1I2vResource, type ViduQ1Params, type ViduQ1Resource, type ViduQ2Params, type ViduQ2Resource, type ViduTemplateParams, type ViduTemplateResource, type ViduTemplateV2Params, type ViduTemplateV2Resource, type VolcesJimeng30Params, type VolcesJimeng30Resource, type VolcesJimeng31Params, type VolcesJimeng31Resource, type VolcesJimengDreamActorM1Params, type VolcesJimengDreamActorM1Resource, type VolcesJimengI2i30Params, type VolcesJimengI2i30Resource, type VolcesRealmanAvatarImitatorV2vParams, type VolcesRealmanAvatarImitatorV2vResource, type VolcesRealmanAvatarPictureOmniV15Params, type VolcesRealmanAvatarPictureOmniV15Resource, type VolcesRealmanAvatarPictureOmniV2Params, type VolcesRealmanAvatarPictureOmniV2Resource, type VolcesSeed3dParams, type VolcesSeed3dResource, type VolcesSeedance30I2vParams, type VolcesSeedance30I2vResource, type VolcesSeedance30Params, type VolcesSeedance30ProParams, type VolcesSeedance30ProResource, type VolcesSeedance30Resource, type VolcesSeedanceProFastParams, type VolcesSeedanceProFastResource, type VolcesSeededit20Params, type VolcesSeededit20Resource, type VolcesSeededit30I2iParams, type VolcesSeededit30I2iResource, type VolcesSeededit30Params, type VolcesSeededit30Resource, type VolcesSeededit3dStyleParams, type VolcesSeededit3dStyleResource, type VolcesSeededitMultiIpParams, type VolcesSeededitMultiIpResource, type VolcesSeededitMultiStyleParams, type VolcesSeededitMultiStyleResource, type VolcesSeededitPortraitParams, type VolcesSeededitPortraitResource, type VolcesSeededitSingleIpParams, type VolcesSeededitSingleIpResource, type VolcesSeedream30Params, type VolcesSeedream30Resource, type VolcesSeedream40Params, type VolcesSeedream40Resource, type VolcesSeedream45I2iParams, type VolcesSeedream45I2iResource, type VolcesSeedream45MultiBlendParams, type VolcesSeedream45MultiBlendResource, type VolcesSeedream45Params, type VolcesSeedream45Resource, type VolcesSubjectDetectionParams, type VolcesSubjectDetectionResource, type VolcesSubjectRecognitionParams, type VolcesSubjectRecognitionResource, type YouchuanDiffusionParams, type YouchuanDiffusionResource, type YouchuanEditParams, type YouchuanEditResource, type YouchuanEnhanceParams, type YouchuanEnhanceResource, type YouchuanExtendVideoParams, type YouchuanExtendVideoResource, type YouchuanInpaintParams, type YouchuanInpaintResource, type YouchuanOutpaintParams, type YouchuanOutpaintResource, type YouchuanPanParams, type YouchuanPanResource, type YouchuanRemixParams, type YouchuanRemixResource, type YouchuanRemoveBackgroundParams, type YouchuanRemoveBackgroundResource, type YouchuanRetextureParams, type YouchuanRetextureResource, type YouchuanUploadpaintParams, type YouchuanUploadpaintResource, type YouchuanUpscaleParams, type YouchuanUpscaleResource, type YouchuanVariationParams, type YouchuanVariationResource, type YouchuanVideoDiffusionParams, type YouchuanVideoDiffusionResource, type YouchuanVideoUpscaleParams, type YouchuanVideoUpscaleResource, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
|
|
14148
|
+
/**
|
|
14149
|
+
* Validation utilities for SDK responses
|
|
14150
|
+
*/
|
|
14151
|
+
interface Resource {
|
|
14152
|
+
type?: string;
|
|
14153
|
+
url?: string;
|
|
14154
|
+
[key: string]: any;
|
|
14155
|
+
}
|
|
14156
|
+
/**
|
|
14157
|
+
* Validate that a resource contains a valid URL
|
|
14158
|
+
* @param resource The resource to validate
|
|
14159
|
+
* @param resourceType Type description for error messages (e.g., "image", "video")
|
|
14160
|
+
* @throws Error if the resource is invalid
|
|
14161
|
+
*/
|
|
14162
|
+
declare function validateResourceUrl(resource: Resource, resourceType?: string): void;
|
|
14163
|
+
/**
|
|
14164
|
+
* Validate an array of resources
|
|
14165
|
+
* @param resources The resources array to validate
|
|
14166
|
+
* @param resourceType Type description for error messages
|
|
14167
|
+
* @throws Error if any resource is invalid
|
|
14168
|
+
*/
|
|
14169
|
+
declare function validateResources(resources: Resource[], resourceType?: string): void;
|
|
14170
|
+
|
|
14171
|
+
export { type AgentArtifact, type AgentChatCompletionChoice, type AgentChatCompletionChunk, type AgentChatCompletionChunkChoice, type AgentChatCompletionDelta, type AgentChatCompletionResponse, type AgentChatCompletionsParams, type AgentContentFilterResult, type AgentMessage, type AgentMessageContent, type AgentMessageContentType, type AgentMessageRole, type AgentResponseMessage, type AgentTool, type AgentToolCall, type AgentToolFunction, type AgentUsage, type AlibabaAnimateAnyoneDetectParams, type AlibabaAnimateAnyoneDetectResource, type AlibabaAnimateAnyoneTemplateParams, type AlibabaAnimateAnyoneTemplateResource, type AlibabaAnimateAnyoneVideoParams, type AlibabaAnimateAnyoneVideoResource, type AlibabaQianwenImageParams, type AlibabaQianwenImageResource, type AlibabaWan22T2iFlashParams, type AlibabaWan22T2iFlashResource, type AlibabaWan22T2iPlusParams, type AlibabaWan22T2iPlusResource, type AlibabaWan25I2iPreviewParams, type AlibabaWan25I2iPreviewResource, type AlibabaWan25T2iPreviewParams, type AlibabaWan25T2iPreviewResource, type AlibabaWanx20T2iTurboParams, type AlibabaWanx20T2iTurboResource, type AlibabaWanx21I2vPlusParams, type AlibabaWanx21I2vPlusResource, type AlibabaWanx21I2vTurboParams, type AlibabaWanx21I2vTurboResource, type AlibabaWanx21T2iPlusParams, type AlibabaWanx21T2iPlusResource, type AlibabaWanx21T2iTurboParams, type AlibabaWanx21T2iTurboResource, type AlibabaWanx21T2vPlusParams, type AlibabaWanx21T2vPlusResource, type AlibabaWanx21T2vTurboParams, type AlibabaWanx21T2vTurboResource, type AlibabaWanx22I2vFlashParams, type AlibabaWanx22I2vFlashResource, type AlibabaWanx22I2vPlusParams, type AlibabaWanx22I2vPlusResource, type AlibabaWanx22T2vPlusParams, type AlibabaWanx22T2vPlusResource, type AlibabaWanx25I2vPreviewParams, type AlibabaWanx25I2vPreviewResource, type AlibabaWanx25T2vPreviewParams, type AlibabaWanx25T2vPreviewResource, type AlibabaWanx26I2vParams, type AlibabaWanx26I2vResource, type AlibabaWanx26ReferenceParams, type AlibabaWanx26ReferenceResource, type AlibabaWanx26T2vParams, type AlibabaWanx26T2vResource, type AppGenerationInput, type AppGenerationParams, type AppGenerationResource, type AppGenerationResult, type AppSearchParams, type AppSearchResponse, type BlackforestlabsFlux11ProParams, type BlackforestlabsFlux11ProResource, type BlackforestlabsFlux1ProParams, type BlackforestlabsFlux1ProResource, type BlackforestlabsFlux2FlexEditParams, type BlackforestlabsFlux2FlexEditResource, type BlackforestlabsFlux2FlexParams, type BlackforestlabsFlux2FlexResource, type BlackforestlabsFlux2ProEditParams, type BlackforestlabsFlux2ProEditResource, type BlackforestlabsFlux2ProParams, type BlackforestlabsFlux2ProResource, type BlackforestlabsFluxKontextMaxParams, type BlackforestlabsFluxKontextMaxResource, type BlackforestlabsFluxKontextProParams, type BlackforestlabsFluxKontextProResource, type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionChunkChoice, type ChatCompletionChunkDelta, type ChatCompletionResponse, type ChatCompletionUsage, type ChatMessage, type ChatMessageRole, type ElevenlabsTtsGeneratorParams, type ElevenlabsTtsGeneratorResource, type FrameResult, type GoogleGemini3ProImageParams, type GoogleGemini3ProImageResource, type GoogleGeminiImageParams, type GoogleGeminiImageResource, type GoogleImagen4FastGenerateParams, type GoogleImagen4FastGenerateResource, type GoogleImagen4GenerateParams, type GoogleImagen4GenerateResource, type GoogleImagen4UltraGenerateParams, type GoogleImagen4UltraGenerateResource, type GoogleVeo20Generate001Params, type GoogleVeo20Generate001Resource, type GoogleVeo20GenerateExpParams, type GoogleVeo20GenerateExpResource, type GoogleVeo20GeneratePreviewParams, type GoogleVeo20GeneratePreviewResource, type GoogleVeo30FastGenerate001Params, type GoogleVeo30FastGenerate001Resource, type GoogleVeo30Generate001Params, type GoogleVeo30Generate001Resource, type GoogleVeo31Params, type GoogleVeo31Resource, type InitOptions, type KlingAvatarParams, type KlingAvatarResource, type KlingDurationExtensionParams, type KlingDurationExtensionResource, type KlingEffectsMultiV15Params, type KlingEffectsMultiV15Resource, type KlingEffectsMultiV16Params, type KlingEffectsMultiV16Resource, type KlingEffectsMultiV1Params, type KlingEffectsMultiV1Resource, type KlingEffectsSingleParams, type KlingEffectsSingleResource, type KlingLipsyncParams, type KlingLipsyncResource, type KlingOmniImageParams, type KlingOmniImageResource, type KlingOmniVideoParams, type KlingOmniVideoResource, type KlingV15I2vParams, type KlingV15I2vResource, type KlingV15Params, type KlingV15Resource, type KlingV16I2vParams, type KlingV16I2vResource, type KlingV16Params, type KlingV16Resource, type KlingV1I2vParams, type KlingV1I2vResource, type KlingV1Params, type KlingV1Resource, type KlingV21I2vParams, type KlingV21I2vResource, type KlingV21MasterI2vParams, type KlingV21MasterI2vResource, type KlingV21MasterParams, type KlingV21MasterResource, type KlingV25TurboI2vParams, type KlingV25TurboI2vResource, type KlingV25TurboParams, type KlingV25TurboResource, type KlingV26I2vParams, type KlingV26I2vResource, type KlingV26Params, type KlingV26Resource, type KlingV2MasterI2vParams, type KlingV2MasterI2vResource, type KlingV2MasterParams, type KlingV2MasterResource, type LabelItem, type LlmChatCompletionsParams, type MicrosoftGptImage15Params, type MicrosoftGptImage15Resource, type MicrosoftGptImage1Params, type MicrosoftGptImage1Resource, type MicrosoftSora2Params, type MicrosoftSora2Resource, type MinimaxHailuo02I2vParams, type MinimaxHailuo02I2vResource, type MinimaxHailuo02Params, type MinimaxHailuo02Resource, type MinimaxHailuo23FastI2vParams, type MinimaxHailuo23FastI2vResource, type MinimaxHailuo23I2vParams, type MinimaxHailuo23I2vResource, type MinimaxI2v01DirectorParams, type MinimaxI2v01DirectorResource, type MinimaxI2v01LiveParams, type MinimaxI2v01LiveResource, type MinimaxI2v01Params, type MinimaxI2v01Resource, type MinimaxT2aParams, type MinimaxT2aResource, type MinimaxT2v01DirectorParams, type MinimaxT2v01DirectorResource, type MinimaxT2v01Params, type MinimaxT2v01Resource, type PixverseV35I2vParams, type PixverseV35I2vResource, type PixverseV35T2vParams, type PixverseV35T2vResource, type PixverseV35TransitionParams, type PixverseV35TransitionResource, type PixverseV45I2vParams, type PixverseV45I2vResource, type PixverseV45T2vParams, type PixverseV45T2vResource, type PixverseV45TransitionParams, type PixverseV45TransitionResource, type PixverseV4I2vParams, type PixverseV4I2vResource, type PixverseV4T2vParams, type PixverseV4T2vResource, type PixverseV4TransitionParams, type PixverseV4TransitionResource, type PixverseV55I2vParams, type PixverseV55I2vResource, type PixverseV55T2vParams, type PixverseV55T2vResource, type PixverseV55TransitionParams, type PixverseV55TransitionResource, type PixverseV5I2vParams, type PixverseV5I2vResource, type PixverseV5T2vParams, type PixverseV5T2vResource, type PixverseV5TransitionParams, type PixverseV5TransitionResource, type PollingOptions, type RiskType, type RunwayGen3aTurboI2vParams, type RunwayGen3aTurboI2vResource, type ScanParams, type ScanResponse, SeacloudClient, type SeacloudConfig, SeacloudError, type TaskError, type TaskResult, type TaskStatus, type TemplateSpec, type TemplateSpecConstraint, type TemplateSpecInput, type TemplateSpecOutput, type TemplateSpecsParams, type TemplateSpecsResponse, type TencentHunyuan3dParams, type TencentHunyuan3dProParams, type TencentHunyuan3dProResource, type TencentHunyuan3dRapidParams, type TencentHunyuan3dRapidResource, type TencentHunyuan3dResource, type TencentImageCreation3Params, type TencentImageCreation3Resource, type TencentMpsSuperResolutionParams, type TencentMpsSuperResolutionResource, type Vidu15I2vParams, type Vidu15I2vResource, type Vidu15Params, type Vidu15Resource, type Vidu20I2vParams, type Vidu20I2vResource, type ViduQ1I2vParams, type ViduQ1I2vResource, type ViduQ1Params, type ViduQ1Resource, type ViduQ2I2vReferenceParams, type ViduQ2I2vReferenceResource, type ViduQ2Params, type ViduQ2ReferenceSubject, type ViduQ2Resource, type ViduTemplateParams, type ViduTemplateResource, type ViduTemplateV2Params, type ViduTemplateV2Resource, type VolcesJimeng30Params, type VolcesJimeng30Resource, type VolcesJimeng31Params, type VolcesJimeng31Resource, type VolcesJimengDreamActorM1Params, type VolcesJimengDreamActorM1Resource, type VolcesJimengI2i30Params, type VolcesJimengI2i30Resource, type VolcesRealmanAvatarImitatorV2vParams, type VolcesRealmanAvatarImitatorV2vResource, type VolcesRealmanAvatarPictureOmniV15Params, type VolcesRealmanAvatarPictureOmniV15Resource, type VolcesRealmanAvatarPictureOmniV2Params, type VolcesRealmanAvatarPictureOmniV2Resource, type VolcesSeed3dParams, type VolcesSeed3dResource, type VolcesSeedance30I2vParams, type VolcesSeedance30I2vResource, type VolcesSeedance30Params, type VolcesSeedance30ProParams, type VolcesSeedance30ProResource, type VolcesSeedance30Resource, type VolcesSeedanceProFastParams, type VolcesSeedanceProFastResource, type VolcesSeededit20Params, type VolcesSeededit20Resource, type VolcesSeededit30I2iParams, type VolcesSeededit30I2iResource, type VolcesSeededit30Params, type VolcesSeededit30Resource, type VolcesSeededit3dStyleParams, type VolcesSeededit3dStyleResource, type VolcesSeededitMultiIpParams, type VolcesSeededitMultiIpResource, type VolcesSeededitMultiStyleParams, type VolcesSeededitMultiStyleResource, type VolcesSeededitPortraitParams, type VolcesSeededitPortraitResource, type VolcesSeededitSingleIpParams, type VolcesSeededitSingleIpResource, type VolcesSeedream30Params, type VolcesSeedream30Resource, type VolcesSeedream40Params, type VolcesSeedream40Resource, type VolcesSeedream45I2iParams, type VolcesSeedream45I2iResource, type VolcesSeedream45MultiBlendParams, type VolcesSeedream45MultiBlendResource, type VolcesSeedream45Params, type VolcesSeedream45Resource, type VolcesSubjectDetectionParams, type VolcesSubjectDetectionResource, type VolcesSubjectRecognitionParams, type VolcesSubjectRecognitionResource, type YouchuanDiffusionParams, type YouchuanDiffusionResource, type YouchuanEditParams, type YouchuanEditResource, type YouchuanEnhanceParams, type YouchuanEnhanceResource, type YouchuanExtendVideoParams, type YouchuanExtendVideoResource, type YouchuanInpaintParams, type YouchuanInpaintResource, type YouchuanOutpaintParams, type YouchuanOutpaintResource, type YouchuanPanParams, type YouchuanPanResource, type YouchuanRemixParams, type YouchuanRemixResource, type YouchuanRemoveBackgroundParams, type YouchuanRemoveBackgroundResource, type YouchuanRetextureParams, type YouchuanRetextureResource, type YouchuanUploadpaintParams, type YouchuanUploadpaintResource, type YouchuanUpscaleParams, type YouchuanUpscaleResource, type YouchuanVariationParams, type YouchuanVariationResource, type YouchuanVideoDiffusionParams, type YouchuanVideoDiffusionResource, type YouchuanVideoUpscaleParams, type YouchuanVideoUpscaleResource, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, validateResourceUrl, validateResources, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduQ2I2vReference, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,8 @@ function createConfig(options = {}) {
|
|
|
89
89
|
// 提供默认空字符串,实际请求时会动态获取
|
|
90
90
|
baseUrl,
|
|
91
91
|
fetch: fetchImpl,
|
|
92
|
-
timeout: options.timeout || 3e4
|
|
92
|
+
timeout: options.timeout || 3e4,
|
|
93
|
+
xProject: options.xProject || "SeaVerse"
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
function validateConfig(config) {
|
|
@@ -249,7 +250,8 @@ function initSeacloud(apiKeyOrConfig, options) {
|
|
|
249
250
|
globalConfig.client = new SeacloudClient({
|
|
250
251
|
apiKey: apiKey || "",
|
|
251
252
|
baseUrl: config.baseUrl,
|
|
252
|
-
timeout: config.timeout
|
|
253
|
+
timeout: config.timeout,
|
|
254
|
+
xProject: config.xProject
|
|
253
255
|
});
|
|
254
256
|
if (config.intervalMs !== void 0) {
|
|
255
257
|
globalConfig.defaultPollingOptions.intervalMs = config.intervalMs;
|
|
@@ -549,6 +551,32 @@ async function alibabaWan22T2iPlus(params) {
|
|
|
549
551
|
return resources;
|
|
550
552
|
}
|
|
551
553
|
|
|
554
|
+
// src/utils/validation.ts
|
|
555
|
+
function validateResourceUrl(resource, resourceType = "resource") {
|
|
556
|
+
if (!resource.url) {
|
|
557
|
+
throw new Error(`SDK returned ${resourceType} without URL`);
|
|
558
|
+
}
|
|
559
|
+
if (resource.type === "text") {
|
|
560
|
+
throw new Error(`SDK returned text instead of ${resourceType}: ${resource.url}`);
|
|
561
|
+
}
|
|
562
|
+
if (!resource.url.startsWith("http://") && !resource.url.startsWith("https://")) {
|
|
563
|
+
throw new Error(`SDK returned invalid ${resourceType} URL: ${resource.url}`);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function validateResources(resources, resourceType = "resource") {
|
|
567
|
+
if (!resources || resources.length === 0) {
|
|
568
|
+
throw new Error(`No ${resourceType}s returned from API`);
|
|
569
|
+
}
|
|
570
|
+
for (let i = 0; i < resources.length; i++) {
|
|
571
|
+
try {
|
|
572
|
+
validateResourceUrl(resources[i], resourceType);
|
|
573
|
+
} catch (error) {
|
|
574
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
575
|
+
throw new Error(`${resourceType} ${i + 1}/${resources.length}: ${errorMessage}`);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
552
580
|
// src/api/alibaba_wan25_i2i_preview.ts
|
|
553
581
|
async function alibabaWan25I2iPreview(params) {
|
|
554
582
|
const client = getClient();
|
|
@@ -570,6 +598,7 @@ async function alibabaWan25I2iPreview(params) {
|
|
|
570
598
|
for (const item of result.output) {
|
|
571
599
|
if (item.content) {
|
|
572
600
|
for (const resource of item.content) {
|
|
601
|
+
validateResourceUrl(resource, "image");
|
|
573
602
|
resources.push({
|
|
574
603
|
type: resource.type || "unknown",
|
|
575
604
|
url: resource.url || "",
|
|
@@ -605,6 +634,7 @@ async function alibabaWan25T2iPreview(params) {
|
|
|
605
634
|
for (const item of result.output) {
|
|
606
635
|
if (item.content) {
|
|
607
636
|
for (const resource of item.content) {
|
|
637
|
+
validateResourceUrl(resource, "image");
|
|
608
638
|
resources.push({
|
|
609
639
|
type: resource.type || "unknown",
|
|
610
640
|
url: resource.url || "",
|
|
@@ -990,6 +1020,7 @@ async function alibabaWanx25I2vPreview(params) {
|
|
|
990
1020
|
for (const item of result.output) {
|
|
991
1021
|
if (item.content) {
|
|
992
1022
|
for (const resource of item.content) {
|
|
1023
|
+
validateResourceUrl(resource, "video");
|
|
993
1024
|
resources.push({
|
|
994
1025
|
type: resource.type || "unknown",
|
|
995
1026
|
url: resource.url || "",
|
|
@@ -1025,6 +1056,7 @@ async function alibabaWanx25T2vPreview(params) {
|
|
|
1025
1056
|
for (const item of result.output) {
|
|
1026
1057
|
if (item.content) {
|
|
1027
1058
|
for (const resource of item.content) {
|
|
1059
|
+
validateResourceUrl(resource, "video");
|
|
1028
1060
|
resources.push({
|
|
1029
1061
|
type: resource.type || "unknown",
|
|
1030
1062
|
url: resource.url || "",
|
|
@@ -1480,6 +1512,7 @@ async function googleGemini3ProImage(params) {
|
|
|
1480
1512
|
for (const item of result.output) {
|
|
1481
1513
|
if (item.content) {
|
|
1482
1514
|
for (const resource of item.content) {
|
|
1515
|
+
validateResourceUrl(resource, "image");
|
|
1483
1516
|
resources.push({
|
|
1484
1517
|
type: resource.type || "unknown",
|
|
1485
1518
|
url: resource.url || "",
|
|
@@ -1515,6 +1548,7 @@ async function googleGeminiImage(params) {
|
|
|
1515
1548
|
for (const item of result.output) {
|
|
1516
1549
|
if (item.content) {
|
|
1517
1550
|
for (const resource of item.content) {
|
|
1551
|
+
validateResourceUrl(resource, "image");
|
|
1518
1552
|
resources.push({
|
|
1519
1553
|
type: resource.type || "unknown",
|
|
1520
1554
|
url: resource.url || "",
|
|
@@ -3883,14 +3917,17 @@ async function appSearch(params) {
|
|
|
3883
3917
|
const timeoutId = setTimeout(() => controller.abort(), config.timeout);
|
|
3884
3918
|
try {
|
|
3885
3919
|
const requestId = `req-${Date.now()}-${Math.random().toString(36).substring(7)}`;
|
|
3920
|
+
const headers = {
|
|
3921
|
+
"Content-Type": "application/json",
|
|
3922
|
+
"Authorization": `Bearer ${config.apiKey}`,
|
|
3923
|
+
"X-Request-Id": requestId
|
|
3924
|
+
};
|
|
3925
|
+
if (config.xProject) {
|
|
3926
|
+
headers["X-Project"] = config.xProject;
|
|
3927
|
+
}
|
|
3886
3928
|
const response = await config.fetch(url, {
|
|
3887
3929
|
method: "POST",
|
|
3888
|
-
headers
|
|
3889
|
-
"Content-Type": "application/json",
|
|
3890
|
-
"Authorization": `Bearer ${config.apiKey}`,
|
|
3891
|
-
"X-Request-Id": requestId,
|
|
3892
|
-
"X-Project": "KIIRA"
|
|
3893
|
-
},
|
|
3930
|
+
headers,
|
|
3894
3931
|
body: JSON.stringify(params),
|
|
3895
3932
|
signal: controller.signal
|
|
3896
3933
|
});
|
|
@@ -4118,6 +4155,47 @@ async function viduQ2(params) {
|
|
|
4118
4155
|
return resources;
|
|
4119
4156
|
}
|
|
4120
4157
|
|
|
4158
|
+
// src/api/viduq2_i2v_reference.ts
|
|
4159
|
+
async function viduQ2I2vReference(params) {
|
|
4160
|
+
const client = getClient();
|
|
4161
|
+
if (params.images && params.subjects) {
|
|
4162
|
+
throw new Error("images \u548C subjects \u53C2\u6570\u4E92\u65A5\uFF0C\u53EA\u80FD\u9009\u62E9\u5176\u4E2D\u4E00\u4E2A");
|
|
4163
|
+
}
|
|
4164
|
+
if (!params.images && !params.subjects) {
|
|
4165
|
+
throw new Error("\u5FC5\u987B\u63D0\u4F9B images \u6216 subjects \u53C2\u6570\u4E4B\u4E00");
|
|
4166
|
+
}
|
|
4167
|
+
const pollingOptions = {
|
|
4168
|
+
intervalMs: 3e3,
|
|
4169
|
+
maxAttempts: 60
|
|
4170
|
+
};
|
|
4171
|
+
const result = await createAndWaitTask(
|
|
4172
|
+
client,
|
|
4173
|
+
"/model/v1/generation",
|
|
4174
|
+
{
|
|
4175
|
+
model: "viduq2_i2v_reference",
|
|
4176
|
+
input: [{ params }]
|
|
4177
|
+
},
|
|
4178
|
+
pollingOptions
|
|
4179
|
+
);
|
|
4180
|
+
const resources = [];
|
|
4181
|
+
if (result.output) {
|
|
4182
|
+
for (const item of result.output) {
|
|
4183
|
+
if (item.content) {
|
|
4184
|
+
for (const resource of item.content) {
|
|
4185
|
+
resources.push({
|
|
4186
|
+
type: resource.type || "unknown",
|
|
4187
|
+
url: resource.url || "",
|
|
4188
|
+
size: resource.size,
|
|
4189
|
+
jobId: resource.jobId,
|
|
4190
|
+
...resource
|
|
4191
|
+
});
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
}
|
|
4195
|
+
}
|
|
4196
|
+
return resources;
|
|
4197
|
+
}
|
|
4198
|
+
|
|
4121
4199
|
// src/api/vidu_template.ts
|
|
4122
4200
|
async function viduTemplate(params) {
|
|
4123
4201
|
const client = getClient();
|
|
@@ -4663,6 +4741,7 @@ async function volcesSeededit30(params) {
|
|
|
4663
4741
|
for (const item of result.output) {
|
|
4664
4742
|
if (item.content) {
|
|
4665
4743
|
for (const resource of item.content) {
|
|
4744
|
+
validateResourceUrl(resource, "image");
|
|
4666
4745
|
resources.push({
|
|
4667
4746
|
type: resource.type || "unknown",
|
|
4668
4747
|
url: resource.url || "",
|
|
@@ -4908,6 +4987,7 @@ async function volcesSeedream30(params) {
|
|
|
4908
4987
|
for (const item of result.output) {
|
|
4909
4988
|
if (item.content) {
|
|
4910
4989
|
for (const resource of item.content) {
|
|
4990
|
+
validateResourceUrl(resource, "image");
|
|
4911
4991
|
resources.push({
|
|
4912
4992
|
type: resource.type || "unknown",
|
|
4913
4993
|
url: resource.url || "",
|
|
@@ -4943,6 +5023,7 @@ async function volcesSeedream40(params) {
|
|
|
4943
5023
|
for (const item of result.output) {
|
|
4944
5024
|
if (item.content) {
|
|
4945
5025
|
for (const resource of item.content) {
|
|
5026
|
+
validateResourceUrl(resource, "image");
|
|
4946
5027
|
resources.push({
|
|
4947
5028
|
type: resource.type || "unknown",
|
|
4948
5029
|
url: resource.url || "",
|
|
@@ -4978,6 +5059,7 @@ async function volcesSeedream45(params) {
|
|
|
4978
5059
|
for (const item of result.output) {
|
|
4979
5060
|
if (item.content) {
|
|
4980
5061
|
for (const resource of item.content) {
|
|
5062
|
+
validateResourceUrl(resource, "image");
|
|
4981
5063
|
resources.push({
|
|
4982
5064
|
type: resource.type || "unknown",
|
|
4983
5065
|
url: resource.url || "",
|
|
@@ -5013,6 +5095,7 @@ async function volcesSeedream45I2i(params) {
|
|
|
5013
5095
|
for (const item of result.output) {
|
|
5014
5096
|
if (item.content) {
|
|
5015
5097
|
for (const resource of item.content) {
|
|
5098
|
+
validateResourceUrl(resource, "image");
|
|
5016
5099
|
resources.push({
|
|
5017
5100
|
type: resource.type || "image",
|
|
5018
5101
|
url: resource.url || "",
|
|
@@ -5029,16 +5112,28 @@ async function volcesSeedream45I2i(params) {
|
|
|
5029
5112
|
// src/api/volces_seedream_4_5_multi_blend.ts
|
|
5030
5113
|
async function volcesSeedream45MultiBlend(params) {
|
|
5031
5114
|
const client = getClient();
|
|
5115
|
+
const imageList = params.image || params.images;
|
|
5116
|
+
if (!imageList || !Array.isArray(imageList)) {
|
|
5117
|
+
throw new Error('Parameter "image" or "images" is required and must be an array');
|
|
5118
|
+
}
|
|
5119
|
+
if (imageList.length < 2 || imageList.length > 14) {
|
|
5120
|
+
throw new Error("Image array must contain between 2 and 14 images");
|
|
5121
|
+
}
|
|
5032
5122
|
const pollingOptions = {
|
|
5033
5123
|
intervalMs: 3e3,
|
|
5034
5124
|
maxAttempts: 60
|
|
5035
5125
|
};
|
|
5126
|
+
const requestParams = {
|
|
5127
|
+
...params,
|
|
5128
|
+
image: imageList
|
|
5129
|
+
};
|
|
5130
|
+
delete requestParams.images;
|
|
5036
5131
|
const result = await createAndWaitTask(
|
|
5037
5132
|
client,
|
|
5038
5133
|
"/model/v1/generation",
|
|
5039
5134
|
{
|
|
5040
5135
|
model: "volces_seedream_4_5_multi_blend",
|
|
5041
|
-
input: [{ params }]
|
|
5136
|
+
input: [{ params: requestParams }]
|
|
5042
5137
|
},
|
|
5043
5138
|
pollingOptions
|
|
5044
5139
|
);
|
|
@@ -5230,14 +5325,16 @@ async function agentChatCompletions(params) {
|
|
|
5230
5325
|
const controller = new AbortController();
|
|
5231
5326
|
const timeoutId = setTimeout(() => controller.abort(), config.timeout);
|
|
5232
5327
|
try {
|
|
5328
|
+
const headers = {
|
|
5329
|
+
"Content-Type": "application/json",
|
|
5330
|
+
"Authorization": `Bearer ${config.apiKey}`
|
|
5331
|
+
};
|
|
5332
|
+
if (config.xProject) {
|
|
5333
|
+
headers["X-Project"] = config.xProject;
|
|
5334
|
+
}
|
|
5233
5335
|
const response = await config.fetch(url, {
|
|
5234
5336
|
method: "POST",
|
|
5235
|
-
headers
|
|
5236
|
-
"Content-Type": "application/json",
|
|
5237
|
-
"Authorization": `Bearer ${config.apiKey}`,
|
|
5238
|
-
"X-Project": "SeaArt"
|
|
5239
|
-
// Required header for agent API
|
|
5240
|
-
},
|
|
5337
|
+
headers,
|
|
5241
5338
|
body: JSON.stringify(requestBody),
|
|
5242
5339
|
signal: controller.signal
|
|
5243
5340
|
});
|
|
@@ -6059,6 +6156,6 @@ async function youchuanVideoUpscale(params) {
|
|
|
6059
6156
|
return resources;
|
|
6060
6157
|
}
|
|
6061
6158
|
|
|
6062
|
-
export { SeacloudClient, SeacloudError, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
|
|
6159
|
+
export { SeacloudClient, SeacloudError, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, appGeneration, appSearch, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, getTaskStatus, googleGemini3ProImage, googleGeminiImage, googleImagen4FastGenerate, googleImagen4Generate, googleImagen4UltraGenerate, googleVeo20Generate001, googleVeo20GenerateExp, googleVeo20GeneratePreview, googleVeo30FastGenerate001, googleVeo30Generate001, googleVeo31, initSeacloud, klingAvatar, klingDurationExtension, klingEffectsMultiV1, klingEffectsMultiV15, klingEffectsMultiV16, klingEffectsSingle, klingLipsync, klingOmniImage, klingOmniVideo, klingV1, klingV15, klingV15I2v, klingV16, klingV16I2v, klingV1I2v, klingV21I2v, klingV21Master, klingV21MasterI2v, klingV25Turbo, klingV25TurboI2v, klingV26, klingV26I2v, klingV2Master, klingV2MasterI2v, llmChatCompletions, microsoftGptImage1, microsoftGptImage15, microsoftSora2, minimaxHailuo02, minimaxHailuo02I2v, minimaxHailuo23FastI2v, minimaxHailuo23I2v, minimaxI2v01, minimaxI2v01Director, minimaxI2v01Live, minimaxT2a, minimaxT2v01, minimaxT2v01Director, pixverseV35I2v, pixverseV35T2v, pixverseV35Transition, pixverseV45I2v, pixverseV45T2v, pixverseV45Transition, pixverseV4I2v, pixverseV4T2v, pixverseV4Transition, pixverseV55I2v, pixverseV55T2v, pixverseV55Transition, pixverseV5I2v, pixverseV5T2v, pixverseV5Transition, pollTaskUntilComplete, resetConfig, runwayGen3aTurboI2v, scan, setDefaultPollingOptions, templateSpecs, tencentHunyuan3d, tencentHunyuan3dPro, tencentHunyuan3dRapid, tencentImageCreation3, tencentMpsSuperResolution, validateConfig, validateResourceUrl, validateResources, vidu15, vidu15I2v, vidu20I2v, viduQ1, viduQ1I2v, viduQ2, viduQ2I2vReference, viduTemplate, viduTemplateV2, volcesJimeng30, volcesJimeng31, volcesJimengDreamActorM1, volcesJimengI2i30, volcesRealmanAvatarImitatorV2v, volcesRealmanAvatarPictureOmniV15, volcesRealmanAvatarPictureOmniV2, volcesSeed3d, volcesSeedance30, volcesSeedance30I2v, volcesSeedance30Pro, volcesSeedanceProFast, volcesSeededit20, volcesSeededit30, volcesSeededit30I2i, volcesSeededit3dStyle, volcesSeededitMultiIp, volcesSeededitMultiStyle, volcesSeededitPortrait, volcesSeededitSingleIp, volcesSeedream30, volcesSeedream40, volcesSeedream45, volcesSeedream45I2i, volcesSeedream45MultiBlend, volcesSubjectDetection, volcesSubjectRecognition, youchuanDiffusion, youchuanEdit, youchuanEnhance, youchuanExtendVideo, youchuanInpaint, youchuanOutpaint, youchuanPan, youchuanRemix, youchuanRemoveBackground, youchuanRetexture, youchuanUploadpaint, youchuanUpscale, youchuanVariation, youchuanVideoDiffusion, youchuanVideoUpscale };
|
|
6063
6160
|
//# sourceMappingURL=index.js.map
|
|
6064
6161
|
//# sourceMappingURL=index.js.map
|