用途:在 inference.sh 平台上构建、测试和部署应用,支持 Python 与 Node.js。
主要能力:通过 belt CLI 完成脚手架、本地测试、部署与云端运行;应用可暴露多个函数,各自定义输入输出模式;支持 GPU/CPU 资源配置、环境变量、密钥与集成;提供 API 封装应用模板与用量追踪(OutputMeta)。
必要用法:先安装 CLI:curl -fsSL https://cli.inference.sh | sh,再执行 belt update、belt login、belt me。用 belt app init my-app(或 --lang node)创建应用,禁止手工创建 inf.yml、inference.py、inference.js、init.py、package.json 或应用目录。开发流程为:脚手架、实现、本地测试(belt app test --save-example 等)、部署(belt app deploy --dry-run 后 belt app deploy)、云端验证(belt app run user/app --json --input '{"prompt": "hello"}')。每次运行 belt 命令前必须先 cd 进入应用目录,因为 shell 工作目录不会在工具调用间保留。
限制与注意:含 output_meta 的输出类必须继承 BaseAppOutput 而非 BaseModel,否则 output_meta 会被静默丢弃;run() 中应默认加入 self.logger.info(...);跨应用共享辅助模块需用符号链接、init.py 和相对导入,不要复制文件;GPU 应用应使用 accelerate 检测设备,大模型可用 device_map 直接从磁盘流式加载;目前仅支持 NVIDIA CUDA GPU。完整文档见 inference.sh/docs,示例见 github.com/inference-sh/grid。