LocalHost AIChat and code with your local LLMs. Private, offline, zero config. Use local models from Ollama, LM Studio, or any OpenAI-compatible server directly inside VS Code. Everything stays on Get started
The Get started with LocalHost AI walkthrough (Help → Welcome, or Welcome: Open Walkthrough…) goes through servers, models, chat, the agent, autocomplete and project rules step by step.
FeaturesChat panelOpen the LocalHost AI icon in the Activity Bar (or
|
| Tool | Runs | What it does |
|---|---|---|
list_files, read_file, search_text |
automatically | Explore the workspace (sensitive files such as .env and keys are blocked). |
edit_file, write_file |
after you approve | Shows the change as a diff in the chat — Apply, Reject, or Open Diff in the editor. |
run_command |
after you approve | Runs a command in your shell in the workspace root and returns the output (builds, tests, linters). |
get_diagnostics, find_symbols |
automatically | Read errors and warnings from the Problems panel, and find classes and functions by name. |
codebase_search |
automatically | Searches the @codebase index by meaning (only when an index exists). |
rename_symbol |
after you approve | Renames a symbol across files with the language server. |
delete_file |
always asks | Moves a file to the trash. |
Approved commands run in a visible LocalHost AI Agent terminal (VS Code's shell integration), so you can watch them and answer prompts; the output and exit code go back to the model. Without shell integration, or with localhostAI.agent.runInTerminal off, they run in a hidden process.
MCP tools
Give the agent more tools with Model Context Protocol servers: databases, browsers, issue trackers, and more. Add them to your user settings:
"localhostAI.mcp.servers": {
"filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "."] },
"issues": { "url": "https://mcp.example.com/mcp", "headers": { "Authorization": "Bearer <token>" } },
"time": { "command": "uvx", "args": ["mcp-server-time"], "autoApprove": ["get_current_time"] }
}
Local programs (stdio) and remote servers (streamable HTTP) are supported. Each call shows the tool and its arguments and waits for your approval, unless the tool is listed in autoApprove. LocalHost AI: Show MCP Servers shows each server's status and tools. Servers only run in trusted workspaces, and only from user settings, so a cloned repository can never start a program.
Every turn that changes files ends with Changed N files · Undo. Undo restores those files, and any changed by later turns, to how they were before the turn.
The agent can only touch files inside the open workspace folder. It needs a model with tool calling (see Which models work). If the selected model can't use tools, a notice above the input says so before you send, with a button to switch to the best installed tool-capable model or to Ask mode. Tool calls that local models write as text (<tool_call>, <tools>, or bare JSON) are recognized too.
Inline chat
Press Ctrl+Alt+E (Cmd+Alt+E on macOS) in the editor, describe a change, and review it as a diff. With a selection it rewrites the selection; without one it inserts code at the cursor. Discarded changes can be refined and regenerated.
Editor actions (right-click menu, lightbulb, or Command Palette)
| Command | What it does |
|---|---|
| Explain Selection | Streams an explanation into a Markdown pane beside your code (whole file if nothing is selected). |
| Refactor Selection | Rewrites the selection, shown as a diff you Apply or Discard. |
| Add Docstring | Adds idiomatic doc comments to the selection, with diff preview. |
| Fix Problems | Fixes the errors/warnings at the cursor or in the selection, using the editor's diagnostics. Also offered as Fix with LocalHost AI in the lightbulb (Ctrl+.). Rewrites the enclosing function when one exists so real fixes have room. |
| Generate Unit Tests | Writes tests for the selection or file into a new editor, using the framework your project already uses (Vitest, Jest, Mocha, pytest, …). |
| Generate Commit Message | ✨ button in the Source Control view. Streams a message for your staged changes (or all changes if nothing is staged) into the commit box, matching your repository's recent commit style. |
| Run Custom Prompt... | Runs one of your own prompt templates (see below). |
Every generated edit opens as a side-by-side diff first. Apply it from the notification or the ✓ / discard buttons in the diff editor's title bar. Turn this off with localhostAI.previewEdits.
@localhost chat
| Command | What it does |
|---|---|
/explain |
Explain the selected code or active file. |
/refactor, /docstring, /fix |
Suggest a change; click Apply to Selection to review it as a diff and apply it. /fix includes the editor's reported problems. |
/tests |
Generate unit tests; click Open in New Editor. |
/commit |
Write a commit message for the staged changes; click Use as Commit Message. |
/new |
Create a new file from a description. |
/prompt <name> [input] |
Run a custom prompt template. |
Chat honours #file and #selection references and keeps conversation history within the context budget.
Your local models in VS Code's model picker
On VS Code 1.104+, discovered models are also offered in VS Code's built-in Chat model picker (vendor LocalHost AI), so other chat features and extensions using vscode.lm can use them. Models with tool calling work in Copilot Chat's agent mode, and vision models accept images. Disable with localhostAI.languageModelProvider.enabled.
Inline completions
Opt-in fill-in-the-middle completions. Toggle them from the $(sparkle) Inline status bar item or LocalHost AI: Toggle Inline Completions.
Completions use their own model, so a big chat model never slows typing: by default the best small installed model that supports fill-in-the-middle (for example ollama pull qwen2.5-coder:1.5b), or the one you choose with LocalHost AI: Select Autocomplete Model. They also see related code from recently used files of the same language (localhostAI.inlineCompletions.crossFileContext).
Next-edit suggestions
Turn on localhostAI.nextEdit.enabled (or run LocalHost AI: Toggle Next-Edit Suggestions). After you pause editing, the model predicts your follow-up edit, such as the other uses of a variable you just renamed, and shows it on those lines. Press Tab to apply it or Esc to dismiss it. A fast, non-thinking coder model works best; pick one with localhostAI.nextEdit.model.
Usage statistics
LocalHost AI: Show Usage Statistics shows requests, tokens, model time, and accepted completions and edits for the last 7, 30 or 90 days, per day and per model. The numbers are kept only in VS Code's storage on your computer and are never sent anywhere. Turn them off with localhostAI.usageStats.enabled.
Languages
All commands, settings and notifications can be translated: the manifest strings are in package.nls.json and runtime messages in l10n/bundle.l10n.json. To add a language, copy them to package.nls.<locale>.json and l10n/bundle.l10n.<locale>.json and translate the values. Contributions are welcome.
Custom prompts
"localhostAI.customPrompts": [
{ "name": "review", "description": "Code review", "prompt": "Review this ${language} code for bugs and risky patterns:
${selection}" },
{ "name": "ts2py", "mode": "newFile", "prompt": "Port this TypeScript to idiomatic Python:
${selection}" },
{ "name": "translate-comments", "mode": "replace", "prompt": "Translate the comments in this code to ${input}. Return only the code.
${selection}" }
]
Placeholders: ${selection}, ${file}, ${fileName}, ${language}, ${input} (prompts you, or takes the text after the name in /prompt). Modes: markdown (default, answer beside the editor), replace (replaces the selection via diff preview), newFile.
Quick Start
- Install a local model runner:
- Ollama: Install Ollama and pull a 7B coding model:
ollama pull qwen2.5-coder:7b ollama serve - LM Studio: Open LM Studio, download a model (such as
qwen2.5-coder-7b-instruct), start the Local Server on port1234, and load the model.
- Ollama: Install Ollama and pull a 7B coding model:
- Install LocalHost AI in VS Code (or VSCodium / Open VSX).
- Start coding: Click the status bar item (
LocalHost AI) at the bottom-right to switch models, or open the Chat view and type@localhost.
Supported Servers
| Server | Default Base URL | Notes |
|---|---|---|
| Ollama | http://localhost:11434/v1 |
Uses Ollama's OpenAI-compatible /v1 API. |
| LM Studio | http://localhost:1234/v1 |
Ensure a model is loaded in LM Studio's Local Server tab. |
| Custom OpenAI-Compatible | (disabled by default) | Works with llama.cpp server, vLLM, LocalAI, etc. Set localhostAI.customServerUrl. |
Which models work
LocalHost AI asks each server what every model can do: Ollama's /api/show capabilities and /api/ps, and LM Studio's /api/v0/models. For custom servers it guesses from the model name. What it learns from errors (for example "does not support tools") is remembered for the session.
| Model family | Ask mode | Agent mode (tools) | Notes |
|---|---|---|---|
| qwen2.5-coder, qwen3-coder | ✅ | ✅ native | Best default for coding. |
| qwen3, qwen3.5 | ✅ | ✅ native | Thinking models; reasoning is folded away. |
| llama3.1 / 3.2 / 3.3, mistral, ministral, granite3, gpt-oss | ✅ | ✅ native | |
| gemma3, qwen2.5vl, llava, codellama | ✅ | ❌ | Ollama rejects tool requests ("does not support tools"). Use Ask mode. |
| LM Studio models without "tool_use" | ✅ | ⚠️ via text | LocalHost AI reads tool calls the model writes as text; results vary. |
| Embedding models (bge-m3, nomic-embed-text, mxbai-embed-large) | ❌ | ❌ | Hidden from the model pickers. |
Context window: Ollama allocates a model's context when it loads it (often 4096 tokens, set by OLLAMA_CONTEXT_LENGTH or the model's num_ctx), and silently drops anything beyond it. With localhostAI.autoDetectContextLength on (the default), LocalHost AI reads the loaded size and never sends more. To give models more room, start Ollama with, for example, OLLAMA_CONTEXT_LENGTH=16384.
Settings
| Setting | Default | Description |
|---|---|---|
localhostAI.ollamaUrl |
http://localhost:11434/v1 |
Ollama OpenAI-compatible base URL (empty to disable). |
localhostAI.lmStudioUrl |
http://localhost:1234/v1 |
LM Studio OpenAI-compatible base URL (empty to disable). |
localhostAI.customServerName |
Custom |
Display label for the custom server. |
localhostAI.customServerUrl |
"" |
Optional base URL for a third OpenAI-compatible server. |
localhostAI.customServerApiKey |
"" |
Deprecated. Plain-text Bearer token for customServerUrl. Prefer LocalHost AI: Set Custom Server API Key (Secure), which stores it in your OS keychain. |
localhostAI.temperature |
0.2 |
Default sampling temperature (0–2). |
localhostAI.contextLength |
8192 |
Token budget used to trim chat history and file context. |
localhostAI.autoDetectContextLength |
true |
Read each model's context window from Ollama / LM Studio and cap contextLength to it (never raises it). |
localhostAI.maxResponseTokens |
1024 |
Maximum response tokens per generation. |
localhostAI.systemPrompt |
(coding assistant prompt) | Default system prompt sent to local models. |
localhostAI.modelOverrides |
{} |
Per-model overrides keyed by "modelId" or "provider:modelId". |
localhostAI.discoveryTimeoutMs |
1500 |
Startup probe timeout per server in milliseconds. |
localhostAI.requestTimeoutMs |
60000 |
Request timeout in milliseconds for generation. |
localhostAI.inlineCompletions.enabled |
false |
Opt-in Fill-In-The-Middle inline completions. |
localhostAI.inlineCompletions.debounceMs |
400 |
Debounce delay before requesting inline completions. |
localhostAI.inlineCompletions.maxTokens |
128 |
Max tokens for each inline completion. |
localhostAI.inlineCompletions.model |
"" |
Model for inline completions (empty = best installed FIM model). |
localhostAI.inlineCompletions.crossFileContext |
true |
Add related code from recently used files to inline completions. |
localhostAI.nextEdit.enabled |
false |
Predict and suggest your next edit after a pause. |
localhostAI.nextEdit.model |
"" |
Model for next-edit suggestions (empty = the chat model). |
localhostAI.nextEdit.debounceMs |
800 |
Pause before asking for a next-edit suggestion. |
localhostAI.previewEdits |
true |
Show a diff and ask before applying generated edits. |
localhostAI.customPrompts |
[] |
Reusable prompt templates (see above). |
localhostAI.languageModelProvider.enabled |
true |
Offer local models in VS Code's Chat model picker (VS Code 1.104+). |
localhostAI.agent.autoApproveEdits |
false |
Agent mode: apply edits without asking. |
localhostAI.agent.autoApproveCommands |
false |
Agent mode: run commands without asking (not recommended). |
localhostAI.agent.maxSteps |
20 |
Agent mode: maximum model/tool round trips per request. |
localhostAI.agent.commandTimeoutMs |
120000 |
Agent mode: timeout per approved command. |
localhostAI.agent.runInTerminal |
true |
Agent mode: run commands in a visible terminal. |
localhostAI.mcp.enabled |
true |
Offer tools from MCP servers in Agent mode. |
localhostAI.mcp.servers |
{} |
MCP servers by name (command/args/env or url/headers, plus autoApprove, disabled). |
localhostAI.usageStats.enabled |
true |
Keep local usage statistics (never sent anywhere). |
localhostAI.projectRules.enabled |
true |
Add AGENTS.md and .localhostai/rules to every request. |
localhostAI.projectRules.maxChars |
6000 |
Most characters of project rules added to the prompt. |
localhostAI.codebase.embeddingModel |
"" |
Embedding model for @codebase (empty = best installed). |
localhostAI.codebase.maxFiles |
3000 |
Most files indexed per workspace folder. |
localhostAI.codebase.topK |
8 |
Code chunks added per @codebase search. |
Per-Model Overrides Example
"localhostAI.modelOverrides": {
"ollama:qwen2.5-coder:7b": {
"temperature": 0.15,
"contextLength": 8192,
"maxResponseTokens": 1024,
"systemPrompt": "Be concise. Return idiomatic TypeScript."
}
}
Privacy Statement
- 100% local by default: LocalHost AI sends requests only to the server URLs you configure (
http://localhost:11434/v1,http://localhost:1234/v1, or your custom URL). - Zero telemetry: No analytics, no crash reporting, no usage tracking, and no third-party cloud API calls.
- Background context guardrails: Automatic open-file context and custom-prompt placeholders skip
.env*,*.pem,*.key, andid_rsafiles. Files you explicitly attach with#fileare sent as you asked. - Secrets stay in the keychain: The custom server API key can be stored with VS Code SecretStorage instead of
settings.json. - Codebase index stays local:
@codebaseembeds your code with your own local server and stores the index in VS Code's workspace storage. LocalHost AI: Clear Codebase Index deletes it. - Agent guardrails: Agent tools are confined to the open workspace folder, never read
.env/key files, and every edit and command waits for your approval unless you turn on auto-approve. - Usage statistics stay local: the usage panel reads counters kept in VS Code's storage on this computer. There is no telemetry.
- MCP servers are yours: they are configured only in user settings, run only in trusted workspaces, and every tool call asks first unless you auto-approve it. Remote MCP servers receive whatever arguments the agent sends them.
- Images stay in memory: pasted images are sent only to your local model and are not saved with chat history.
- Same hosts only: Context-window detection calls the same configured Ollama / LM Studio hosts (
/api/show,/api/v0/models). Commit messages read your diff through VS Code's built-in Git extension and send it only to your local model.
Troubleshooting
- Server offline: Confirm Ollama (
ollama serve) or LM Studio's Local Server is running, then run LocalHost AI: Check Server Status from the Command Palette. - No models found: Run
ollama pull qwen2.5-coder:7b(for Ollama) or download a model in LM Studio, then click Refresh servers and models in the model picker. - Model not loaded (LM Studio): LM Studio requires loading a model in the Local Server view before
/v1/chat/completionsaccepts requests. - Timeouts on consumer hardware: Large files or long prompts can slow down 7B quantized models on CPU/low-VRAM GPUs. Lower
localhostAI.contextLength(e.g., to4096) or raiselocalhostAI.requestTimeoutMs. - "does not support tools": the model has no tool calling, so Agent mode can't use it. Click Use on the error card to switch to a tool-capable model and retry, or Use Ask mode.
- "does not support chat": an embedding model was selected. Pick a chat model; embedding models are now hidden from the pickers.
- Answers ignore earlier context: the model's loaded context window is smaller than the conversation. Start a new chat, or raise Ollama's context (
OLLAMA_CONTEXT_LENGTH). - Not enough memory: the server could not load the model. Pick a smaller model or a lower quantization.
@codebasesays no embedding model: runollama pull nomic-embed-text(or load an embedding model in LM Studio), then LocalHost AI: Index Codebase for @codebase.- Inspect logs: Run LocalHost AI: Show Output Log to open the
LocalHost AIoutput channel. For more detail, such as MCP server output, choose Debug in the channel's log-level menu or run Developer: Set Log Level….
Trademark Notice
LocalHost AI is an independent project, not affiliated with or endorsed by Ollama or LM Studio. Mention them only to describe compatibility.
License
Building a Release
npm run package
Writes release/localhost-ai-<version>.vsix. The release/ folder keeps every packaged version locally and is not committed to Git.