seacloud-sdk 0.5.0 → 0.5.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/dist/index.d.ts CHANGED
@@ -11882,27 +11882,96 @@ declare function llmChatCompletions(params: LlmChatCompletionsParams & {
11882
11882
  stream: true;
11883
11883
  }): Promise<AsyncIterable<ChatCompletionChunk>>;
11884
11884
 
11885
+ /**
11886
+ * ============================================================================
11887
+ * SeaCloud Fast Agent Chat Completions API
11888
+ * ============================================================================
11889
+ *
11890
+ * This module provides a comprehensive API for interacting with SeaCloud's
11891
+ * Fast Agent system, which supports:
11892
+ *
11893
+ * - Multi-turn conversations with session management
11894
+ * - Tool calling for artifact generation (images, videos, music, etc.)
11895
+ * - Streaming and non-streaming response modes
11896
+ * - Multiple content types (text, image, video, audio, file)
11897
+ * - Flexible model selection (Claude, GPT, Gemini, etc.)
11898
+ *
11899
+ * IMPORTANT NOTES:
11900
+ * ================
11901
+ *
11902
+ * 1. REQUIRED PARAMETERS:
11903
+ * - agent_id: Caller-provided agent identifier
11904
+ * - messages: Array of conversation messages
11905
+ *
11906
+ * 2. TIMEOUT CONFIGURATION:
11907
+ * - Default timeout: 30 seconds (may be too short for tool calls)
11908
+ * - Recommended for agent operations: 120 seconds or more
11909
+ * - Set via initSeacloud({ timeout: 120000 })
11910
+ *
11911
+ * 3. STREAMING MODE:
11912
+ * - API always returns Server-Sent Events (SSE) format
11913
+ * - params.stream controls how SDK consumes the response
11914
+ * - For tool calls (image/video generation), streaming is RECOMMENDED
11915
+ *
11916
+ * 4. AUTHENTICATION:
11917
+ * - Requires 'X-Project: SeaArt' header (automatically added)
11918
+ * - Uses Bearer token authentication
11919
+ *
11920
+ * 5. SESSION MANAGEMENT:
11921
+ * - Use session_id to maintain multi-turn conversations
11922
+ * - Increment seq for each message in the session
11923
+ *
11924
+ * @see AGENT_API.md for detailed documentation and examples
11925
+ */
11885
11926
  /**
11886
11927
  * Message content type
11887
11928
  */
11888
11929
  type AgentMessageContentType = 'text' | 'image' | 'video' | 'audio' | 'file';
11889
11930
  /**
11890
- * Message content item
11931
+ * Base message content
11891
11932
  */
