seacloud-sdk 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +493 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +137 -19
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/types.ts","../src/core/config.ts","../src/core/client.ts","../src/cli.ts"],"names":["__filename"],"mappings":";;;;;AA4EO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CACE,OAAA,EACO,UAAA,EACA,QAAA,EACP;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHN,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAGP,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF,CAAA;;;AC9EO,SAAS,YAAA,CAAa,OAAA,GAA0B,EAAC,EAA6B;AAEnF,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,KACP,OAAO,YAAY,WAAA,GAAc,OAAA,CAAQ,GAAA,EAAK,iBAAA,GAAoB,MAAA,CAAA,IACnE,EAAA;AAGf,EAAA,MAAM,OAAA,GAAU,QAAQ,OAAA,KACP,OAAO,YAAY,WAAA,GAAc,OAAA,CAAQ,GAAA,EAAK,iBAAA,GAAoB,MAAA,CAAA,IACnE,8BAAA;AAGhB,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,KAAA,IAAS,UAAA,CAAW,KAAA;AAE9C,EAAA,IAAI,CAAC,SAAA,EAAW;AACd,IAAA,MAAM,IAAI,MAAM,mGAAmG,CAAA;AAAA,EACrH;AAEA,EAAA,OAAO;AAAA,IACL,MAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA,EAAO,SAAA;AAAA,IACP,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AAEjC,EAAA,IAAI,IAAA,CAAK,MAAA,KAAW,CAAA,IAAK,IAAA,CAAK,CAAC,MAAM,QAAA,IAAY,IAAA,CAAK,CAAC,CAAA,KAAM,IAAA,EAAM;AACjE,IAAA,QAAA,EAAS;AACT,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AAEA,EAAA,MAAM,KAAA,GAAQ,KAAK,CAAC,CAAA;AAGpB,EAAA,IAAI,KAAA,CAAM,UAAA,CAAW,IAAI,CAAA,EAAG;AAC1B,IAAA,OAAA,CAAQ,MAAM,4BAA4B,CAAA;AAC1C,IAAA,OAAA,CAAQ,IAAI,yCAAyC,CAAA;AACrD,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AAEA,EAAA,MAAM,OAAA,GAAU,SAAA,CAAU,IAAA,CAAK,KAAA,CAAM,CAAC,CAAC,CAAA;AACvC,EAAA,MAAM,SAAA,CAAU,OAAO,OAAO,CAAA;AAChC;AAEA,IAAA,EAAK,CAAE,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA","file":"cli.js","sourcesContent":["/**\n * SeaCloud SDK 核心类型定义\n */\n\n/**\n * SDK 配置选项\n */\nexport interface SeacloudConfig {\n /** API Service Token - 从环境变量 API_SERVICE_TOKEN 读取或直接传入 */\n apiKey?: string;\n /** 代理服务器基础 URL,默认为 http://localhost:8080 */\n baseUrl?: string;\n /** 自定义 fetch 实现(可选,用于 Node.js < 18 或测试) */\n fetch?: typeof fetch;\n /** 请求超时时间(毫秒),默认 30000 */\n timeout?: number;\n}\n\n/**\n * 任务状态\n */\nexport type TaskStatus = 'pending' | 'processing' | 'in_progress' | 'completed' | 'failed';\n\n/**\n * 任务错误信息\n */\nexport interface TaskError {\n code: string;\n message: string;\n details?: any;\n}\n\n/**\n * 任务结果\n */\nexport interface TaskResult {\n /** 任务 ID */\n id: string;\n /** 创建时间戳 */\n created_at: number;\n /** 任务状态 */\n status: TaskStatus;\n /** 错误信息(如果失败) */\n error?: TaskError | null;\n /** 模型名称 */\n model: string;\n /** 输出结果 */\n output?: Array<{\n content?: Array<{\n type?: string;\n url?: string;\n size?: number;\n jobId?: string;\n [key: string]: any;\n }>;\n [key: string]: any;\n }>;\n /** 其他字段 */\n [key: string]: any;\n}\n\n/**\n * 任务轮询选项\n */\nexport interface PollingOptions {\n /** 轮询间隔(毫秒),默认 3000 */\n intervalMs?: number;\n /** 最大尝试次数,默认 120 */\n maxAttempts?: number;\n /** 进度回调函数 */\n onProgress?: (attempt: number, status: TaskStatus) => void;\n}\n\n/**\n * HTTP 响应错误\n */\nexport class SeacloudError extends Error {\n constructor(\n message: string,\n public statusCode?: number,\n public response?: any,\n ) {\n super(message);\n this.name = 'SeacloudError';\n }\n}\n","import type { SeacloudConfig } from './types.js';\n\n/**\n * 创建 SDK 配置\n * @param options 配置选项\n * @returns 完整的配置对象\n */\nexport function createConfig(options: SeacloudConfig = {}): Required<SeacloudConfig> {\n // 优先级:传入的 apiKey > 环境变量 API_SERVICE_TOKEN\n const apiKey = options.apiKey ||\n (typeof process !== 'undefined' ? process.env?.API_SERVICE_TOKEN : undefined) ||\n '';\n\n // 使用环境变量或传入的 baseUrl\n const baseUrl = options.baseUrl ||\n (typeof process !== 'undefined' ? process.env?.SEACLOUD_BASE_URL : undefined) ||\n 'http://proxy.sg.seaverse.dev';\n\n // 使用全局 fetch 或自定义实现\n const fetchImpl = options.fetch || globalThis.fetch;\n\n if (!fetchImpl) {\n throw new Error('fetch is not available. Please provide a fetch implementation in config or upgrade to Node.js 18+');\n }\n\n return {\n apiKey,\n baseUrl,\n fetch: fetchImpl,\n timeout: options.timeout || 30000,\n };\n}\n\n/**\n * 验证配置\n * @param config 配置对象\n * @throws 如果配置无效\n */\nexport function validateConfig(config: Required<SeacloudConfig>): void {\n if (!config.apiKey) {\n throw new Error(\n 'API key is required. Set API_SERVICE_TOKEN environment variable or pass apiKey in config.'\n );\n }\n\n if (!config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n if (typeof config.fetch !== 'function') {\n throw new Error('fetch must be a function');\n }\n}\n","import type { SeacloudConfig, TaskResult } from './types.js';\nimport { SeacloudError } from './types.js';\nimport { createConfig, validateConfig } from './config.js';\n\n/**\n * SeaCloud HTTP 客户端\n * 用于创建任务和查询任务状态\n */\nexport class SeacloudClient {\n private config: Required<SeacloudConfig>;\n\n constructor(config: SeacloudConfig = {}) {\n this.config = createConfig(config);\n validateConfig(this.config);\n }\n\n /**\n * 创建一个新任务\n * @param endpoint API 端点路径(例如:/model/tasks)\n * @param body 请求体\n * @returns 任务结果\n */\n async createTask(endpoint: string, body: Record<string, any>): Promise<TaskResult> {\n const url = `${this.config.baseUrl}${endpoint}`;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await this.config.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.config.apiKey}`,\n },\n body: JSON.stringify(body),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n const result = await response.json();\n return result as TaskResult;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${this.config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n }\n\n /**\n * 查询任务状态\n * @param endpoint API 端点路径(例如:/model/v1/generation)\n * @param taskId 任务 ID\n * @returns 任务结果\n */\n async getTaskStatus(endpoint: string, taskId: string): Promise<TaskResult> {\n const url = `${this.config.baseUrl}${endpoint}/task/${taskId}`;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await this.config.fetch(url, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${this.config.apiKey}`,\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n const result = await response.json();\n return result as TaskResult;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${this.config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n }\n\n /**\n * 获取当前配置\n */\n getConfig(): Readonly<Required<SeacloudConfig>> {\n return { ...this.config };\n }\n}\n","#!/usr/bin/env node\n\nimport { SeacloudClient } from './core/index.js';\nimport { readFileSync } from 'fs';\nimport { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\ninterface CliOptions {\n apiKey?: string;\n baseUrl?: string;\n model?: string;\n params?: Record<string, any>;\n}\n\nfunction showHelp() {\n console.log(`\nSeaCloud CLI - Test AI models from command line\n\nUsage:\n seacloud <model> [options]\n\nOptions:\n --api-key <key> API key (or set API_SERVICE_TOKEN env var)\n --base-url <url> Base URL (or set API_BASE_URL env var)\n --params <json> JSON parameters for the model\n\nExamples:\n # Test mureka song generator\n seacloud mureka_song_generator --params '{\"lyrics\":\"Happy birthday\",\"style\":\"pop\"}'\n\n # Test minimax TTS\n seacloud minimax_tts --params '{\"text\":\"Hello world\",\"voice_id\":\"male-qn-qingse\"}'\n\n # Test flux image generation\n seacloud flux_1_1_pro --params '{\"prompt\":\"a beautiful sunset\"}'\n\n # Use custom API key and base URL\n seacloud flux_1_1_pro --api-key sa-xxx --base-url http://localhost:8080 --params '{\"prompt\":\"test\"}'\n\nEnvironment Variables:\n API_SERVICE_TOKEN API authentication token\n API_BASE_URL Base URL for API endpoints\n`);\n}\n\nfunction parseArgs(args: string[]): CliOptions {\n const options: CliOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n\n switch (arg) {\n case '--api-key':\n options.apiKey = args[++i];\n break;\n case '--base-url':\n options.baseUrl = args[++i];\n break;\n case '--model':\n options.model = args[++i];\n break;\n case '--params':\n try {\n options.params = JSON.parse(args[++i]);\n } catch (e) {\n console.error('Error: Invalid JSON for --params');\n process.exit(1);\n }\n break;\n }\n }\n\n return options;\n}\n\nasync function testModel(model: string, options: CliOptions) {\n const apiKey = options.apiKey || process.env.API_SERVICE_TOKEN;\n const baseUrl = options.baseUrl || process.env.API_BASE_URL || 'http://localhost:8080';\n\n if (!apiKey) {\n console.error('Error: API key not provided. Use --api-key or set API_SERVICE_TOKEN env var');\n process.exit(1);\n }\n\n if (!options.params) {\n console.error('Error: --params required. Provide JSON parameters for the model');\n process.exit(1);\n }\n\n console.log(`Testing model: ${model}`);\n console.log(`Base URL: ${baseUrl}`);\n console.log(`Parameters:`, JSON.stringify(options.params, null, 2));\n console.log('');\n\n const client = new SeacloudClient({ apiKey, baseUrl });\n\n try {\n console.log('Creating task...');\n const task = await client.createTask('/model/v1/generation', {\n model,\n input: [{ params: options.params }],\n });\n\n console.log(`Task created: ${task.id}`);\n console.log(`Initial status: ${task.status}`);\n console.log('');\n\n if (task.status === 'failed') {\n console.error('Task failed immediately:', task.error);\n process.exit(1);\n }\n\n console.log('Polling for results...');\n let attempt = 0;\n const maxAttempts = 120;\n const intervalMs = 3000;\n\n while (attempt < maxAttempts) {\n attempt++;\n\n const result = await client.getTaskStatus('/model/v1/generation', task.id);\n process.stdout.write(`\\rAttempt ${attempt}/${maxAttempts} - Status: ${result.status} `);\n\n if (result.status === 'completed') {\n console.log('\\n\\nTask completed!');\n console.log('\\nResults:');\n console.log(JSON.stringify(result.output, null, 2));\n\n // Extract URLs if available\n if (result.output) {\n const urls: string[] = [];\n for (const item of result.output) {\n if (item.content) {\n for (const resource of item.content) {\n if (resource.url) {\n urls.push(resource.url);\n }\n }\n }\n }\n\n if (urls.length > 0) {\n console.log('\\nGenerated URLs:');\n urls.forEach((url, i) => {\n console.log(` ${i + 1}. ${url}`);\n });\n }\n }\n\n process.exit(0);\n }\n\n if (result.status === 'failed') {\n console.log('\\n\\nTask failed!');\n console.error('Error:', result.error);\n process.exit(1);\n }\n\n await new Promise(resolve => setTimeout(resolve, intervalMs));\n }\n\n console.log('\\n\\nTimeout: Task did not complete within the time limit');\n process.exit(1);\n\n } catch (error: any) {\n console.error('\\nError:', error.message);\n process.exit(1);\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {\n showHelp();\n process.exit(0);\n }\n\n const model = args[0];\n\n // Check if first arg looks like an option instead of a model name\n if (model.startsWith('--')) {\n console.error('Error: model name required');\n console.log('Usage: seacloud <model> --params <json>');\n process.exit(1);\n }\n\n const options = parseArgs(args.slice(1));\n await testModel(model, options);\n}\n\nmain().catch(console.error);\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts","../src/core/config.ts","../src/core/client.ts","../src/core/global-config.ts","../src/api/llm_chat_completions.ts","../src/api/agent_chat_completions.ts","../src/cli.ts"],"names":["__filename"],"mappings":";;;;;AA4EO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CACE,OAAA,EACO,UAAA,EACA,QAAA,EACP;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHN,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAGP,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF,CAAA;;;AC9EO,SAAS,YAAA,CAAa,OAAA,GAA0B,EAAC,EAA6B;AAEnF,EAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,KACP,OAAO,YAAY,WAAA,GAAc,OAAA,CAAQ,GAAA,EAAK,iBA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AAA;AAAA,IAChC;AAAA,EACF,SAAS,KAAA,EAAY;AACnB,IAAA,OAAA,CAAQ,KAAA,CAAM,UAAA,EAAY,KAAA,CAAM,OAAO,CAAA;AACvC,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAEA,IAAA,EAAK,CAAE,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA","file":"cli.js","sourcesContent":["/**\n * SeaCloud SDK 核心类型定义\n */\n\n/**\n * SDK 配置选项\n */\nexport interface SeacloudConfig {\n /** API Service Token - 从环境变量 API_SERVICE_TOKEN 读取或直接传入 */\n apiKey?: string;\n /** 代理服务器基础 URL,默认为 http://localhost:8080 */\n baseUrl?: string;\n /** 自定义 fetch 实现(可选,用于 Node.js < 18 或测试) */\n fetch?: typeof fetch;\n /** 请求超时时间(毫秒),默认 30000 */\n timeout?: number;\n}\n\n/**\n * 任务状态\n */\nexport type TaskStatus = 'pending' | 'processing' | 'in_progress' | 'completed' | 'failed';\n\n/**\n * 任务错误信息\n */\nexport interface TaskError {\n code: string;\n message: string;\n details?: any;\n}\n\n/**\n * 任务结果\n */\nexport interface TaskResult {\n /** 任务 ID */\n id: string;\n /** 创建时间戳 */\n created_at: number;\n /** 任务状态 */\n status: TaskStatus;\n /** 错误信息(如果失败) */\n error?: TaskError | null;\n /** 模型名称 */\n model: string;\n /** 输出结果 */\n output?: Array<{\n content?: Array<{\n type?: string;\n url?: string;\n size?: number;\n jobId?: string;\n [key: string]: any;\n }>;\n [key: string]: any;\n }>;\n /** 其他字段 */\n [key: string]: any;\n}\n\n/**\n * 任务轮询选项\n */\nexport interface PollingOptions {\n /** 轮询间隔(毫秒),默认 3000 */\n intervalMs?: number;\n /** 最大尝试次数,默认 120 */\n maxAttempts?: number;\n /** 进度回调函数 */\n onProgress?: (attempt: number, status: TaskStatus) => void;\n}\n\n/**\n * HTTP 响应错误\n */\nexport class SeacloudError extends Error {\n constructor(\n message: string,\n public statusCode?: number,\n public response?: any,\n ) {\n super(message);\n this.name = 'SeacloudError';\n }\n}\n","import type { SeacloudConfig } from './types.js';\n\n/**\n * 创建 SDK 配置\n * @param options 配置选项\n * @returns 完整的配置对象\n */\nexport function createConfig(options: SeacloudConfig = {}): Required<SeacloudConfig> {\n // 优先级:传入的 apiKey > 环境变量 API_SERVICE_TOKEN\n const apiKey = options.apiKey ||\n (typeof process !== 'undefined' ? process.env?.API_SERVICE_TOKEN : undefined) ||\n '';\n\n // 使用环境变量或传入的 baseUrl\n const baseUrl = options.baseUrl ||\n (typeof process !== 'undefined' ? process.env?.SEACLOUD_BASE_URL : undefined) ||\n 'http://proxy.sg.seaverse.dev';\n\n // 使用全局 fetch 或自定义实现\n const fetchImpl = options.fetch || globalThis.fetch;\n\n if (!fetchImpl) {\n throw new Error('fetch is not available. Please provide a fetch implementation in config or upgrade to Node.js 18+');\n }\n\n return {\n apiKey,\n baseUrl,\n fetch: fetchImpl,\n timeout: options.timeout || 30000,\n };\n}\n\n/**\n * 验证配置\n * @param config 配置对象\n * @throws 如果配置无效\n */\nexport function validateConfig(config: Required<SeacloudConfig>): void {\n if (!config.apiKey) {\n throw new Error(\n 'API key is required. Set API_SERVICE_TOKEN environment variable or pass apiKey in config.'\n );\n }\n\n if (!config.baseUrl) {\n throw new Error('baseUrl is required');\n }\n\n if (typeof config.fetch !== 'function') {\n throw new Error('fetch must be a function');\n }\n}\n","import type { SeacloudConfig, TaskResult } from './types.js';\nimport { SeacloudError } from './types.js';\nimport { createConfig, validateConfig } from './config.js';\n\n/**\n * SeaCloud HTTP 客户端\n * 用于创建任务和查询任务状态\n */\nexport class SeacloudClient {\n private config: Required<SeacloudConfig>;\n\n constructor(config: SeacloudConfig = {}) {\n this.config = createConfig(config);\n validateConfig(this.config);\n }\n\n /**\n * 创建一个新任务\n * @param endpoint API 端点路径(例如:/model/tasks)\n * @param body 请求体\n * @returns 任务结果\n */\n async createTask(endpoint: string, body: Record<string, any>): Promise<TaskResult> {\n const url = `${this.config.baseUrl}${endpoint}`;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await this.config.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${this.config.apiKey}`,\n },\n body: JSON.stringify(body),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n const result = await response.json();\n return result as TaskResult;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${this.config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n }\n\n /**\n * 查询任务状态\n * @param endpoint API 端点路径(例如:/model/v1/generation)\n * @param taskId 任务 ID\n * @returns 任务结果\n */\n async getTaskStatus(endpoint: string, taskId: string): Promise<TaskResult> {\n const url = `${this.config.baseUrl}${endpoint}/task/${taskId}`;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n try {\n const response = await this.config.fetch(url, {\n method: 'GET',\n headers: {\n 'Authorization': `Bearer ${this.config.apiKey}`,\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n const result = await response.json();\n return result as TaskResult;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${this.config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n }\n\n /**\n * 获取当前配置\n */\n getConfig(): Readonly<Required<SeacloudConfig>> {\n return { ...this.config };\n }\n}\n","/**\n * 全局配置管理\n */\n\nimport type { SeacloudClient } from './client.js';\nimport type { PollingOptions } from './types.js';\nimport { SeacloudClient as Client } from './client.js';\n\n// 全局配置状态\ninterface GlobalConfig {\n client: SeacloudClient | null;\n defaultPollingOptions: PollingOptions;\n}\n\nconst globalConfig: GlobalConfig = {\n client: null,\n defaultPollingOptions: {\n intervalMs: 3000, // 3秒轮询间隔\n maxAttempts: 100, // 最多尝试100次 (约5分钟)\n },\n};\n\n/**\n * 初始化 SDK\n * @param apiKey API 密钥\n * @param options 可选配置\n */\nexport function initSeacloud(apiKey: string, options?: {\n baseUrl?: string;\n intervalMs?: number; // 轮询间隔(毫秒)\n maxAttempts?: number; // 最大尝试次数\n timeout?: number;\n}) {\n if (!apiKey) {\n throw new Error('API key is required. Please provide a valid API key.');\n }\n\n // 创建客户端\n globalConfig.client = new Client({\n apiKey,\n baseUrl: options?.baseUrl,\n timeout: options?.timeout,\n });\n\n // 设置默认轮询选项\n if (options?.intervalMs !== undefined) {\n globalConfig.defaultPollingOptions.intervalMs = options.intervalMs;\n }\n if (options?.maxAttempts !== undefined) {\n globalConfig.defaultPollingOptions.maxAttempts = options.maxAttempts;\n }\n\n return globalConfig.client;\n}\n\n/**\n * 获取全局客户端\n * @throws 如果未初始化\n */\nexport function getClient(): SeacloudClient {\n if (!globalConfig.client) {\n throw new Error(\n 'SeaCloud SDK is not initialized. Please call initSeacloud(apiKey) first.'\n );\n }\n return globalConfig.client;\n}\n\n/**\n * 获取默认轮询选项\n */\nexport function getDefaultPollingOptions(): PollingOptions {\n return { ...globalConfig.defaultPollingOptions };\n}\n\n/**\n * 更新默认轮询选项\n */\nexport function setDefaultPollingOptions(options: Partial<PollingOptions>) {\n Object.assign(globalConfig.defaultPollingOptions, options);\n}\n\n/**\n * 重置配置(主要用于测试)\n */\nexport function resetConfig() {\n globalConfig.client = null;\n globalConfig.defaultPollingOptions = {\n intervalMs: 3000,\n maxAttempts: 100,\n };\n}\n","import { getClient } from '../core/global-config.js';\nimport { SeacloudError } from '../core/types.js';\n\n/**\n * Chat message role\n */\nexport type ChatMessageRole = 'system' | 'user' | 'assistant';\n\n/**\n * Chat message interface\n */\nexport interface ChatMessage {\n /**\n * Message role\n */\n role: ChatMessageRole;\n /**\n * Message content\n */\n content: string;\n}\n\n/**\n * LLM chat completions request parameters\n */\nexport interface LlmChatCompletionsParams {\n /**\n * Model name to use for chat completion\n * Supports 100+ models including:\n * - Claude: seaart-mix-sonnet-4-5, shaseng-claude-4.5, seacloud-claude-haiku-4.5, seacloud-claude-sonnet-4, seacloud-claude-opus-4.5\n * - Kimi: kimi-k2, kimi-k2-thinking, kimi-k2-250905\n * - Grok: grok-4, grok-code-fast-1\n * - DeepSeek: deepseek-v3.1, deepseek-v3-0324, deepseek-r1, deepseek-r1-0528\n * - Gemini: gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash, gemini-3-pro-preview, gemini-3-flash-preview\n * - Qwen: qwen-plus, qwen-plus-character, qwen3-coder-plus\n * - GLM: glm-4.5-air, glm-4.5, glm-4.6, glm-4-plus\n * - GPT: gpt-4o, gpt-4o-mini, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-5, gpt-5.1, gpt-5.2\n * - Hunyuan: hunyuan-turbos-latest, hunyuan-large-role-20250822, hunyuan-large-role-plus-20250718\n * - Mistral: mistral-small-3.2-24b-instruct, mistral-small-3.1-24b-instruct, mistral-nemo\n * - Hermes: hermes-4-70b, hermes-4-405b, hermes-3-llama-3.1-405b\n * - Doubao: doubao-romantic, doubao-seed-1-6, doubao-seed-code-preview-251028\n * - Ernie: ernie-5.0-thinking-latest, ernie-5.0-thinking-preview\n * - WizardLM: wizardlm-2-8x22b\n * - O1/O3: o1-pre, o3-pre\n * - LongCat: LongCat-Flash-Chat, LongCat-Flash-Thinking\n * - And many more...\n *\n * @example \"seaart-mix-sonnet-4-5\"\n * @example \"kimi-k2\"\n * @example \"deepseek-v3.1\"\n */\n model: string;\n\n /**\n * Array of messages comprising the conversation so far\n */\n messages: ChatMessage[];\n\n /**\n * Maximum number of tokens to generate in the completion\n * @default undefined (model default)\n */\n max_tokens?: number;\n\n /**\n * Sampling temperature (0-2)\n * Higher values make output more random, lower values more deterministic\n * @default undefined (model default, usually 1.0)\n */\n temperature?: number;\n\n /**\n * Nucleus sampling parameter (0-1)\n * Alternative to temperature sampling\n * @default undefined (model default, usually 1.0)\n */\n top_p?: number;\n\n /**\n * Whether to stream the response\n * If true, returns an async iterator of chunks\n * If false, waits for complete response\n * @default false\n */\n stream?: boolean;\n\n /**\n * Number of completions to generate\n * @default 1\n */\n n?: number;\n\n /**\n * Sequences where the API will stop generating further tokens\n */\n stop?: string | string[];\n\n /**\n * Penalty for new tokens based on whether they appear in the text so far (-2.0 to 2.0)\n * @default 0\n */\n presence_penalty?: number;\n\n /**\n * Penalty for new tokens based on their existing frequency in the text so far (-2.0 to 2.0)\n * @default 0\n */\n frequency_penalty?: number;\n\n /**\n * A unique identifier representing your end-user\n */\n user?: string;\n}\n\n/**\n * Usage statistics for the completion\n */\nexport interface ChatCompletionUsage {\n /**\n * Number of tokens in the prompt\n */\n prompt_tokens: number;\n\n /**\n * Number of tokens in the generated completion\n */\n completion_tokens: number;\n\n /**\n * Total number of tokens used\n */\n total_tokens: number;\n\n /**\n * Cost in USD (if available)\n */\n cost?: number;\n\n /**\n * Additional usage details\n */\n [key: string]: any;\n}\n\n/**\n * A single chat completion choice\n */\nexport interface ChatCompletionChoice {\n /**\n * The index of this choice\n */\n index: number;\n\n /**\n * The message generated by the model\n */\n message: ChatMessage;\n\n /**\n * The reason the model stopped generating tokens\n * @values stop | length | content_filter | function_call\n */\n finish_reason: string | null;\n\n /**\n * Additional choice-specific fields\n */\n [key: string]: any;\n}\n\n/**\n * Chat completion response (non-streaming)\n */\nexport interface ChatCompletionResponse {\n /**\n * Unique identifier for the completion\n */\n id: string;\n\n /**\n * The object type, always \"chat.completion\"\n */\n object: string;\n\n /**\n * Unix timestamp of when the completion was created\n */\n created: number;\n\n /**\n * The model used for completion\n */\n model: string;\n\n /**\n * List of completion choices\n */\n choices: ChatCompletionChoice[];\n\n /**\n * Usage statistics for the completion\n */\n usage?: ChatCompletionUsage;\n\n /**\n * Additional response fields\n */\n [key: string]: any;\n}\n\n/**\n * Delta message for streaming chunks\n */\nexport interface ChatCompletionChunkDelta {\n /**\n * The role of the message (only in first chunk)\n */\n role?: ChatMessageRole;\n\n /**\n * The content delta for this chunk\n */\n content?: string;\n}\n\n/**\n * A single streaming chunk choice\n */\nexport interface ChatCompletionChunkChoice {\n /**\n * The index of this choice\n */\n index: number;\n\n /**\n * The delta message for this chunk\n */\n delta: ChatCompletionChunkDelta;\n\n /**\n * The reason the model stopped generating tokens (only in last chunk)\n */\n finish_reason: string | null;\n\n /**\n * Additional choice-specific fields\n */\n [key: string]: any;\n}\n\n/**\n * Chat completion streaming chunk\n */\nexport interface ChatCompletionChunk {\n /**\n * Unique identifier for the completion\n */\n id: string;\n\n /**\n * The object type, always \"chat.completion.chunk\"\n */\n object: string;\n\n /**\n * Unix timestamp of when the chunk was created\n */\n created: number;\n\n /**\n * The model used for completion\n */\n model: string;\n\n /**\n * List of chunk choices\n */\n choices: ChatCompletionChunkChoice[];\n\n /**\n * Additional chunk fields\n */\n [key: string]: any;\n}\n\n/**\n * Call LLM chat completions API (non-streaming)\n *\n * @example\n * ```typescript\n * import { initSeacloud, llmChatCompletions } from 'seacloud-sdk';\n *\n * initSeacloud({ apiKey: 'your-api-key' });\n *\n * const response = await llmChatCompletions({\n * model: 'seaart-mix-sonnet-4-5',\n * messages: [\n * { role: 'user', content: 'Hello!' }\n * ],\n * max_tokens: 100\n * });\n *\n * console.log(response.choices[0].message.content);\n * ```\n *\n * @param params Request parameters\n * @returns Chat completion response\n */\nexport async function llmChatCompletions(\n params: LlmChatCompletionsParams & { stream?: false }\n): Promise<ChatCompletionResponse>;\n\n/**\n * Call LLM chat completions API (streaming)\n *\n * @example\n * ```typescript\n * import { initSeacloud, llmChatCompletions } from 'seacloud-sdk';\n *\n * initSeacloud({ apiKey: 'your-api-key' });\n *\n * const stream = await llmChatCompletions({\n * model: 'seaart-mix-sonnet-4-5',\n * messages: [\n * { role: 'user', content: 'Tell me a story' }\n * ],\n * stream: true\n * });\n *\n * for await (const chunk of stream) {\n * const content = chunk.choices[0]?.delta?.content;\n * if (content) {\n * process.stdout.write(content);\n * }\n * }\n * ```\n *\n * @param params Request parameters with stream: true\n * @returns Async iterator of chat completion chunks\n */\nexport async function llmChatCompletions(\n params: LlmChatCompletionsParams & { stream: true }\n): Promise<AsyncIterable<ChatCompletionChunk>>;\n\n// Implementation\nexport async function llmChatCompletions(\n params: LlmChatCompletionsParams\n): Promise<ChatCompletionResponse | AsyncIterable<ChatCompletionChunk>> {\n const client = getClient();\n const config = client.getConfig();\n\n const url = `${config.baseUrl}/llm/chat/completions`;\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), config.timeout);\n\n try {\n const response = await config.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${config.apiKey}`,\n },\n body: JSON.stringify(params),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n // Streaming response\n if (params.stream) {\n return parseStreamingResponse(response);\n }\n\n // Non-streaming response\n const result = await response.json();\n return result as ChatCompletionResponse;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n}\n\n/**\n * Parse streaming response into async iterable\n */\nasync function* parseStreamingResponse(\n response: Response\n): AsyncIterable<ChatCompletionChunk> {\n const reader = response.body?.getReader();\n if (!reader) {\n throw new SeacloudError('Response body is not readable');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n\n // Keep the last incomplete line in buffer\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n if (!trimmedLine) continue;\n if (trimmedLine === 'data: [DONE]') continue;\n\n if (trimmedLine.startsWith('data: ')) {\n const jsonStr = trimmedLine.slice(6);\n try {\n const chunk = JSON.parse(jsonStr) as ChatCompletionChunk;\n yield chunk;\n } catch (error) {\n console.warn('Failed to parse SSE chunk:', jsonStr);\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n}\n","/**\n * ============================================================================\n * SeaCloud Fast Agent Chat Completions API\n * ============================================================================\n *\n * This module provides a comprehensive API for interacting with SeaCloud's\n * Fast Agent system, which supports:\n *\n * - Multi-turn conversations with session management\n * - Tool calling for artifact generation (images, videos, music, etc.)\n * - Streaming and non-streaming response modes\n * - Multiple content types (text, image, video, audio, file)\n * - Flexible model selection (Claude, GPT, Gemini, etc.)\n *\n * IMPORTANT NOTES:\n * ================\n *\n * 1. REQUIRED PARAMETERS:\n * - agent_id: Caller-provided agent identifier\n * - messages: Array of conversation messages\n *\n * 2. TIMEOUT CONFIGURATION:\n * - Default timeout: 30 seconds (may be too short for tool calls)\n * - Recommended for agent operations: 120 seconds or more\n * - Set via initSeacloud({ timeout: 120000 })\n *\n * 3. STREAMING MODE:\n * - API always returns Server-Sent Events (SSE) format\n * - params.stream controls how SDK consumes the response\n * - For tool calls (image/video generation), streaming is RECOMMENDED\n *\n * 4. AUTHENTICATION:\n * - Requires 'X-Project: SeaArt' header (automatically added)\n * - Uses Bearer token authentication\n *\n * 5. SESSION MANAGEMENT:\n * - Use session_id to maintain multi-turn conversations\n * - Increment seq for each message in the session\n *\n * @see AGENT_API.md for detailed documentation and examples\n */\n\nimport { getClient } from '../core/global-config.js';\nimport { SeacloudError } from '../core/types.js';\n\n/**\n * Message content type\n */\nexport type AgentMessageContentType = 'text' | 'image' | 'video' | 'audio' | 'file';\n\n/**\n * Base message content\n */\ninterface BaseMessageContent {\n type: AgentMessageContentType;\n}\n\n/**\n * Text message content\n */\ninterface TextMessageContent extends BaseMessageContent {\n type: 'text';\n text: string;\n}\n\n/**\n * Image message content\n */\ninterface ImageMessageContent extends BaseMessageContent {\n type: 'image';\n image_url: string;\n}\n\n/**\n * Video message content\n */\ninterface VideoMessageContent extends BaseMessageContent {\n type: 'video';\n video_url: string;\n}\n\n/**\n * Audio message content\n */\ninterface AudioMessageContent extends BaseMessageContent {\n type: 'audio';\n audio_url: string;\n}\n\n/**\n * File message content\n */\ninterface FileMessageContent extends BaseMessageContent {\n type: 'file';\n file_url: string;\n}\n\n/**\n * Message content item (union type for type safety)\n */\nexport type AgentMessageContent =\n | TextMessageContent\n | ImageMessageContent\n | VideoMessageContent\n | AudioMessageContent\n | FileMessageContent;\n\n/**\n * Message role type\n */\nexport type AgentMessageRole = 'developer' | 'user' | 'assistant' | 'tool';\n\n/**\n * Chat message\n */\nexport interface AgentMessage {\n /**\n * Message role\n * - developer: System instructions/prompts (equivalent to \"system\" role)\n * - user: User input messages\n * - assistant: AI assistant responses (for multi-turn conversations)\n * - tool: Tool execution results\n */\n role: AgentMessageRole;\n\n /**\n * Message content array\n */\n content: AgentMessageContent[];\n\n /**\n * Tool call ID (for role: 'tool')\n */\n tool_call_id?: string;\n\n /**\n * Tool name (for role: 'tool')\n */\n name?: string;\n}\n\n/**\n * Tool function definition\n */\nexport interface AgentToolFunction {\n /**\n * Tool name\n * Available tools:\n *\n * Image Generation:\n * - seagen_text2image_flux1d_artifact_tool\n * - seagen_text2image_seedream40_artifact_tool\n * - seagen_text2image_google_gemini3_pro_image_artifact_tool\n * - seagen_blackforestlabs_flux_2_pro_tool\n * - mm_volces_seedream_4_5_gateway_tool\n *\n * Image Editing:\n * - seagen_edit_image_google_artifact_tool\n * - seagen_blackforestlabs_flux_2_pro_edit_tool\n *\n * Video Generation:\n * - seagen_image2video_wanx26_artifact_tool\n * - seagen_text2video_wanx26_artifact_tool\n * - seagen_image2video_seedance_pro_fast_artifact_tool\n * - mm_text2video_kling_v2_6_gateway_tool\n * - mm_image2video_kling_v2_6_i2v_gateway_tool\n *\n * Music & Audio:\n * - seagen_text2song_mureka_artifact_tool\n * - seagen_text2lyrics_mureka_artifact_tool\n */\n name: string;\n\n /**\n * Tool description (optional)\n */\n description?: string;\n\n /**\n * Tool parameters schema (optional)\n */\n parameters?: Record<string, any>;\n}\n\n/**\n * Tool definition\n */\nexport interface AgentTool {\n /**\n * Tool type (always 'function')\n */\n type: 'function';\n\n /**\n * Function definition\n */\n function: AgentToolFunction;\n}\n\n/**\n * Agent chat completions request parameters\n */\nexport interface AgentChatCompletionsParams {\n /**\n * Agent ID to invoke\n * @example \"seaverse_agent\"\n * @example \"seagen_agent\"\n */\n agent_id: string;\n\n /**\n * Array of messages comprising the conversation\n */\n messages: AgentMessage[];\n\n /**\n * AI model to use for processing\n * @default \"custom_openai/vertex-ai-claude-sonnet-4.5\"\n * @example \"gpt-4o\"\n * @example \"custom_openai/vertex-ai-claude-sonnet-4.5\"\n */\n model?: string;\n\n /**\n * Sampling temperature for creativity control (0.0 to 1.0)\n * - 0.0: Focused and deterministic responses\n * - 1.0: Maximum creativity and randomness\n * @default 0.7\n */\n temperature?: number;\n\n /**\n * Session ID for multi-turn conversations\n * Used to maintain conversation context across multiple requests\n * Server returns this in the response; use it in subsequent calls\n */\n session_id?: string;\n\n /**\n * User identifier for tracking and analytics\n * Optional field for associating requests with specific users\n */\n user_id?: string;\n\n /**\n * Message ID for SSE reconnection (ADVANCED USE)\n * Only use this when resuming an interrupted streaming response\n * Server returns msg_id in response; use it to resume from disconnect point\n *\n * WARNING: Do NOT use for multi-turn conversations\n * For multi-turn, just include full message history + session_id\n *\n * @example\n * // DON'T do this for multi-turn:\n * // { msg_id: previousResponse.msg_id, seq: 1 }\n *\n * // DO this instead:\n * // { session_id: previousResponse.session_id, messages: [...allMessages] }\n */\n msg_id?: string;\n\n /**\n * Sequence number for message resumption (ADVANCED USE)\n * Only used with msg_id for resuming interrupted streams\n * For regular multi-turn conversations, omit this parameter\n *\n * @default 0\n */\n seq?: number;\n\n /**\n * Business-specific parameters\n * Key-value pairs passed through to backend systems\n * Common use cases:\n * - aspect_ratio: Video/image aspect ratio (e.g., \"16:9\", \"1:1\")\n * - duration: Video duration in seconds\n * - resolution: Output resolution (e.g., \"1080p\", \"4k\")\n */\n metadata?: Record<string, any>;\n\n /**\n * List of tools available to the agent\n * Agent automatically selects appropriate tool based on user request\n */\n tools?: AgentTool[];\n\n /**\n * Enable Server-Sent Events streaming\n * @default true\n */\n stream?: boolean;\n\n /**\n * Maximum number of tokens to generate\n */\n max_tokens?: number;\n\n /**\n * Number of completions to generate\n * @default 1\n */\n n?: number;\n\n /**\n * Sequences where the API will stop generating\n */\n stop?: string | string[];\n\n /**\n * Penalty for new tokens based on presence (-2.0 to 2.0)\n * @default 0\n */\n presence_penalty?: number;\n\n /**\n * Penalty for new tokens based on frequency (-2.0 to 2.0)\n * @default 0\n */\n frequency_penalty?: number;\n\n /**\n * Top-p nucleus sampling (0-1)\n */\n top_p?: number;\n}\n\n/**\n * Artifact (generated file)\n */\nexport interface AgentArtifact {\n /**\n * File name\n * @example \"image.webp\"\n */\n name: string;\n\n /**\n * CDN URL to access the file\n */\n url: string;\n\n /**\n * Content type\n * @example \"image\" | \"video\" | \"audio\"\n */\n type: string;\n\n /**\n * MIME type\n * @example \"image/webp\" | \"video/mp4\" | \"audio/mp3\"\n */\n mime_type?: string;\n\n /**\n * File size in bytes\n */\n size?: number;\n\n /**\n * Duration in seconds (for video/audio)\n */\n duration?: number;\n\n /**\n * Width in pixels (for image/video)\n */\n width?: number;\n\n /**\n * Height in pixels (for image/video)\n */\n height?: number;\n\n /**\n * Additional metadata\n */\n [key: string]: any;\n}\n\n/**\n * Tool call information\n */\nexport interface AgentToolCall {\n /**\n * Tool call ID\n */\n id: string;\n\n /**\n * Tool type\n */\n type: 'function';\n\n /**\n * Function call details\n */\n function: {\n /**\n * Function name\n */\n name: string;\n\n /**\n * Function arguments (JSON string)\n */\n arguments: string;\n };\n\n /**\n * Tool call index\n */\n index?: number;\n}\n\n/**\n * Delta content for streaming chunks\n */\nexport interface AgentChatCompletionDelta {\n /**\n * Message role (only in first chunk)\n */\n role?: AgentMessageRole;\n\n /**\n * Content delta (string or array)\n */\n content?: string | AgentMessageContent[];\n\n /**\n * Artifacts (generated files)\n */\n artifacts?: AgentArtifact[];\n\n /**\n * Tool calls\n */\n tool_calls?: AgentToolCall[];\n\n /**\n * Refusal message\n */\n refusal?: string | null;\n\n /**\n * Function call (deprecated, use tool_calls)\n */\n function_call?: any;\n\n /**\n * Audio content\n */\n audio?: any;\n\n /**\n * Additional provider-specific fields\n */\n provider_specific_fields?: any;\n}\n\n/**\n * Content filter result\n */\nexport interface AgentContentFilterResult {\n /**\n * Error information\n */\n error?: {\n /**\n * Error code\n */\n code: string;\n\n /**\n * Error message\n */\n message: string;\n };\n\n /**\n * Additional filter results\n */\n [key: string]: any;\n}\n\n/**\n * Chat completion choice (streaming)\n */\nexport interface AgentChatCompletionChunkChoice {\n /**\n * Choice index\n */\n index: number;\n\n /**\n * Delta message for this chunk\n */\n delta: AgentChatCompletionDelta;\n\n /**\n * Finish reason (only in last chunk)\n * - \"stop\": Natural completion\n * - \"length\": Maximum token limit reached\n * - \"tool_calls\": Tool execution triggered\n * - \"content_filter\": Content filtered\n */\n finish_reason: string | null;\n\n /**\n * Log probabilities\n */\n logprobs?: any;\n\n /**\n * Content filter results\n */\n content_filter_results?: AgentContentFilterResult;\n\n /**\n * Content filter result (singular)\n */\n content_filter_result?: AgentContentFilterResult;\n}\n\n/**\n * Usage statistics\n */\nexport interface AgentUsage {\n /**\n * Prompt tokens\n */\n prompt_tokens: number;\n\n /**\n * Completion tokens\n */\n completion_tokens: number;\n\n /**\n * Total tokens\n */\n total_tokens: number;\n\n /**\n * Completion tokens details\n */\n completion_tokens_details?: {\n /**\n * Accepted prediction tokens\n */\n accepted_prediction_tokens?: number;\n\n /**\n * Audio tokens\n */\n audio_tokens?: number;\n\n /**\n * Reasoning tokens\n */\n reasoning_tokens?: number;\n\n /**\n * Rejected prediction tokens\n */\n rejected_prediction_tokens?: number;\n };\n\n /**\n * Prompt tokens details\n */\n prompt_tokens_details?: {\n /**\n * Audio tokens\n */\n audio_tokens?: number;\n\n /**\n * Cached tokens\n */\n cached_tokens?: number;\n\n /**\n * Text tokens\n */\n text_tokens?: number | null;\n\n /**\n * Image tokens\n */\n image_tokens?: number | null;\n };\n\n /**\n * Cost in USD\n */\n cost?: number;\n}\n\n/**\n * Chat completion streaming chunk\n */\nexport interface AgentChatCompletionChunk {\n /**\n * Unique identifier for the completion\n */\n id: string;\n\n /**\n * Object type (always \"chat.completion.chunk\")\n */\n object: string;\n\n /**\n * Unix timestamp\n */\n created: number;\n\n /**\n * Model used\n */\n model: string;\n\n /**\n * System fingerprint\n */\n system_fingerprint?: string;\n\n /**\n * List of choices\n */\n choices: AgentChatCompletionChunkChoice[];\n\n /**\n * Usage statistics (usually in last chunk)\n */\n usage?: AgentUsage;\n\n /**\n * Session ID for conversation continuation\n */\n session_id?: string;\n\n /**\n * Message ID\n */\n msg_id?: string;\n\n /**\n * Provider-specific fields\n */\n provider_specific_fields?: any;\n\n /**\n * Citations\n */\n citations?: any;\n\n /**\n * Service tier\n */\n service_tier?: string | null;\n\n /**\n * Obfuscation\n */\n obfuscation?: string;\n}\n\n/**\n * Message in non-streaming response\n */\nexport interface AgentResponseMessage {\n /**\n * Message role\n */\n role: AgentMessageRole;\n\n /**\n * Message content\n */\n content: string;\n\n /**\n * Tool calls\n */\n tool_calls?: AgentToolCall[];\n\n /**\n * Refusal message\n */\n refusal?: string | null;\n\n /**\n * Function call (deprecated)\n */\n function_call?: any;\n\n /**\n * Audio content\n */\n audio?: any;\n}\n\n/**\n * Chat completion choice (non-streaming)\n */\nexport interface AgentChatCompletionChoice {\n /**\n * Choice index\n */\n index: number;\n\n /**\n * Message\n */\n message: AgentResponseMessage;\n\n /**\n * Finish reason\n */\n finish_reason: string | null;\n\n /**\n * Log probabilities\n */\n logprobs?: any;\n\n /**\n * Content filter results\n */\n content_filter_results?: AgentContentFilterResult;\n}\n\n/**\n * Chat completion response (non-streaming)\n */\nexport interface AgentChatCompletionResponse {\n /**\n * Unique identifier\n */\n id: string;\n\n /**\n * Object type (always \"chat.completion\")\n */\n object: string;\n\n /**\n * Unix timestamp\n */\n created: number;\n\n /**\n * Model used\n */\n model: string;\n\n /**\n * System fingerprint\n */\n system_fingerprint?: string;\n\n /**\n * List of choices\n */\n choices: AgentChatCompletionChoice[];\n\n /**\n * Usage statistics\n */\n usage?: AgentUsage;\n\n /**\n * Session ID\n */\n session_id?: string;\n\n /**\n * Message ID\n */\n msg_id?: string;\n\n /**\n * Provider-specific fields\n */\n provider_specific_fields?: any;\n\n /**\n * Service tier\n */\n service_tier?: string | null;\n\n /**\n * Generated artifacts\n */\n artifacts?: AgentArtifact[];\n}\n\n/**\n * Call SeaCloud Fast Agent API (non-streaming)\n *\n * @example\n * ```typescript\n * import { initSeacloud, agentChatCompletions } from 'seacloud-sdk';\n *\n * initSeacloud({\n * apiKey: 'your-api-key',\n * baseUrl: 'http://proxy.sg.seaverse.dev',\n * });\n *\n * // Simple chat\n * const response = await agentChatCompletions({\n * agent_id: 'seaverse_agent',\n * messages: [\n * {\n * role: 'user',\n * content: [{ type: 'text', text: 'Hello!' }]\n * }\n * ],\n * model: 'gpt-4o',\n * });\n *\n * console.log(response.choices[0].message.content);\n * ```\n *\n * @example\n * ```typescript\n * // Generate an image\n * const response = await agentChatCompletions({\n * agent_id: 'seaverse_agent',\n * messages: [\n * {\n * role: 'user',\n * content: [{ type: 'text', text: 'Generate a cute puppy photo' }]\n * }\n * ],\n * model: 'gpt-4o',\n * tools: [\n * {\n * type: 'function',\n * function: { name: 'seagen_text2image_flux1d_artifact_tool' }\n * }\n * ]\n * });\n *\n * // Access generated image\n * const imageUrl = response.artifacts?.[0]?.url;\n * ```\n *\n * @param params Request parameters\n * @returns Chat completion response\n */\nexport async function agentChatCompletions(\n params: AgentChatCompletionsParams & { stream?: false }\n): Promise<AgentChatCompletionResponse>;\n\n/**\n * Call SeaCloud Fast Agent API (streaming)\n *\n * @example\n * ```typescript\n * import { initSeacloud, agentChatCompletions } from 'seacloud-sdk';\n *\n * initSeacloud({\n * apiKey: 'your-api-key',\n * baseUrl: 'http://proxy.sg.seaverse.dev',\n * });\n *\n * const stream = await agentChatCompletions({\n * agent_id: 'seaverse_agent',\n * messages: [\n * {\n * role: 'user',\n * content: [{ type: 'text', text: 'Tell me a story' }]\n * }\n * ],\n * model: 'gpt-4o',\n * stream: true,\n * });\n *\n * for await (const chunk of stream) {\n * const content = chunk.choices[0]?.delta?.content;\n * if (typeof content === 'string') {\n * process.stdout.write(content);\n * }\n *\n * // Handle artifacts\n * const artifacts = chunk.choices[0]?.delta?.artifacts;\n * if (artifacts) {\n * console.log('Generated artifacts:', artifacts);\n * }\n * }\n * ```\n *\n * @param params Request parameters with stream: true\n * @returns Async iterator of chat completion chunks\n */\nexport async function agentChatCompletions(\n params: AgentChatCompletionsParams & { stream: true }\n): Promise<AsyncIterable<AgentChatCompletionChunk>>;\n\n// Implementation\nexport async function agentChatCompletions(\n params: AgentChatCompletionsParams\n): Promise<AgentChatCompletionResponse | AsyncIterable<AgentChatCompletionChunk>> {\n const client = getClient();\n const config = client.getConfig();\n\n const url = `${config.baseUrl}/agent/api/v1/chat/completions`;\n\n // ============================================================================\n // PARAMETER PROCESSING LOGIC\n // ============================================================================\n\n /**\n * Default Model:\n * - If not specified, uses 'custom_openai/vertex-ai-claude-sonnet-4.5'\n * - This is Claude Sonnet 4.5, optimized for agent operations\n * - You can override with any supported model (gpt-4o, claude-4, etc.)\n */\n const model = params.model || 'custom_openai/vertex-ai-claude-sonnet-4.5';\n\n /**\n * Stream Mode:\n * - Agent API ALWAYS returns Server-Sent Events (SSE) format\n * - Even if params.stream=false, API returns SSE chunks\n * - We force stream: true in API request for consistency\n * - For non-streaming (params.stream=false), we collect all chunks internally\n */\n const userWantsStreaming = params.stream !== false; // Default to true\n const requestBody = {\n ...params,\n model,\n stream: true, // Always request SSE from API\n };\n\n // ============================================================================\n // TIMEOUT & REQUEST HANDLING\n // ============================================================================\n\n /**\n * Timeout Configuration:\n * - Default: 30 seconds (set in config)\n * - For agent operations (especially with tool calls like image generation):\n * Recommend setting timeout to 120000ms (2 minutes) or more\n * - Initialize SDK with custom timeout:\n * initSeacloud({ apiKey: '...', timeout: 120000 })\n */\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), config.timeout);\n\n try {\n /**\n * Request Headers:\n * - Content-Type: application/json (standard)\n * - Authorization: Bearer token for authentication\n * - X-Project: SeaArt (REQUIRED for agent API access)\n */\n const response = await config.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${config.apiKey}`,\n 'X-Project': 'SeaArt', // Required header for agent API\n },\n body: JSON.stringify(requestBody),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n throw new SeacloudError(\n `HTTP ${response.status}: ${errorBody}`,\n response.status,\n errorBody,\n );\n }\n\n // ============================================================================\n // RESPONSE HANDLING\n // ============================================================================\n\n /**\n * Response Routing:\n * - If user wants streaming (params.stream !== false):\n * Return async iterator that yields chunks as they arrive\n *\n * - If user wants non-streaming (params.stream === false):\n * Internally collect all SSE chunks and return complete response\n *\n * Note: Both paths read SSE format from API, just different consumption patterns\n */\n if (userWantsStreaming) {\n return parseAgentStreamingResponse(response);\n }\n\n // Non-streaming: Collect all chunks and return complete response\n return await parseAgentNonStreamingResponse(response);\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof SeacloudError) {\n throw error;\n }\n\n if ((error as Error).name === 'AbortError') {\n throw new SeacloudError(`Request timeout after ${config.timeout}ms`);\n }\n\n throw new SeacloudError(\n `Request failed: ${(error as Error).message}`,\n undefined,\n error,\n );\n }\n}\n\n/**\n * Parse non-streaming response (API returns SSE even with stream: false)\n */\nasync function parseAgentNonStreamingResponse(\n response: Response\n): Promise<AgentChatCompletionResponse> {\n const reader = response.body?.getReader();\n if (!reader) {\n throw new SeacloudError('Response body is not readable');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n let fullContent = '';\n let artifacts: AgentArtifact[] = [];\n let finishReason = '';\n let sessionId = '';\n let msgId = '';\n let lastChunk: AgentChatCompletionChunk | null = null;\n let usage: AgentUsage | undefined;\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n\n // Keep the last incomplete line in buffer\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n if (!trimmedLine) continue;\n if (trimmedLine === 'data: [DONE]') continue;\n if (trimmedLine === 'event: heartbeat') continue;\n\n if (trimmedLine.startsWith('data: ')) {\n const data = trimmedLine.slice(6).trim();\n\n try {\n const parsed = JSON.parse(data) as AgentChatCompletionChunk;\n lastChunk = parsed;\n\n const delta = parsed.choices?.[0]?.delta;\n\n if (delta?.content) {\n if (typeof delta.content === 'string') {\n fullContent += delta.content;\n } else if (Array.isArray(delta.content)) {\n for (const item of delta.content) {\n if (item.type === 'text' && item.text) {\n fullContent += item.text;\n }\n }\n }\n }\n\n if (delta?.artifacts) {\n artifacts.push(...delta.artifacts);\n }\n\n if (parsed.choices?.[0]?.finish_reason) {\n finishReason = parsed.choices[0].finish_reason;\n }\n\n if (parsed.session_id) {\n sessionId = parsed.session_id;\n }\n\n if (parsed.msg_id) {\n msgId = parsed.msg_id;\n }\n\n if (parsed.usage) {\n usage = parsed.usage;\n }\n } catch (e) {\n // Skip invalid JSON\n console.warn('Failed to parse SSE chunk:', data.substring(0, 100));\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n\n if (!lastChunk) {\n throw new SeacloudError('No valid response chunks received');\n }\n\n return {\n id: lastChunk.id,\n object: 'chat.completion',\n created: lastChunk.created,\n model: lastChunk.model,\n system_fingerprint: lastChunk.system_fingerprint,\n choices: [\n {\n index: 0,\n message: {\n role: 'assistant',\n content: fullContent,\n },\n finish_reason: finishReason || null,\n },\n ],\n usage,\n session_id: sessionId || undefined,\n msg_id: msgId || undefined,\n artifacts: artifacts.length > 0 ? artifacts : undefined,\n };\n}\n\n/**\n * Parse streaming response into async iterable\n */\nasync function* parseAgentStreamingResponse(\n response: Response\n): AsyncIterable<AgentChatCompletionChunk> {\n const reader = response.body?.getReader();\n if (!reader) {\n throw new SeacloudError('Response body is not readable');\n }\n\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n break;\n }\n\n buffer += decoder.decode(value, { stream: true });\n const lines = buffer.split('\\n');\n\n // Keep the last incomplete line in buffer\n buffer = lines.pop() || '';\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n // Skip empty lines and comments\n if (!trimmedLine || trimmedLine.startsWith(':')) continue;\n\n // Handle event type declarations (e.g., \"event: heartbeat\")\n if (trimmedLine.startsWith('event: ')) {\n const eventType = trimmedLine.slice(7).trim();\n if (eventType === 'heartbeat') {\n // Heartbeat events can be logged but don't yield\n continue;\n }\n }\n\n // Handle data events\n if (trimmedLine.startsWith('data: ')) {\n const data = trimmedLine.slice(6).trim();\n\n // Check for stream completion signal\n if (data === '[DONE]') {\n break;\n }\n\n try {\n const chunk = JSON.parse(data) as AgentChatCompletionChunk;\n yield chunk;\n } catch (error) {\n console.warn('Failed to parse SSE chunk:', data);\n }\n }\n }\n }\n } finally {\n reader.releaseLock();\n }\n}\n\n/**\n * Helper function to create a text message\n *\n * @param role - Message role ('user' | 'assistant' | 'developer' | 'tool')\n * @param text - Text content\n * @returns Agent message with text content\n *\n * @example\n * ```typescript\n * const message = createTextMessage('user', 'Hello!');\n * ```\n */\nexport function createTextMessage(role: AgentMessageRole, text: string): AgentMessage {\n return {\n role,\n content: [{ type: 'text', text }],\n };\n}\n\n/**\n * Helper function to create a message with image\n *\n * @param role - Message role ('user' | 'assistant' | 'developer' | 'tool')\n * @param text - Text content\n * @param imageUrl - Image URL\n * @returns Agent message with text and image content\n *\n * @example\n * ```typescript\n * const message = createImageMessage('user', 'What is this?', 'https://example.com/image.jpg');\n * ```\n */\nexport function createImageMessage(role: AgentMessageRole, text: string, imageUrl: string): AgentMessage {\n return {\n role,\n content: [\n { type: 'text', text },\n { type: 'image', image_url: imageUrl },\n ],\n };\n}\n\n/**\n * Helper function to create a message with video\n *\n * @param role - Message role\n * @param text - Text content\n * @param videoUrl - Video URL\n * @returns Agent message with text and video content\n */\nexport function createVideoMessage(role: AgentMessageRole, text: string, videoUrl: string): AgentMessage {\n return {\n role,\n content: [\n { type: 'text', text },\n { type: 'video', video_url: videoUrl },\n ],\n };\n}\n\n/**\n * Helper function to create a message with audio\n *\n * @param role - Message role\n * @param text - Text content\n * @param audioUrl - Audio URL\n * @returns Agent message with text and audio content\n */\nexport function createAudioMessage(role: AgentMessageRole, text: string, audioUrl: string): AgentMessage {\n return {\n role,\n content: [\n { type: 'text', text },\n { type: 'audio', audio_url: audioUrl },\n ],\n };\n}\n\n/**\n * Helper function to create a tool\n */\nexport function createTool(toolName: string): AgentTool {\n return {\n type: 'function',\n function: {\n name: toolName,\n },\n };\n}\n","#!/usr/bin/env node\n\nimport { SeacloudClient } from './core/index.js';\nimport { initSeacloud } from './core/global-config.js';\nimport { llmChatCompletions } from './api/llm_chat_completions.js';\nimport { agentChatCompletions, createTextMessage } from './api/agent_chat_completions.js';\nimport { readFileSync } from 'fs';\nimport { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\ninterface CliOptions {\n apiKey?: string;\n baseUrl?: string;\n model?: string;\n params?: Record<string, any>;\n}\n\nfunction showHelp() {\n console.log(`\nSeaCloud CLI - Test AI models, LLM, and Agent from command line\n\nUsage:\n seacloud <command> [options]\n\nCommands:\n llm <prompt> Chat with LLM models\n agent <prompt> Chat with Fast Agent (supports image/video generation)\n <model> Test specific model generation\n\nLLM Options:\n --model <name> Model name (default: seaart-mix-sonnet-4-5)\n --stream Enable streaming mode\n --temperature <n> Temperature 0-2 (default: 0.7)\n --max-tokens <n> Max tokens to generate\n\nAgent Options:\n --agent-id <id> Agent ID (default: seagen_agent)\n --model <name> Model name (default: gpt-4o)\n --stream Enable streaming mode\n --session-id <id> Session ID for multi-turn conversation\n\nModel Generation Options:\n --api-key <key> API key (or set API_SERVICE_TOKEN env var)\n --base-url <url> Base URL (default: http://proxy.sg.seaverse.dev)\n --params <json> JSON parameters for the model\n\nExamples:\n # Chat with LLM (non-streaming)\n seacloud llm \"What is the capital of France?\"\n\n # Chat with LLM (streaming)\n seacloud llm \"Tell me a story\" --stream\n\n # Chat with LLM using specific model\n seacloud llm \"Hello\" --model deepseek-v3.1 --temperature 1.0\n\n # Chat with Agent (can generate images)\n seacloud agent \"Generate an image of a sunset\"\n\n # Chat with Agent (streaming)\n seacloud agent \"Create a cat image\" --stream\n\n # Test model generation\n seacloud flux_1_1_pro --params '{\"prompt\":\"a beautiful sunset\"}'\n\n # Use custom API key\n seacloud llm \"Hello\" --api-key sa-xxx\n\nEnvironment Variables:\n API_SERVICE_TOKEN API authentication token (required)\n SEACLOUD_BASE_URL Base URL for API endpoints\n`);\n}\n\nfunction parseArgs(args: string[]): CliOptions {\n const options: CliOptions = {};\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n\n switch (arg) {\n case '--api-key':\n options.apiKey = args[++i];\n break;\n case '--base-url':\n options.baseUrl = args[++i];\n break;\n case '--model':\n options.model = args[++i];\n break;\n case '--params':\n try {\n options.params = JSON.parse(args[++i]);\n } catch (e) {\n console.error('Error: Invalid JSON for --params');\n process.exit(1);\n }\n break;\n }\n }\n\n return options;\n}\n\nasync function testModel(model: string, options: CliOptions) {\n const apiKey = options.apiKey || process.env.API_SERVICE_TOKEN;\n const baseUrl = options.baseUrl || process.env.API_BASE_URL || 'http://localhost:8080';\n\n if (!apiKey) {\n console.error('Error: API key not provided. Use --api-key or set API_SERVICE_TOKEN env var');\n process.exit(1);\n }\n\n if (!options.params) {\n console.error('Error: --params required. Provide JSON parameters for the model');\n process.exit(1);\n }\n\n console.log(`Testing model: ${model}`);\n console.log(`Base URL: ${baseUrl}`);\n console.log(`Parameters:`, JSON.stringify(options.params, null, 2));\n console.log('');\n\n const client = new SeacloudClient({ apiKey, baseUrl });\n\n try {\n console.log('Creating task...');\n const task = await client.createTask('/model/v1/generation', {\n model,\n input: [{ params: options.params }],\n });\n\n console.log(`Task created: ${task.id}`);\n console.log(`Initial status: ${task.status}`);\n console.log('');\n\n if (task.status === 'failed') {\n console.error('Task failed immediately:', task.error);\n process.exit(1);\n }\n\n console.log('Polling for results...');\n let attempt = 0;\n const maxAttempts = 120;\n const intervalMs = 3000;\n\n while (attempt < maxAttempts) {\n attempt++;\n\n const result = await client.getTaskStatus('/model/v1/generation', task.id);\n process.stdout.write(`\\rAttempt ${attempt}/${maxAttempts} - Status: ${result.status} `);\n\n if (result.status === 'completed') {\n console.log('\\n\\nTask completed!');\n console.log('\\nResults:');\n console.log(JSON.stringify(result.output, null, 2));\n\n // Extract URLs if available\n if (result.output) {\n const urls: string[] = [];\n for (const item of result.output) {\n if (item.content) {\n for (const resource of item.content) {\n if (resource.url) {\n urls.push(resource.url);\n }\n }\n }\n }\n\n if (urls.length > 0) {\n console.log('\\nGenerated URLs:');\n urls.forEach((url, i) => {\n console.log(` ${i + 1}. ${url}`);\n });\n }\n }\n\n process.exit(0);\n }\n\n if (result.status === 'failed') {\n console.log('\\n\\nTask failed!');\n console.error('Error:', result.error);\n process.exit(1);\n }\n\n await new Promise(resolve => setTimeout(resolve, intervalMs));\n }\n\n console.log('\\n\\nTimeout: Task did not complete within the time limit');\n process.exit(1);\n\n } catch (error: any) {\n console.error('\\nError:', error.message);\n process.exit(1);\n }\n}\n\nasync function runLlm(prompt: string, args: string[]) {\n const options: any = { stream: false, model: 'seaart-mix-sonnet-4-5', temperature: 0.7 };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === '--model') options.model = args[++i];\n else if (arg === '--stream') options.stream = true;\n else if (arg === '--temperature') options.temperature = parseFloat(args[++i]);\n else if (arg === '--max-tokens') options.maxTokens = parseInt(args[++i]);\n else if (arg === '--api-key') options.apiKey = args[++i];\n else if (arg === '--base-url') options.baseUrl = args[++i];\n }\n\n const apiKey = options.apiKey || process.env.API_SERVICE_TOKEN;\n const baseUrl = options.baseUrl || process.env.SEACLOUD_BASE_URL || 'http://proxy.sg.seaverse.dev';\n\n if (!apiKey) {\n console.error('Error: API key not provided. Use --api-key or set API_SERVICE_TOKEN env var');\n process.exit(1);\n }\n\n initSeacloud(apiKey, { baseUrl, timeout: 120000 });\n\n console.log(`Model: ${options.model}`);\n console.log(`Prompt: ${prompt}\\n`);\n\n if (options.stream) {\n const stream = await llmChatCompletions({\n model: options.model,\n messages: [{ role: 'user', content: prompt }],\n stream: true,\n temperature: options.temperature,\n max_tokens: options.maxTokens,\n });\n\n process.stdout.write('Response: ');\n for await (const chunk of stream) {\n const content = chunk.choices[0]?.delta?.content;\n if (typeof content === 'string') process.stdout.write(content);\n }\n console.log('\\n');\n } else {\n const response = await llmChatCompletions({\n model: options.model,\n messages: [{ role: 'user', content: prompt }],\n stream: false,\n temperature: options.temperature,\n max_tokens: options.maxTokens,\n });\n\n console.log('Response:', response.choices[0].message.content);\n console.log('\\nUsage:', response.usage);\n }\n}\n\nasync function runAgent(prompt: string, args: string[]) {\n const options: any = {\n stream: false,\n model: 'gpt-4o',\n agentId: 'seagen_agent',\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === '--model') options.model = args[++i];\n else if (arg === '--stream') options.stream = true;\n else if (arg === '--agent-id') options.agentId = args[++i];\n else if (arg === '--session-id') options.sessionId = args[++i];\n else if (arg === '--api-key') options.apiKey = args[++i];\n else if (arg === '--base-url') options.baseUrl = args[++i];\n }\n\n const apiKey = options.apiKey || process.env.API_SERVICE_TOKEN;\n const baseUrl = options.baseUrl || process.env.SEACLOUD_BASE_URL || 'http://proxy.sg.seaverse.dev';\n\n if (!apiKey) {\n console.error('Error: API key not provided. Use --api-key or set API_SERVICE_TOKEN env var');\n process.exit(1);\n }\n\n initSeacloud(apiKey, { baseUrl, timeout: 300000 }); // 5 min for agent\n\n console.log(`Agent: ${options.agentId}`);\n console.log(`Model: ${options.model}`);\n console.log(`Prompt: ${prompt}\\n`);\n\n if (options.stream) {\n const stream = await agentChatCompletions({\n agent_id: options.agentId,\n messages: [createTextMessage('user', prompt)],\n model: options.model,\n stream: true,\n session_id: options.sessionId,\n seq: 0,\n });\n\n process.stdout.write('Response: ');\n for await (const chunk of stream) {\n const content = chunk.choices[0]?.delta?.content;\n if (typeof content === 'string') process.stdout.write(content);\n }\n console.log('\\n');\n } else {\n const response = await agentChatCompletions({\n agent_id: options.agentId,\n messages: [createTextMessage('user', prompt)],\n model: options.model,\n stream: false,\n session_id: options.sessionId,\n seq: 0,\n });\n\n console.log('Response:', response.choices[0].message.content);\n\n if (response.artifacts && response.artifacts.length > 0) {\n console.log('\\nGenerated Artifacts:');\n response.artifacts.forEach((artifact, i) => {\n console.log(` ${i + 1}. ${artifact.name}`);\n console.log(` URL: ${artifact.url}`);\n });\n }\n\n console.log('\\nSession ID:', response.session_id);\n console.log('Message ID:', response.msg_id);\n }\n}\n\nasync function main() {\n const args = process.argv.slice(2);\n\n if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {\n showHelp();\n process.exit(0);\n }\n\n const command = args[0];\n\n try {\n if (command === 'llm') {\n if (args.length < 2) {\n console.error('Error: prompt required for llm command');\n console.log('Usage: seacloud llm \"<prompt>\" [options]');\n process.exit(1);\n }\n await runLlm(args[1], args.slice(2));\n } else if (command === 'agent') {\n if (args.length < 2) {\n console.error('Error: prompt required for agent command');\n console.log('Usage: seacloud agent \"<prompt>\" [options]');\n process.exit(1);\n }\n await runAgent(args[1], args.slice(2));\n } else {\n // Model generation command\n const model = command;\n\n if (model.startsWith('--')) {\n console.error('Error: command or model name required');\n console.log('Usage: seacloud <command> [options]');\n process.exit(1);\n }\n\n const options = parseArgs(args.slice(1));\n await testModel(model, options);\n }\n } catch (error: any) {\n console.error('\\nError:', error.message);\n process.exit(1);\n }\n}\n\nmain().catch(console.error);\n"]}
|
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
|
-
*
|
|
11931
|
+
* Base message content
|
|
11891
11932
|
*/
|
|
11892
|
-
interface
|
|
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
|
-
*
|
|
12030
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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 (
|
|
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",
|
|
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
|