OpenLLM 不存储模型权重,首次运行需联网下载;gated 模型要申请访问权限并设置 HF_TOKEN 环境变量;服务默认监听 3000 端口,客户端 base_url 需带 /v1。
OpenLLM
bentomlApache-2.0活跃维护把 DeepSeek、Llama 等开源大模型一键部署成兼容 OpenAI 的 API 服务,省去自己搭推理后端的麻烦。
Run any open-source LLMs, such as DeepSeek and Llama, as OpenAI compatible API endpoint in the cloud.
pip install openllm
openllm helloREADME 按模型列出所需 GPU 显存,例如 gemma2:2b 需 12G、llama3.1:8b 需 24G、llama3.3:70b 需 80G×2、deepseek:r1-671b 需 80G×16;未说明 CPU 运行和 GPU 厂商型号。
一条命令把开源大模型跑成 OpenAI 兼容 API,自带聊天界面和云部署流程
把 DeepSeek、Llama 等开源大模型一键部署成兼容 OpenAI 的 API 服务,省去自己搭推理后端的麻烦。
核心能力
- 用 openllm serve 一条命令启动 OpenAI 兼容 API 服务
- 内置 /chat 网页聊天界面和 CLI 对话模式
- 提供默认模型仓库,可 openllm repo add 挂自定义仓库
- 基于 vLLM 做生产级推理后端,BentoML 负责模型服务
- 支持用 Docker 和 Kubernetes 做云上部署
容易踩的坑
- v0.6.30最新正式版2025-04-21 · 2025-04-21 04:10 UTC
Full Changelog: https://github.com/bentoml/OpenLLM/compare/v0.6.29...v0.6.30
- v0.6.292025-04-16 · 2025-04-16 04:47 UTC
查看更新说明
What's Changed
- feat: add support for search filter by @aarnphm in https://github.com/bentoml/OpenLLM/pull/1177
Full Changelog: https://github.com/bentoml/OpenLLM/compare/v0.6.28...v0.6.29
- v0.6.282025-04-16 · 2025-04-16 04:41 UTC
查看更新说明
Full Changelog: https://github.com/bentoml/OpenLLM/compare/v0.6.27...v0.6.28
- v0.6.272025-04-16 · 2025-04-16 01:23 UTC
查看更新说明
Full Changelog: https://github.com/bentoml/OpenLLM/compare/v0.6.26...v0.6.27
- v0.6.262025-04-16 · 2025-04-16 00:59 UTC
查看更新说明
What's Changed
- chore(deps): bump openai from 1.70.0 to 1.73.0 in the production-dependencies group by @dependabot in https://github.com/bentoml/OpenLLM/pull/1175
- ci: pre-commit autoupdate [pre-commit.ci] by @pre-commit-ci in https://github.com/bentoml/OpenLLM/pull/1176
Full Changelog: https://github.com/bentoml/OpenLLM/compare/v0.6.25...v0.6.26
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
OpenLLM allows developers to run any open-source LLMs (Llama 3.3, Qwen2.5, Phi3 and more) or custom models as OpenAI-compatible APIs with a single command. It features a built-in chat UI, state-of-the-art inference backends, and a simplified workflow for creating enterprise-grade cloud deployment with Docker and Kubernetes.
Understand the design philosophy of OpenLLM.
Get Started
Run the following commands to install OpenLLM and explore it interactively.
pip install openllm # or pip3 install openllm
openllm hello
Supported models
OpenLLM supports a wide range of state-of-the-art open-source LLMs. You can also add a model repository to run custom models with OpenLLM.
For the full model list, see the OpenLLM models repository.
Start an LLM server
To start an LLM server locally, use the openllm serve command and specify the model version.
[!NOTE] OpenLLM does not store model weights. A Hugging Face token (HF_TOKEN) is required for gated models.
- Create your Hugging Face token here.
- Request access to the gated model, such as meta-llama/Llama-3.2-1B-Instruct.
- Set your token as an environment variable by running:
export HF_TOKEN=<your token>
openllm serve llama3.2:1b
The server will be accessible at http://localhost:3000, providing OpenAI-compatible APIs for interaction. You can call the endpoints with different frameworks and tools that support OpenAI-compatible APIs. Typically, you may need to specify the following:
- The API host address: By default, the LLM is hosted at http://localhost:3000.
- The model name: The name can be different depending on the tool you use.
- The API key: The API key used for client authentication. This is optional.
Here are some examples:
from openai import OpenAI
client = OpenAI(base_url='http://localhost:3000/v1', api_key='na')
# Use the following func to get the available models
# model_list = client.models.list()
# print(model_list)
chat_completion = client.chat.completions.create(
model="meta-llama/Llama-3.2-1B-Instruct",
messages=[
{
"role": "user",
"content": "Explain superconductors like I'm five years old"
}
],
stream=True,
)
for chunk in chat_completion:
print(chunk.choices[0].delta.content or "", end="")
from llama_index.llms.openai import OpenAI
llm = OpenAI(api_bese="http://localhost:3000/v1", model="meta-llama/Llama-3.2-1B-Instruct", api_key="dummy")
...
Chat UI
OpenLLM provides a chat UI at the /chat endpoint for the launched LLM server at http://localhost:3000/chat.
Chat with a model in the CLI
To start a chat conversation in the CLI, use the openllm run command and specify the model version.
openllm run llama3:8b
Model repository
A model repository in OpenLLM represents a catalog of available LLMs that you can run. OpenLLM provides a default model repository that includes the latest open-source LLMs like Llama 3, Mistral, and Qwen2, hosted at this GitHub repository. To see all available models from the default and any added repository, use:
openllm model list
To ensure your local list of models is synchronized with the latest updates from all connected repositories, run:
openllm repo update
To review a model’s information, run:
openllm model get llama3.2:1b
Add a model to the default model repository
You can contribute to the default model repository by adding new models that others can use. This involves creating and submitting a Bento of the LLM. For more information, check out this example pull request.
Set up a custom repository
You can add your own repository to OpenLLM with custom models. To do so, follow the format in the default OpenLLM model repository with a bentos directory to store custom LLMs. You need to build your Bentos with BentoML and submit them to your model repository.
First, prepare your custom models in a bentos directory following the guidelines provided by BentoML to build Bentos. Check out the default model repository for an example and read the Developer Guide for details.
Then, register your custom model repository with OpenLLM:
openllm repo add <repo-name> <repo-url>
Note: Currently, OpenLLM only supports adding public repositories.
Community
Join our Community Forum 💬, where thousands of AI/ML engineers help each other and talk about building AI products.
Contributing
As an open-source project, we welcome contributions of all kinds, such as new features, bug fixes, and documentation. Here are some of the ways to contribute:
- Repost a bug by creating a GitHub issue.
- Submit a pull request or help review other developers’ pull requests.
- Add an LLM to the OpenLLM default model repository so that other users can run your model. See the pull request template.
- Check out the Developer Guide to learn more.
Acknowledgements
This project uses the following open-source projects:
- bentoml/bentoml for production level model serving
- vllm-project/vllm for production level LLM backend
- blrchen/chatgpt-lite for a fancy Web Chat UI
- astral-sh/uv for blazing fast model requirements installing
We are grateful to the developers and contributors of these projects for their hard work and dedication.