11892
- interface AgentMessageContent {
11893
- /**
11894
- * Content type
11895
- */
11933
+ interface BaseMessageContent {
11896
11934
  type: AgentMessageContentType;
11897
- /**
11898
- * Text content (for type: 'text')
11899
- */
11900
- text?: string;
11901
- /**
11902
- * URL (for type: 'image' | 'video' | 'audio' | 'file')
11903
- */
11904
- url?: string;
11905
11935
  }
11936
+ /**
11937
+ * Text message content
11938
+ */
11939
+ interface TextMessageContent extends BaseMessageContent {
11940
+ type: 'text';
11941
+ text: string;
11942
+ }
11943
+ /**
11944
+ * Image message content
11945
+ */
11946
+ interface ImageMessageContent extends BaseMessageContent {
11947
+ type: 'image';
11948
+ image_url: string;
11949
+ }
11950
+ /**
11951
+ * Video message content
11952
+ */
11953
+ interface VideoMessageContent extends BaseMessageContent {
11954
+ type: 'video';
11955
+ video_url: string;
11956
+ }
11957
+ /**
11958
+ * Audio message content
11959
+ */
11960
+ interface AudioMessageContent extends BaseMessageContent {
11961
+ type: 'audio';
11962
+ audio_url: string;
11963
+ }
11964
+ /**
11965
+ * File message content
11966
+ */
11967
+ interface FileMessageContent extends BaseMessageContent {
11968
+ type: 'file';
11969
+ file_url: string;
11970
+ }
11971
+ /**
11972
+ * Message content item (union type for type safety)
11973
+ */
11974
+ type AgentMessageContent = TextMessageContent | ImageMessageContent | VideoMessageContent | AudioMessageContent | FileMessageContent;
11906
11975
  /**
11907
11976
  * Message role type
11908
11977
  */
@@ -12025,14 +12094,26 @@ interface AgentChatCompletionsParams {
12025
12094
  */
12026
12095
  user_id?: string;
12027
12096
  /**
12028
- * Message ID for SSE reconnection
12029
- * Used when connection drops during streaming
12030
- * Allows resuming from where the connection was lost
12097
+ * Message ID for SSE reconnection (ADVANCED USE)
12098
+ * Only use this when resuming an interrupted streaming response
12099
+ * Server returns msg_id in response; use it to resume from disconnect point
12100
+ *
12101
+ * WARNING: Do NOT use for multi-turn conversations
12102
+ * For multi-turn, just include full message history + session_id
12103
+ *
12104
+ * @example
12105
+ * // DON'T do this for multi-turn:
12106
+ * // { msg_id: previousResponse.msg_id, seq: 1 }
12107
+ *
12108
+ * // DO this instead:
12109
+ * // { session_id: previousResponse.session_id, messages: [...allMessages] }
12031
12110
  */
12032
12111
  msg_id?: string;
12033
12112
  /**
12034
- * Sequence number for message resumption
12035
- * Used with msg_id for resuming interrupted streams
12113
+ * Sequence number for message resumption (ADVANCED USE)
12114
+ * Only used with msg_id for resuming interrupted streams
12115
+ * For regular multi-turn conversations, omit this parameter
12116
+ *
12036
12117
  * @default 0
12037
12118
  */
12038
12119
  seq?: number;
@@ -12579,15 +12660,52 @@ declare function agentChatCompletions(params: AgentChatCompletionsParams & {
12579
12660
  }): Promise<AsyncIterable<AgentChatCompletionChunk>>;
12580
12661
  /**
12581
12662
  * Helper function to create a text message
12663
+ *
12664
+ * @param role - Message role ('user' | 'assistant' | 'developer' | 'tool')
12665
+ * @param text - Text content
12666
+ * @returns Agent message with text content
12667
+ *
12668
+ * @example
12669
+ * ```typescript
12670
+ * const message = createTextMessage('user', 'Hello!');
12671
+ * ```
12582
12672
  */
12583
12673
  declare function createTextMessage(role: AgentMessageRole, text: string): AgentMessage;
12584
12674
  /**
12585
12675
  * Helper function to create a message with image
12676
+ *
12677
+ * @param role - Message role ('user' | 'assistant' | 'developer' | 'tool')
12678
+ * @param text - Text content
12679
+ * @param imageUrl - Image URL
12680
+ * @returns Agent message with text and image content
12681
+ *
12682
+ * @example
12683
+ * ```typescript
12684
+ * const message = createImageMessage('user', 'What is this?', 'https://example.com/image.jpg');
12685
+ * ```
12586
12686
  */
12587
12687
  declare function createImageMessage(role: AgentMessageRole, text: string, imageUrl: string): AgentMessage;
12688
+ /**
12689
+ * Helper function to create a message with video
12690
+ *
12691
+ * @param role - Message role
12692
+ * @param text - Text content
12693
+ * @param videoUrl - Video URL
12694
+ * @returns Agent message with text and video content
12695
+ */
12696
+ declare function createVideoMessage(role: AgentMessageRole, text: string, videoUrl: string): AgentMessage;
12697
+ /**
12698
+ * Helper function to create a message with audio
12699
+ *
12700
+ * @param role - Message role
12701
+ * @param text - Text content
12702
+ * @param audioUrl - Audio URL
12703
+ * @returns Agent message with text and audio content
12704
+ */
12705
+ declare function createAudioMessage(role: AgentMessageRole, text: string, audioUrl: string): AgentMessage;
12588
12706
  /**
12589
12707
  * Helper function to create a tool
12590
12708
  */
12591
12709
  declare function createTool(toolName: string): AgentTool;
12592
12710
 
12593
- 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 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 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 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 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 RunwayGen3aTurboI2vParams, type RunwayGen3aTurboI2vResource, SeacloudClient, type SeacloudConfig, SeacloudError, type TaskError, type TaskResult, type TaskStatus, 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, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createConfig, createImageMessage, createTextMessage, createTool, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, 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, setDefaultPollingOptions, 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 };
12711
+ 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 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 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 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 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 RunwayGen3aTurboI2vParams, type RunwayGen3aTurboI2vResource, SeacloudClient, type SeacloudConfig, SeacloudError, type TaskError, type TaskResult, type TaskStatus, 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, agentChatCompletions, alibabaAnimateAnyoneDetect, alibabaAnimateAnyoneTemplate, alibabaAnimateAnyoneVideo, alibabaQianwenImage, alibabaWan22T2iFlash, alibabaWan22T2iPlus, alibabaWan25I2iPreview, alibabaWan25T2iPreview, alibabaWanx20T2iTurbo, alibabaWanx21I2vPlus, alibabaWanx21I2vTurbo, alibabaWanx21T2iPlus, alibabaWanx21T2iTurbo, alibabaWanx21T2vPlus, alibabaWanx21T2vTurbo, alibabaWanx22I2vFlash, alibabaWanx22I2vPlus, alibabaWanx22T2vPlus, alibabaWanx25I2vPreview, alibabaWanx25T2vPreview, alibabaWanx26I2v, alibabaWanx26Reference, alibabaWanx26T2v, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, 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, setDefaultPollingOptions, 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 };
package/dist/index.js CHANGED
@@ -5085,9 +5085,13 @@ async function agentChatCompletions(params) {
5085
5085
  const client = getClient();
5086
5086
  const config = client.getConfig();
5087
5087
  const url = `${config.baseUrl}/agent/api/v1/chat/completions`;
5088
+ const model = params.model || "custom_openai/vertex-ai-claude-sonnet-4.5";
5089
+ const userWantsStreaming = params.stream !== false;
5088
5090
  const requestBody = {
5089
5091
  ...params,
5090
- model: params.model || "custom_openai/vertex-ai-claude-sonnet-4.5"
5092
+ model,
5093
+ stream: true
5094
+ // Always request SSE from API
5091
5095
  };
5092
5096
  const controller = new AbortController();
5093
5097
  const timeoutId = setTimeout(() => controller.abort(), config.timeout);
@@ -5098,6 +5102,7 @@ async function agentChatCompletions(params) {
5098
5102
  "Content-Type": "application/json",
5099
5103
  "Authorization": `Bearer ${config.apiKey}`,
5100
5104
  "X-Project": "SeaArt"
5105
+ // Required header for agent API
5101
5106
  },
5102
5107
  body: JSON.stringify(requestBody),
5103
5108
  signal: controller.signal
@@ -5111,7 +5116,7 @@ async function agentChatCompletions(params) {
5111
5116
  errorBody
5112
5117
  );
5113
5118
  }
