Component brief / Infrastructure

Foundry Local lets your application run AI on the user's computer.

Published
Updated
Last verified
Reading time
4 minutes
Topics
foundry-local / local-ai / ai-applications

What it is

Foundry Local ships inside your application. Microsoft provides libraries for C#, C++, JavaScript, Python and Rust. These libraries, also called SDKs, let your code use Foundry Local. Its model catalogue includes models for chat and for turning speech into text. The documented platforms are Windows, Linux and macOS on Apple silicon.

Foundry Local chooses how to run the model on the available hardware. It can use suitable graphics or AI chips to speed up the work, or use the computer's main processor. It also keeps downloaded models on disk and lets your app load them into memory or release that memory when finished.

Your app can call the library directly. If another program needs to send requests to it, Foundry Local can also provide an optional local web address that accepts requests in an OpenAI-compatible format.

Where it fits

A user asks for a summary. The app sends text to Foundry Local, a downloaded model runs on the user’s computer, and the app displays its answer.

Foundry Local handles running the model. Your app still chooses which text to send, remembers any conversation and checks what to do with the answer. For example, generating a suggested email reply does not give the model permission to send that email. Your app controls that action.

My assessment: it is most useful when AI should be a built-in feature of a desktop app, with the app managing the model download and setup.

When to use it

Consider it for document summaries, an assistant inside your app or turning recordings into text. Choose a model that can do the job well on the computers your users have. Microsoft says prompts and answers are processed locally, without requiring an Azure subscription.

Set it up before going offline. The first use may require downloading both the model and supporting software for the computer's hardware. For example, let the user finish the downloads while online, then check that the summary button still works with the internet disconnected.

Trade-offs

  • Speed and memory: a model that runs well on your development computer may be slow on a user's laptop. Test startup time, long documents and computers without a suitable graphics or AI chip.
  • Model choice: start with the supplied catalogue. You cannot assume that any model downloaded elsewhere will work. Other models may need conversion into the supported ONNX format.
  • Download size: the software that runs the model is only part of the download. The model files and supporting software also take disk space. Show users what they need to download before starting.
  • Licences and network use: the JavaScript library uses the MIT licence. Microsoft says use is governed by the terms for the software and for each model, and that those terms describe any diagnostic data Microsoft may collect. Check them before you ship. Running the AI locally does not mean every download or diagnostic operation stays offline.

Microsoft positions Foundry Local for individual devices. If you need one central AI service to answer many users at once, look at software designed for servers.

Alternatives

Ollama also runs AI locally. Your app sends requests to a separate local service. Compare it with Foundry Local if that arrangement suits your app; Foundry Local also lets you call the model directly through its library.

For a central service used by many people at once, Microsoft points to vLLM and Triton.

Integration example

This JavaScript example follows the quickstart. It downloads the supporting software for the computer's hardware and a small model, asks the model to summarise two sentences and prints the answer. Install foundry-local-sdk and save the code as summarise.mjs for Node.js 20 or later:

import { ChatSession, FoundryLocalManager, Item, Request } from 'foundry-local-sdk';

const manager = FoundryLocalManager.create({ appName: 'local-summary' });
await manager.downloadAndRegisterEps();
const model = await manager.catalog.getModel('qwen2.5-0.5b');
await model.download();
await model.load();
const chat = new ChatSession(model);
try {
    const request = new Request().addItem(
        Item.userMessage('Summarise: The nightly backup failed. A retry succeeded.')
    );
    const response = await chat.processRequest(request);
    for (const item of response.output) {
        if (item.type === 'message') console.log(item.content);
        if (item.type === 'text' && item.textType === 'default') console.log(item.text);
    }
} finally {
    chat.dispose();
    await model.unload();
}

The small model keeps the example simple, but it may not do the job. In a test run on 30 November 2026, it asked for more context instead of writing a summary. Test whether a model's answers are good enough for your app, and choose specific library and model versions before releasing it.

Correction, 30 November 2026: The example now uses ChatSession, because version 2.5.0 of the library deprecates createChatClient for removal at the end of 2026. Microsoft's Foundry Local repository is no longer available, so the library languages and licence terms are now sourced from Microsoft Learn and the npm package. The library list now includes C++. The illustrative sample answer was replaced with the result of a test run.

AI Disclosure

Researched and drafted with AI assistance, then reviewed by Søren Dalby. Sources are linked; errors may remain, and corrections are welcome.

Sources