开源推理引擎 是 AI Skill Hub 本期精选AI工具之一。综合评分 8.0 分,整体质量较高。我们强烈推荐将其纳入你的 AI 工具库,帮助提升工作效率。
基于Rust和CUDA的LLM推理引擎,兼容OpenAI
开源推理引擎 是一款基于 Rust 开发的开源工具,专注于 cuda、gpu、inference 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
基于Rust和CUDA的LLM推理引擎,兼容OpenAI
开源推理引擎 是一款基于 Rust 开发的开源工具,专注于 cuda、gpu、inference 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:cargo install(推荐) cargo install openinfer # 方式二:从源码编译 git clone https://github.com/openinfer-project/openinfer cd openinfer cargo build --release # 二进制在 ./target/release/openinfer
# 查看帮助 openinfer --help # 基本运行 openinfer [options] <input> # 详细使用说明请查阅文档 # https://github.com/openinfer-project/openinfer
# openinfer 配置说明 # 查看配置选项 openinfer --config-example > config.yml # 常见配置项 # output_dir: ./output # log_level: info # workers: 4 # 环境变量(覆盖配置文件) export OPENINFER_CONFIG="/path/to/config.yml"
<p align="center"> <picture> <source media="(max-width: 600px) and (prefers-color-scheme: dark)" srcset="docs/assets/banner-mobile-dark.svg"> <source media="(max-width: 600px)" srcset="docs/assets/banner-mobile-light.svg"> <source media="(prefers-color-scheme: dark)" srcset="docs/assets/banner-dark.svg"> <img src="docs/assets/banner-light.svg" width="1000" alt="PegaInfer — LLM inference in Rust and CUDA. Built in Rust. Tuned for production inference."> </picture> </p>
<p align="center"> <a href="https://pegainfer.org/"> <img src="https://img.shields.io/badge/Docs%20%26%20Blog-pegainfer.org-2ea44f" alt="Docs and engineering blog"> </a> <a href="https://join.slack.com/t/openinferhq/shared_invite/zt-41scnc53a-d0McNJDjK2lVqFGoSLUgXA"> <img src="https://img.shields.io/badge/Slack-join%20the%20community-4A154B?logo=slack&logoColor=white" alt="Join the PegaInfer Slack"> </a> <a href="LICENSE"> <img src="https://img.shields.io/badge/License-Apache%202.0-475569" alt="Apache 2.0 license"> </a> </p>
<p align="center"> <a href="#quickstart">Quickstart</a> · <a href="#performance">Performance</a> · <a href="#supported-models">Models</a> · <a href="#architecture">Architecture</a> · <a href="#api">API</a> · <a href="#development">Development</a> </p>
PegaInfer serves LLMs through an OpenAI-compatible API. Each model owns its scheduler, state, and kernels; serving and KV infrastructure are shared. No PyTorch or Python runtime.
Use the Rust toolchain pinned in rust-toolchain.toml, a CUDA Toolkit with nvcc and cuBLAS, and a compatible NVIDIA driver. The default Qwen3 build needs no Python. Its driver floor is R545 / CUDA 12.3; newer toolkits and model-specific kernels can require a newer driver.
From the repository root, with the checkpoint downloaded:
export CUDA_HOME=/usr/local/cuda
cargo run --release -- --model-path models/Qwen3-4B
Always use --release for GPU builds. The server entrypoint is pegainfer-server; model crates contain the model implementation and diagnostics.
<details> <summary><strong>Feature builds and environment options</strong></summary>
Qwen3.5 uses Triton AOT kernels, requiring Python and Triton at build time:
uv venv
uv pip install triton
export PEGAINFER_TRITON_PYTHON=.venv/bin/python
cargo run --release --features qwen35 -- --model-path models/Qwen3.5-4B
| Variable | Purpose |
|---|---|
CUDA_HOME | CUDA Toolkit location; defaults to /usr/local/cuda |
PEGAINFER_CUDA_SM | Target GPU architecture when it cannot be detected, e.g. 120 |
PEGAINFER_TRITON_PYTHON | Python interpreter for Qwen3.5 Triton AOT compilation |
PEGAINFER_TILELANG_PYTHON | Python interpreter for K3 TileLang kernel generation |
Other model lines have their own hardware and build requirements; follow the model guides below. Run cargo run --release -- --help for the compiled-in CLI.
</details>
<details> <summary><strong>Windows source builds</strong></summary>
```powershell $env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.x" cargo run --release -p pegainfer-server -- --model-path models/Qwen3-4B
uv venv .venv --python 3.12 uv pip install "triton-windows<3.7" $env:PEGAINFER_TRITON_PYTHON = ".venv\Scripts\python.exe" cargo run --release --features qwen35 -- --model-path models/Qwen3.5-4B ```
</details>
Point an OpenAI-compatible client at http://localhost:8000/v1. Both /v1/completions and /v1/chat/completions support streaming.
curl -s http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{"model":"models/Qwen3-4B","prompt":"The capital of France is","max_tokens":32}'
curl -N http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"models/Qwen3-4B","messages":[{"role":"user","content":"Write a haiku about Rust."}],"max_tokens":64,"stream":true}'
The model guides document supported sampling fields and model-specific limits. Documentation covers the serving interface; metrics and dashboards cover observability.
Only qwen3 is enabled by default, including in the prebuilt binary. Build other lines with --features <feature>. At launch, --model-path selects a checkpoint and its config.json identifies the model family.
| Model line | Attention / experts | Cargo feature | Serving scope and guide |
|---|---|---|---|
| **Qwen3 · dense 0.6B to 32B** | Full attention, GQA | qwen3 · default | Greedy + sampling, tensor parallel, prefix cache, KV offload; DFlash / DSpark on 4B. [Model page](https://pegainfer.org/models/qwen3-4b/) |
| **Qwen3.5 · dense 0.8B to 27B** | Gated DeltaNet + full attention | qwen35 | Text-only BF16; build-time Triton. [Model page](https://pegainfer.org/models/qwen35/) |
| **Gemma 4 · 12B and 26B-A4B** | Sliding-window + global attention; NVFP4 routed experts on 26B | gemma4 | Text-only, single GPU, batched decode and optional chunked prefill. [Model page](https://pegainfer.org/models/gemma4/) |
| **DeepSeek-V2-Lite** | MLA + MoE | deepseek-v2-lite | 2-GPU EP2 correctness path. [Status and limits](docs/models/deepseek-v2-lite/status.md) |
| **Kimi-K2 / K2.5** | MLA + MoE, Marlin INT4 | kimi-k2 | 8-GPU expert parallelism. [Model roadmap](docs/models/kimi-k2/roadmap.md) |
| **GLM-5.2** | Sparse MLA + MoE, FP8 | glm52 | Blackwell; EP decode, TP4 prefill, native MTP speculative decoding, P/D disaggregation. Bring-up. [Model page](https://pegainfer.org/models/glm52/) |
| **Kimi-K3** | KDA + MLA, latent MoE, MXFP4 | k3 | Text-only, Blackwell, EP and DSpark. Bring-up. [Model guide](docs/models/k3/bring-up.md) |
Capabilities and maturity differ by model. Quantized formats are model-specific; the Qwen paths listed here use BF16. DeepSeek-V2-Lite's retained correctness and benchmark gates are documented separately from production readiness.
openinfer 是一个基于纯 Rust 和 CUDA 开发的高性能 LLM 推理引擎。与传统的推理框架不同,它不依赖 PyTorch 或其他大型模型框架运行时,旨在通过极致的底层优化提供更轻量、更快速的推理体验,非常适合对性能和资源占用有严苛要求的生产环境。
目前 openinfer 支持 Qwen3 系列模型的推理。需要注意的是,针对 Qwen3.5 的 AOT 特性支持需要通过 feature-gated 方���启用 Triton。目前项目正处于快速迭代中,部分量化功能(如 Qwen 系列的 INT4/FP8/FP4)目前针对特定模型(如 Kimi-K2 Marlin 或 DeepSeek-V4)进行了优化,通用量化功能正在持续完善中。
运行 openinfer 需要 Rust (2024 edition) 开发环境以及 CUDA Toolkit (包含 nvcc 和 cuBLAS)。硬件方面必须配备支持 CUDA 的 NVIDIA GPU,且驱动版本需为 R535 (CUDA 12.2) 或更高。对于需要 Triton 支持的特定模型(如 Qwen3.5),开发者需配置相应的 Python 环境以运行 Triton AOT kernels。
项目通过 Cargo 进行构建。对于默认的 Qwen3 构建,无需 Python 环境即可直接运行。若需运行 Qwen3.5,建议使用 `uv` 创建虚拟环境并安装 `triton`,同时通过设置 `OPENINFER_TRITON_PYTHON` 环境变量来指定 Python 解释器。在工作区根目录下使用 `cargo run --release` 即可启动服务,或通过 `-p openinfer-server` 指定包名进行部署。
用户可以通过命令行启动推理服务器。启动时需指定模型路径参数 `--model-path`。请注意,模型逻辑(如 `openinfer-qwen3`)与服务器入口(`openinfer-server`)是分离的,建议从工作区根目录统一调用。对于开发者,可以通过设置 `OPENINFER_TEST_MODEL_PATH` 环境变量来运行精度与集成测试,确保模型输出符合预期。
openinfer 提供与 OpenAI 兼容的 `/v1/completions` API 接口,方便开发者无缝迁移现有应用。接口支持标准的 `prompt` 输入,并允许通过 `max_tokens` 控制生成长度,通过 `temperature` 参数调节采样随机性(设置为 0 即为 Greedy Search 贪婪搜索模式)。
openinfer 采用模块化设计,核心逻辑分布在不同的 crate 中。`openinfer-server` 作为服务端入口,而 `openinfer-qwen3`、`openinfer-qwen35-4b` 及 `openinfer-deepseek-v4` 等模型 crate 则负责具体的模型逻辑实现与诊断功能,确保了架构的清晰与可扩展性。
高性能LLM推理引擎,兼容OpenAI
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
✅ Apache 2.0 — 宽松开源协议,可商用,需保留版权声明和 NOTICE 文件,含专利授权条款。
经综合评估,开源推理引擎 在AI工具赛道中表现稳健,质量优秀。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | openinfer |
| 原始描述 | 开源AI工具:Pure Rust + CUDA LLM inference engine — no PyTorch, OpenAI-compatible, serves Qw。⭐511 · Rust |
| Topics | cudagpuinferencerust |
| GitHub | https://github.com/openinfer-project/openinfer |
| License | Apache-2.0 |
| 语言 | Rust |
收录时间:2026-07-05 · 更新时间:2026-07-11 · License:Apache-2.0 · AI Skill Hub 不对第三方内容的准确性作法律背书。