Show HN:通过自动缩容至零在 AWS 上自托管开源 LLM
英文标题:🔶 Show HN: Self-host open-source LLMs on AWS with scale-to-zero
VeloxML 是一个 CLI 与部署引擎,可通过单条命令将开源 LLM 直接部署到用户自己的 AWS 或 GCP 账户,并支持自动缩容至零。该项目基于 SkyPilot,可配置 Spot 或按需实例,旨在避免 Docker、Kubernetes 以及第三方托管平台带来的框架锁定和合规成本。示例显示,开发者可在约两分钟内,以约 0.07 美元/小时的 AWS Spot 实例运行 Qwen2.5-0.5B-Instruct。对开发者而言,它可用于在私有 VPC 内构建推理 API、Embedding 与重排序服务、Agent 后端及批量推理端点。
729.3 KB
93.6 KB
中文
只需一条命令,即可将开源 LLM 直接部署到你自己的 AWS/GCP 账户。无需 Docker,无需 Kubernetes,支持自动缩容至零。
目录
该仓库仍处于密集开发阶段,文档也在持续演进。欢迎试用,但请预期会有一些破坏性变更。关注该仓库的“releases”,以便在我们准备好 Beta 版本时收到通知。如果你喜欢它,也请给我们一个 star!
# 1. 初始化模型服务
veloxml init my-model
cd my-model
# 2. 部署到 AWS,并支持自动缩容至零
veloxml deploy
# 输出:
# 副本已就绪:http://34.201.45.12:8000
# 测试你的端点:
# curl -X POST http://34.201.45.12:8000/predict \
# -H "Content-Type: application/json" \
# -d '{"prompt": "Hello world"}'
这是一个 CLI 和部署引擎,允许你通过一条命令将开源 LLM 直接部署到自己的云账户(AWS/GCP)中。
其工作方式如下:
- CLI 读取你的模型代码(
app.py)和硬件规格(veloxml.yaml)。 - 它通过 SkyPilot,直接在你的云账户内配置经过优化的 Spot 或按需实例。
- 它准备运行时环境、加载权重、验证健康检查探针,并输出一条可立即测试的
curl命令。
很酷,但为什么不直接使用 Modal、RunPod 或 Baseten?
原因有几个:
-
你的数据、提示词和模型权重永远不会离开自己的 AWS/GCP 账户。没有第三方服务器,也没有 SOC2 或 HIPAA 合规难题。
-
你无需为了部署到私有 VPC 而支付 5 万至 10 万美元的企业版门槛费用。VeloxML 从第一天起就在你的账户中原生提供同样的无服务器体验。
-
没有框架锁定。Modal 会强制你使用专有装饰器(
@modal.function)重写代码。 -
直接部署到自己云账户的优势在于:你的专有数据、客户查询和模型权重永远不会离开安全边界。无需进行第三方合规审查(SOC2/HIPAA)。
-
成本效率。VeloxML 默认使用 Spot 实例(
use_spot: true),让你能够在 AWS 上提供模型服务,而不必为闲置且未受管理的 GPU 每月消耗超过 1,500 美元。 -
它构建于 SkyPilot 之上;SkyPilot 是由加州大学伯克利分校开发的极其可靠的开源计算编排器。
我可以用它构建什么?
- 私有 LLM 推理 API(任何开放权重检查点或微调模型)
- 自定义 Embedding 与重排序微服务
- 实时推理和 Agent 工具调用后端
- 安全托管在你的 VPC 内、面向特定领域的微调模型
- 高吞吐量批量推理端点
在不到两分钟内,使用 Spot 实例(约 0.07 美元/小时),将真实的开放权重小型语言模型(Qwen/Qwen2.5-0.5B-Instruct)直接部署到你的 AWS 账户。
- 安装并验证云访问权限
pip install veloxml-deploy
veloxml check
- 创建项目文件夹
mkdir llm-service
cd llm-service
- 创建
app.py
将以下内容粘贴到 app.py:
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
pipe = pipeline("text-generation", model="Qwen/Qwen2.5-0.5B-Instruct")
@app.get("/health")
def health():
return {"status": "ok"}
@app.post("/predict")
def predict(data: dict):
return {"response": pipe([{"role": "user", "content": data["prompt"]}], max_new_tokens=50)[0]["generated_text"][-1]["content"]}
- 创建
veloxml.yaml
将以下内容粘贴到 veloxml.yaml:
name: llm-service
compute:
cpus: 4+
memory: 8+
use_spot: true
runtime:
setup: pip install fastapi uvicorn "transformers<5.0.0" accelerate
- 部署到云端
运行:
VeloxML 会配置 AWS Spot 实例、安装依赖、验证 /health 探针,并输出你的在线副本 URL。
- 测试你的在线端点
使用 curl 查询你的在线推理 API:
curl -X POST http://<ENDPOINT_IP>:8000/predict \
-H "Content-Type: application/json" \
-d '{"prompt": "Say this is a test"}'
输出:
{
"response": "This is a test."
}
- 清理
完成测试后,终止所有云计算资源,以避免持续产生费用:
我们欢迎提交 issue、pull request 和反馈。本地开发环境设置请参阅 CONTRIBUTING.md。
该仓库采用 Apache 2.0 许可证。
English / 原文
Deploy open-source LLMs directly to your own AWS/GCP account with one command. Zero Docker, zero Kubernetes, scale-to-zero.
Contents
This repo is still under heavy development and the documentation is evolving. You're welcome to try it, but expect some breaking changes. Watch "releases" of this repo to receive a notification when we are ready for Beta. And give us a star if you like it!
# 1. Initialize a model service
veloxml init my-model
cd my-model
# 2. Deploy to AWS with scale-to-zero
veloxml deploy
# Output:
# Replica ready at http://34.201.45.12:8000
# Test your endpoint:
# curl -X POST http://34.201.45.12:8000/predict \
# -H "Content-Type: application/json" \
# -d '{"prompt": "Hello world"}'
This is a CLI and deployment engine that allows you to deploy open-source LLMs directly to your own cloud account (AWS/GCP) with a single command.
It works like this:
- the CLI reads your model code (
app.py) and hardware spec (veloxml.yaml) - it provisions an optimized Spot or On-Demand instance (via SkyPilot) directly inside your cloud account
- it prepares the runtime, loads the weights, verifies the health probe, and prints a ready-to-test
curlcommand.
Cool, but why not just use Modal, RunPod, or Baseten?
A few reasons:
-
Your data, prompts, and model weights never leave your own AWS/GCP account. Zero third-party servers, and zero SOC2 or HIPAA compliance headaches
-
You don't have to pay a $50k-$100k enterprise paywall just to deploy inside your private VPC. VeloxML gives you that exact serverless experience natively in your account on day one
-
Zero framework lock-in. Modal forces you to rewrite your code with proprietary decorators (
@modal.function) -
The beauty of deploying directly to your own cloud account is that your proprietary data, customer queries, and model weights never leave your security perimeter. Zero third-party compliance reviews (SOC2/HIPAA) needed.
-
Cost efficiency. VeloxML defaults to Spot instances (
use_spot: true), allowing you to serve models on AWS without burning $1,500+/mo on idle, unmanaged GPUs. -
This is built on SkyPilot, an extremely robust open-source compute orchestrator developed at UC Berkeley.
What can I build with this?
- Private LLM inference APIs (any open-weights checkpoint or fine-tuned model)
- Custom embedding & reranking microservices
- Real-time reasoning and agent tool-calling backends
- Domain-specific fine-tuned models hosted securely inside your VPC
- High-throughput batch inference endpoints
Deploy a real, open-weights Small Language Model (Qwen/Qwen2.5-0.5B-Instruct) directly to your AWS account on a Spot instance (~$0.07/hr) in under 2 minutes.
- Install and verify cloud access
pip install veloxml-deploy
veloxml check
- Create project folder
mkdir llm-service
cd llm-service
- Create
app.py
Paste this into app.py:
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
pipe = pipeline("text-generation", model="Qwen/Qwen2.5-0.5B-Instruct")
@app.get("/health")
def health():
return {"status": "ok"}
@app.post("/predict")
def predict(data: dict):
return {"response": pipe([{"role": "user", "content": data["prompt"]}], max_new_tokens=50)[0]["generated_text"][-1]["content"]}
- Create
veloxml.yaml
Paste this into veloxml.yaml:
name: llm-service
compute:
cpus: 4+
memory: 8+
use_spot: true
runtime:
setup: pip install fastapi uvicorn "transformers<5.0.0" accelerate
- Deploy to the cloud
Run:
VeloxML provisions the AWS Spot instance, installs dependencies, verifies the /health probe, and outputs your live replica URL.
- Test your live endpoint
Query your live inference API using curl:
curl -X POST http://<ENDPOINT_IP>:8000/predict \
-H "Content-Type: application/json" \
-d '{"prompt": "Say this is a test"}'
Output:
{
"response": "This is a test."
}
- Clean Up
When finished testing, terminate all cloud compute to avoid lingering charges:
We welcome any issues, pull requests, and feedback. See CONTRIBUTING.md for local development setup.
This repo is licensed under Apache 2.0.
