RW
Rafał Warzycha

Foundry Local Chat — bringing local models into VS Code's chat picker

Source code — https://github.com/senssei/vscode-foundry-local

I run Foundry Local for the obvious reasons: no cloud round-trip, no API key, no per-token bill. What I didn’t have was a way to use those downloaded models from VS Code chat — Copilot’s BYOK option wants a fixed endpoint, and the Foundry CLI daemon binds a fresh random port every time it starts. So I built the extension.

OLYMPUS DIGITAL CAMERA Photo by Anton Sobotyak / Unsplash

What it does

Adds your locally-downloaded models to VS Code’s chat model picker. No cloud, no API key — prompts never leave the machine. Works with both the foundry CLI and the AI Toolkit (same /v1 API, discovered independently, shown as separate groups in the picker).

Install

npm install
npm run package
code --install-extension foundry-local-chat-provider-0.1.0.vsix

Reload the window. The Toolkit group is picked up separately — it just probes http://127.0.0.1:5272 / http://localhost:5272, so its server needs to be running first.

Getting a model

foundry model download qwen2.5-0.5b

Only downloaded chat models show up — Whisper and embedding models are filtered out.

Settings

machine-scoped on purpose, so a cloned repo can’t repoint the endpoint or executable:

Setting Default
foundryLocal.endpoint (auto)
foundryLocal.cliPath (PATH)
foundryLocal.maxInputTokens 8192
foundryLocal.maxOutputTokens 4096

The picker shows 12K context by default, since VS Code just sums input + output.

The interesting bit

The published REST reference documents an older server than CLI 0.10.3 actually runs. Only /v1/* and /status exist, so catalog/downloads/loading all go through the CLI, not HTTP. And asking for a model that isn’t loaded returns 200, an empty stream, then a dropped socket — no error at all. The extension reads that as “not loaded,” triggers a load, and retries once.

Also: the daemon binds a new random port on every start, which is the whole reason this exists instead of Copilot’s BYOK. Pin the port and use one model, and BYOK alone is enough.

Platform notes

Not there yet

Image input, embeddings/transcription, real per-model context lengths, and tool calling verified against anything bigger than a 0.5B model.

MIT licensed, not affiliated with Microsoft.

Comments