@ computesdk/ 气候
对齐 提供方 计算SDK。 。 。 .
安装
npm install @computesdk/collimate computesdk
使用量
import { collimate } from "@computesdk/collimate";
import { compute } from "computesdk";
compute.setConfig({
provider: collimate({
apiKey: "col_live_...",
templateId: "node",
}),
});
const sandbox = await compute.instances.create();
const result = await sandbox.runCommand("node -v");
console.log(result.stdout); // v22.x.x
await sandbox.destroy();
配置
| 选项 | 类型 | 默认 | 说明 |
apiKey | string | COLLIMATE_API_KEY 环境 | 认证的 API 密钥 |
serverUrl | string | https://api.collimate.ai | API 服务器 URL |
templateId | string | —— 说 | 模板 ID (node, (中文(简体) ), python页:1 |
timeout | number | 900 | 执行超时数秒 |
支助行动
create() 编号 : destroy() 沙盒生命周期
runCommand() 使用stdout/stderr/exitCode执行外壳
writeFile() 编号 : readFile() - 文件系统操作
mkdir() 编号 : readdir() 编号 : exists() 编号 : remove() ——目录操作
getById() 编号 : list() 编号 : getInfo() - 沙盒管理
链接