通过SDK接入 如果本地已安装 Node.js,但仍无法执行 npx,请检查: 1. Node.js 是否安装完整 2. 当前终端是否已重新打开 3. Node.js 安装目录是否已加入系统 PATH 接入流程 1. 开通 AIuse 云电脑服务。 2. 创建 AccessKey,并关联可操作的云电脑。 3. 在项目中安装 SDK。 4. 创建 Client 实例。 5. 创建 Session。 6. 调用 Computer Use 或 FileSystem 能力。 7. 任务完成后关闭 Session。 安装 SDK plaintext npm install @ctyun/desktopagentsdk 也可以使用 yarn 或 pnpm: plaintext yarn add @ctyun/desktopagentsdk pnpm add @ctyun/desktopagentsdk 基础示例 plaintext import Client from '@ctyun/desktopagentsdk'; async function main() { const client new Client({ apiKey: process.env.AIUSEAPIKEY, apiSecret: process.env.AIUSEAPISECRET, desktopCode: process.env.AIUSEDESKTOPCODE, serviceURL: process.env.AIUSESERVICEURL ' }); const session await client.createSession(); try { await session.computer.movemouse({ x: 500, y: 300 }); await session.computer.clickmouse({ x: 500, y: 300 }); await session.computer.typetext({ text: 'Hello from AIuse' }); const screenshot await session.computer.screenshot(); console.log('screenshot result:', screenshot); } finally { await session.close(); } } main().catch(console.error); 关键配置 参数 是否必填 说明 apiKey 是 控制台创建的 AccessKey ID apiSecret 是 控制台创建的 AccessKey Secret desktopCode 是 需要操作的云电脑桌面编码 serviceURL 否 服务地址,默认值以 SDK 发布版本为准 返回结构 SDK 方法通常返回如下结构: plaintext { "code": 0, "data": null, "msg": null } code 为 0 通常表示调用成功,data 为业务结果,msg 为失败时的错误信息。