模型不在包内,首次使用需联网下载并缓存;Python 示例需先调用 download_and_register_eps 注册执行提供程序,失败要处理;CLI 为公开预览版,需从 GitHub Release 单独下载对应平台安装包;定位是单用户端侧推理,不适合多并发服务端场景。
foundry-local
microsoft活跃维护微软推出的本地 AI 推理运行时,基于 ONNX Runtime 在设备端跑聊天补全和语音转文字模型,支持 GPU 加速,不用联网也能用。
pip install foundry-local-sdk==2.2.1
npm install --save-exact [email protected]README 未给出具体显存或内存门槛;运行时自动检测并优先使用 NPU、GPU 或 CPU,支持 Windows、macOS(Apple silicon)和 Linux。
微软出品的端侧 AI 运行时,把模型下载、硬件加速和推理打包进你的应用,让对话完全留在用户设备上
微软推出的本地 AI 推理运行时,基于 ONNX Runtime 在设备端跑聊天补全和语音转文字模型,支持 GPU 加速,不用联网也能用。
核心能力
- 提供 C、C++、C#、JavaScript、Python、Rust 原生 SDK
- 运行时约 20 MB,基于 ONNX Runtime 完成推理
- 自动检测 NPU、GPU、CPU 并选择最佳执行提供程序
- 精选量化模型目录,首次使用时自动下载并本地缓存
- 兼容 OpenAI 请求与响应格式,可复用现有 OpenAI SDK
容易踩的坑
- v2.3.1Foundry Local v2.3.1最新正式版2026-11-03 · 2026-11-03 00:07 UTC
🚀 Foundry Local v2.3.1
We're excited to announce Foundry Local v2.3.1.
🆕 What's New
- Upgrade Rust SDK ZIP dependency to 9.0.5+
[!NOTE] CUDA and cuDNN runtimes must be installed separately; Foundry Local does not download them.
- Windows/Linux x64: CUDA 12 and compatible cuDNN 9 runtimes.
- Windows/Linux ARM64: CUDA 13 and compatible cuDNN 9 runtimes.
On Windows, add the runtime DLL directories to
PATH. On Linux, configure the system library search path orLD_LIBRARY_PATH. Configure library search paths before starting your application. Windows x64 applications must additionally callAddDllDirectoryfor the CUDA runtime directory before CUDA execution-provider registration;PATHalone is insufficient for the GenAI CUDA bridge. This additional step is not required for the shipped Windows ARM64 bridge.📥 Source Code
GitHub automatically includes source archives with the v2.3.1 release:
📚 Resources
💙 Feedback
File issues at https://github.com/microsoft/Foundry-Local/issues and include the SDK version, platform, and relevant diagnostics.
- v2.3.0Foundry Local v2.3.02026-11-02 · 2026-11-02 23:43 UTC
查看更新说明
🚀 Foundry Local v2.3.0
We're excited to announce Foundry Local v2.3.0. This release improves reliability and inference across SDKs and EPs.
🆕 What's New
⚡Improvements
- Better support for coding models
- Better inference performance across EPs
- Add language support to Java PCM and WAV transcription
- Add a native shared model cache across Foundry Local SDKs
🐛 Fixed
- Register CUDA EP before TRTRTX EP, fixing occasional OOM errors
- Apply chat defaults correctly
- Fixed support for Parakeet and Whisper models
- Fix hang preventing shutdown
[!NOTE] CUDA and cuDNN runtimes must be installed separately; Foundry Local does not download them.
- Windows/Linux x64: CUDA 12 and compatible cuDNN 9 runtimes.
- Windows/Linux ARM64: CUDA 13 and compatible cuDNN 9 runtimes.
On Windows, add the runtime DLL directories to
PATH. On Linux, configure the system library search path orLD_LIBRARY_PATH. Configure library search paths before starting your application. Windows x64 applications must additionally callAddDllDirectoryfor the CUDA runtime directory before CUDA execution-provider registration;PATHalone is insufficient for the GenAI CUDA bridge. This additional step is not required for the shipped Windows ARM64 bridge.📥 Source Code
GitHub automatically includes source archives with the v2.3.0 release:
📚 Resources
💙 Feedback
File issues at https://github.com/microsoft/Foundry-Local/issues and include the SDK version, platform, and relevant diagnostics.
- cli-preview-0.13.0Foundry Local CLI 0.13.0 (Preview)pre-release2026-11-02 · 2026-11-02 22:18 UTC
查看更新说明
Public preview update for the Foundry Local CLI.
[!IMPORTANT] Preview. This is an early CLI build. Expect rough edges, missing polish, and changes between releases. Please file issues with
[cli]in the title and includefoundry reportoutput when possible.What's New
Updated Foundry Local SDK
This build updates the Foundry Local SDK and Runtime packages to
2.3.0, ONNX Runtime to 1.31.0 and ONNX Runtime GenAI 0.18.0.⚡ Improvements
- Better support for BYOM models
- Support for coding models
- Improved validation of EP downloads and
server stopbefore proceeding
🐛 Fixed
- Register CUDA EP before TRTRTX EP, fixing occasional OOM errors
- Apply chat defaults correctly
- Fix support for Parakeet and Whisper models
- Fix daemon hang preventing shutdown
[!NOTE] CUDA and cuDNN runtimes must be installed separately; Foundry Local does not download them.
- Windows/Linux x64: CUDA 12 and compatible cuDNN 9 runtimes.
- Windows/Linux ARM64: CUDA 13 and compatible cuDNN 9 runtimes.
On Windows, add the runtime DLL directories to
PATH. On Linux, configure the system library search path orLD_LIBRARY_PATH. After changing these settings, open a new terminal and runfoundry server restart.Install
Pick the asset for your platform from the downloads list below.
Platform Asset Windows x64 foundry-0.13.0-win-x64.msixWindows ARM64 foundry-0.13.0-win-arm64.msixmacOS Apple Silicon foundry-0.13.0-osx-arm64.pkgorfoundry-0.13.0-osx-arm64.zipLinux x64 foundry-0.13.0-linux-x64.tar.gzLinux ARM64 foundry-0.13.0-linux-arm64.tar.gz# Windows Add-AppxPackage .\foundry-0.13.0-win-x64-winml.msix foundry --version# macOS sudo installer -pkg foundry-0.13.0-osx-arm64.pkg -target / foundry --version# Linux tar xzf foundry-0.13.0-linux-x64.tar.gz cd foundry-0.13.0-linux-x64 ./lib/foundry --versionAll binaries are signed by Microsoft Corporation. SHA-256 digests are shown on the asset list above.
Quick Start
foundry status foundry model list foundry model load qwen3-0.6b foundry chat qwen3-0.6b foundry transcribe -m whisper-tiny -f audio.wav foundry server stopMost commands accept
--output jsonfor scripting. Runfoundry --helpfor the full command surface.Coming from the older Foundry Local CLI?
The earlier service-based CLI has been replaced. Common commands map roughly as follows:
Old service-based CLI New CLI foundry service start/stop/restart/ps/diagfoundry server start/stop/restart/logsfoundry model run <alias>foundry run <alias>Run
foundry --helpfor the full surface.Links
- Docs: https://aka.ms/foundry-local-docs
- SDK: https://github.com/microsoft/Foundry-Local/tree/main/sdk
- Discord: https://aka.ms/foundry-local-discord
- Issues: https://github.com/microsoft/Foundry-Local/issues
Feedback
File issues at https://github.com/microsoft/Foundry-Local/issues with
[cli]in the title and include the output offoundry report. - v2.2.1Foundry Local v2.2.12026-10-23 · 2026-10-23 09:17 UTC
查看更新说明
🚀 Foundry Local v2.2.1
We're excited to announce Foundry Local v2.2.1. This release makes it easier to use tool calling for coding workflows, and delivers important security, reliability, and inference improvements across the SDKs.
🆕 What's New
🔄 CUDA changes
- Reduced CUDA EP binary size by no longer bundling CUDA toolkit and CUDA runtime on Windows
- Enable CUDA EP download/registration for Linux ARM64
- Support independent
PATHandAddDllDirectoryCUDA loading on Windows
[!NOTE] CUDA and cuDNN runtimes must be installed separately; Foundry Local does not download them.
- Windows/Linux x64: CUDA 12 and compatible cuDNN 9 runtimes.
- Windows/Linux ARM64: CUDA 13 and compatible cuDNN 9 runtimes.
On Windows, add the runtime DLL directories to
PATH. On Linux, configure the system library search path orLD_LIBRARY_PATH. Configure library search paths before starting your application. Windows x64 applications must additionally callAddDllDirectoryfor the CUDA runtime directory before CUDA execution-provider registration;PATHalone is insufficient for the GenAI CUDA bridge. This additional step is not required for the shipped Windows ARM64 bridge.📦Models
- Migrated to catalog v2, which should support increased speeds and stability
- Check minimum Foundry Local version needed for model so that we always fetch the latest version of a model that can run with the given version of Foundry Local SDK
- Support coding models
- Improve BYOM metadata
🛠️ More Capable Tool Calling
- Improve tool calling for Qwen and coding agents
- Reject generic tool calls; fail-closed if schema is invalid
- Allow disabling of parallel tool calls
🔒 Security, Reliability, and Bug Fixes
- Enable CFG for Foundry Local DLL
- Enable CPP SDK signing and versioning
- Allow removal of incomplete/corrupted model caches
- Fix telemetry teardown hang/crash
- Cancel non-streaming chat inference when clients disconnect
- Add NuGet proxy fallback for environments where we cannot pull packages from nuget.org
📥 Source Code
GitHub automatically includes source archives with the v2.2.1 release:
📚 Resources
💙 Feedback
File issues at https://github.com/microsoft/Foundry-Local/issues and include the SDK version, platform, and relevant diagnostics.
- cli-preview-0.12.1Foundry Local CLI 0.12.1 (Preview)pre-release2026-10-23 · 2026-10-23 08:33 UTC
查看更新说明
Public preview update for the Foundry Local CLI.
[!IMPORTANT] Preview. This is an early CLI build. Expect rough edges, missing polish, and changes between releases. Please file issues with
[cli]in the title and includefoundry reportoutput when possible.What's New
Updated Foundry Local SDK
This build updates the Foundry Local SDK and Runtime packages to
2.2.1, ONNX Runtime to 1.31.0 and ONNX Runtime GenAI 0.18.0.⚡ Improvements
- CUDA execution-provider download and registration on Linux ARM64.
- Lower CLI overhead for model operations, large image requests, download progress, and log inspection.
- Clearer presentation of typed errors
- Support BYOM models
- Add verbose inference stats
- Improve Responses lifecycle to optimize memory usage
🐛 Fixed
- Fix loading CUDA EP on Windows
[!NOTE] CUDA and cuDNN runtimes must be installed separately; Foundry Local does not download them.
- Windows/Linux x64: CUDA 12 and compatible cuDNN 9 runtimes.
- Windows/Linux ARM64: CUDA 13 and compatible cuDNN 9 runtimes.
On Windows, add the runtime DLL directories to
PATH. On Linux, configure the system library search path orLD_LIBRARY_PATH. After changing these settings, open a new terminal and runfoundry server restart.Install
Pick the asset for your platform from the downloads list below.
Platform Asset Windows x64 foundry-0.12.1-win-x64.msixWindows ARM64 foundry-0.12.1-win-arm64.msixmacOS Apple Silicon foundry-0.12.1-osx-arm64.pkgorfoundry-0.12.1-osx-arm64.zipLinux x64 foundry-0.12.1-linux-x64.tar.gzLinux ARM64 foundry-0.12.1-linux-arm64.tar.gz# Windows Add-AppxPackage .\foundry-0.12.1-win-x64-winml.msix foundry --version# macOS sudo installer -pkg foundry-0.12.1-osx-arm64.pkg -target / foundry --version# Linux tar xzf foundry-0.12.1-linux-x64.tar.gz cd foundry-0.12.1-linux-x64 ./lib/foundry --versionAll binaries are signed by Microsoft Corporation. SHA-256 digests are shown on the asset list above.
Quick Start
foundry status foundry model list foundry model load qwen3-0.6b foundry chat qwen3-0.6b foundry transcribe -m whisper-tiny -f audio.wav foundry server stopMost commands accept
--output jsonfor scripting. Runfoundry --helpfor the full command surface.Coming from the older Foundry Local CLI?
The earlier service-based CLI has been replaced. Common commands map roughly as follows:
Old service-based CLI New CLI foundry service start/stop/restart/ps/diagfoundry server start/stop/restart/logsfoundry model run <alias>foundry run <alias>Run
foundry --helpfor the full surface.Links
- Docs: https://aka.ms/foundry-local-docs
- SDK: https://github.com/microsoft/Foundry-Local/tree/main/sdk
- Discord: https://aka.ms/foundry-local-discord
- Issues: https://github.com/microsoft/Foundry-Local/issues
Feedback
File issues at https://github.com/microsoft/Foundry-Local/issues with
[cli]in the title and include the output offoundry report.
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Ship on-device AI inside your app
Foundry Local is an end-to-end local AI solution for building applications that run entirely on the user's device. It provides native SDKs (C, C++, C#, JavaScript, Python, and Rust), a curated catalog of optimized models, and automatic hardware acceleration — all in a lightweight package (~20 MB). The compact size makes it easy to integrate into your application and distribute to end users.
The runtime is implemented in C++ and exposes a stable C ABI that underpins the other language bindings. C and C++ applications can use it directly: the C API provides versioned function tables and opaque handles, while the C++ SDK provides a header-only C++17 wrapper with RAII resource management.
Conversations never leave the device, responses start immediately with zero network latency, and your app works offline. No per-token costs, no API keys, no backend infrastructure to maintain, and no Azure subscription required.
Foundry Local may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.
Key Features
-
Lightweight runtime — The runtime handles model acquisition, hardware acceleration, model management, and inference (via ONNX Runtime).
-
Curated model catalog — A catalog of high-quality models optimized for on-device use across a wide range of consumer hardware. The catalog covers chat completions (for example, GPT OSS, Qwen, DeepSeek, Mistral and Phi) and audio transcription (for example, Whisper). Every model goes through extensive quantization and compression to deliver the best balance of quality and performance. Models are versioned, so your application can pin to a specific version or automatically receive updates.
-
Automatic hardware acceleration — Foundry Local detects the available hardware on the user's device and selects the best execution provider and device (NPU, GPU or CPU).
-
Smart model management — Foundry Local handles the full lifecycle of models on end-user devices. Models download automatically on first use, are cached locally for instant subsequent launches, and the best-performing variant is selected for the user's specific hardware.
-
OpenAI-compatible API — Supports OpenAI request and response formats including the OpenAI Responses API format. If your application already uses the OpenAI SDK, point it to a Foundry Local endpoint with minimal code changes.
-
Optional local server — An OpenAI-compatible web server for serving models to multiple processes, integrating with tools like LangChain, or experimenting through REST calls. For most embedded application scenarios, use the SDK directly — it runs inference in-process without the overhead of a separate server.
🚀 Quickstart
[!TIP] The following shows a quickstart for Python and JavaScript. C, C++, C#, and Rust are also supported. Take a look at the samples for more details.
-
Install the SDK:
npm install --save-exact [email protected] -
Run your first chat completion:
import { ChatSession, FoundryLocalManager, Item, Request } from 'foundry-local-sdk'; const manager = FoundryLocalManager.create({ appName: 'foundry_local_samples' }); const model = await manager.catalog.getModel('qwen2.5-0.5b'); try { if (!model.isCached) await model.download(); await model.load(); try { const session = new ChatSession(model); try { const request = new Request().addItem( Item.userMessage('What is the golden ratio?') ); for await (const item of session.processStreamingRequest(request)) { if (item.type === 'text') process.stdout.write(item.text); } } finally { session.dispose(); } } finally { await model.unload(); } } finally { manager.dispose(); }
-
Install the SDK:
pip install foundry-local-sdk==2.2.1 -
Run your first chat completion:
from foundry_local_sdk import ( ChatSession, Configuration, FoundryLocalManager, MessageItem, Request, ) with FoundryLocalManager(Configuration(app_name="foundry_local_samples")) as manager: ep_result = manager.download_and_register_eps() if not ep_result.success: raise RuntimeError(f"EP registration failed: {ep_result.failed_eps}") model = manager.catalog.get_model("qwen2.5-0.5b") if model is None: raise RuntimeError("Model not found") if not model.is_cached: model.download() model.load() try: with ChatSession(model) as session: with Request().add_item(MessageItem.user("What is the golden ratio?")) as request: with session.process_request(request) as response: for item in response: if isinstance(item, MessageItem): print(item.get_simple_text()) finally: model.unload()
💬 Audio Transcription (Speech-to-Text)
The SDK also supports native audio transcription in C, C++, C#, JavaScript, Python, and Rust. See the
realtime-transcription samples and the
Foundry Local get-started documentation.
📦 Samples
Explore complete working examples in the samples/ folder:
| Language | Samples | Highlights |
|---|---|---|
| C++ | 7 | Hello world, real-time transcription, embeddings, tool calling, web server, vision, and BYOM |
| C# | 7 | Hello world, real-time transcription, embeddings, tool calling, web server, vision, and BYOM |
| JavaScript | 7 | Hello world, real-time transcription, embeddings, tool calling, web server, vision, and BYOM |
| Python | 7 | Hello world, real-time transcription, embeddings, tool calling, web server, vision, and BYOM |
| Rust | 7 | Hello world, real-time transcription, embeddings, tool calling, web server, vision, and BYOM |
C developers can use the C API guide and public C header to integrate the same runtime directly.
🖥️ CLI
The Foundry Local CLI lets you explore models and experiment interactively.
Install (public preview):
Download the asset for your platform from the cli-preview-0.11.0 GitHub release.
Run a model:
foundry run qwen2.5-0.5b
List available models:
foundry model list
For the full CLI reference and advanced usage, see the CLI documentation on Microsoft Learn.
Reporting Issues
Please report issues or suggest improvements in the GitHub Issues section.
🎓 Learn More
- Foundry Local Documentation on Microsoft Learn
- Foundry Local Lab — Hands-on exercises and step-by-step instructions
❔ Frequently asked questions
Can inference be cancelled?
Inference cancellation is cooperative. Low-level requests can be cancelled with Request.Cancel(), while streaming APIs provide language-specific cancellation mechanisms. Cancellation may not take effect until the current generation step completes, and inference requests do not currently have a built-in timeout.
Is Foundry Local a web server and CLI tool?
No. Foundry Local is an end-to-end local AI solution that your application ships with. It handles model acquisition, hardware acceleration, and inference inside your app process through the SDK. The optional web server and CLI are available for development workflows, but the core product is the local AI runtime and SDK that you integrate directly into your application.
Why doesn't Foundry Local support every available model?
Foundry Local is designed for shipping production applications, not for general-purpose model experimentation. The model catalog is intentionally curated to include models that are optimized for specific application scenarios, tested across a range of consumer hardware, and small enough to distribute to end users. This approach ensures that every model in the catalog delivers reliable performance when embedded in your application — rather than offering a broad selection of models with unpredictable on-device behavior.
Can Foundry Local run on a server?
Foundry Local is optimized for hardware-constrained devices where a single user accesses the model at a time. While you can technically install and run it on server hardware, it isn't designed as a server inference stack.
Server-oriented runtimes like vLLM or Triton Inference Server are built for multi-user scenarios — they handle concurrent request queuing, continuous batching, and efficient GPU sharing across many simultaneous clients. Foundry Local doesn't provide these capabilities. Instead, it focuses on lightweight, single-user inference with automatic hardware detection, KV-cache management, and model lifecycle handling that make sense for client applications.
If you need to serve models to multiple concurrent users, use a dedicated server inference framework. Use Foundry Local when the model runs on the end user's own device.
What platforms are supported?
Foundry Local supports Windows, macOS (Apple silicon), and Linux.
⚖️ License
Foundry Local SDK is licensed under the MIT license. For more details, see the LICENSE file. Foundry Local CLI is licensed under the Microsoft Software License Terms. For more details, read the LICENSE file.
Individual models made available for use with Foundry Local are subject to the each model's license terms, notices, and use restrictions. Refer to the model's documentation or download/listing page for the applicable terms before using or redistributing a model.