5114
- if (params.stream) {
5119
+ if (userWantsStreaming) {
5115
5120
  return parseAgentStreamingResponse(response);
5116
5121
  }
5117
5122
  return await parseAgentNonStreamingResponse(response);
@@ -5278,7 +5283,25 @@ function createImageMessage(role, text, imageUrl) {
5278
5283
  role,
5279
5284
  content: [
5280
5285
  { type: "text", text },
5281
- { type: "image", url: imageUrl }
5286
+ { type: "image", image_url: imageUrl }
5287
+ ]
5288
+ };
5289
+ }
5290
+ function createVideoMessage(role, text, videoUrl) {
5291
+ return {
5292
+ role,
5293
+ content: [
5294
+ { type: "text", text },
5295
+ { type: "video", video_url: videoUrl }
5296
+ ]
5297
+ };
5298
+ }
5299
+ function createAudioMessage(role, text, audioUrl) {
5300
+ return {
5301
+ role,
5302
+ content: [
5303
+ { type: "text", text },
5304
+ { type: "audio", audio_url: audioUrl }
5282
5305
  ]
5283
5306
  };
5284
5307
  }
@@ -5291,6 +5314,6 @@ function createTool(toolName) {
5291
5314
  };
5292
5315
  }
5293
5316
 
5294
- 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, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createConfig, createImageMessage, createTextMessage, createTool, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, 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, setDefaultPollingOptions, 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 };
5317
+ 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, blackforestlabsFlux11Pro, blackforestlabsFlux1Pro, blackforestlabsFlux2Flex, blackforestlabsFlux2FlexEdit, blackforestlabsFlux2Pro, blackforestlabsFlux2ProEdit, blackforestlabsFluxKontextMax, blackforestlabsFluxKontextPro, createAndWaitTask, createAudioMessage, createConfig, createImageMessage, createTextMessage, createTool, createVideoMessage, elevenlabsTtsGenerator, getClient, getDefaultPollingOptions, 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, setDefaultPollingOptions, 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 };
5295
5318
  //# sourceMappingURL=index.js.map
5296
5319
  //# sourceMappingURL=index.js.map