AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Connecting Pieces Copilot with Custom Local LLMs in Offline Development Environments

Carmen Gracia Santos · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

In air-gapped networks, classified labs, and offshore development rigs, cloud-dependent AI copilots are outright liabilities. The promise of Pieces—an on-device, context-aware developer engine—sounds like an immediate fix. Yet configuring Pieces Copilot to drive custom local Large Language Models (LLMs) completely offline often confronts engineers with unexpected architectural quirks.

At 365Finds, we look past glossy marketing claims to see how developer tools behave under strict operational isolation. Many developers assume Pieces offers a simple "Custom Base URL" input box where you can plug in http://localhost:11434/v1 and walk away. That is not how Pieces operates. Pieces OS functions as a deep local-first platform with its own embedded runtime history, context cache, and recent architectural pivot toward agentic workflows.

Understanding how to connect Pieces with custom local models offline requires knowing what the platform handles natively, what has changed, and how to configure the stack so your code never touches the internet.


The Core Architecture: Pieces OS vs. Local Model Runtimes

To work effectively offline, you must understand the distinction between Pieces OS and your LLM runtime.

  1. Pieces OS (localhost:1000 on Windows/macOS, localhost:5323 on Linux): The background daemon that indexes your workspace, tracks temporal code interactions through Long-Term Memory (LTM), and provides on-device RAG (Retrieval-Augmented Generation).
  2. The Copilot Interface: The chat surface embedded inside the Pieces Desktop app or IDE extensions (VS Code, JetBrains).
  3. The Local Inference Engine: The runtime executing the neural network weights—traditionally an embedded Ollama daemon managed internally by Pieces OS, or an external standalone server (such as Ollama, LM Studio, or vLLM).

In recent releases, Pieces restructured its Copilot pipeline to prioritize multi-step agentic capabilities. During this transition, native local model selection within the GUI has seen fluctuations, leading the Pieces engineering team to temporarily pause managed local Ollama selectors in specific desktop builds while re-engineering local multi-step orchestration.

For engineers operating in air-gapped environments, 365Finds recommends two distinct operational paths depending on whether you rely on built-in runtimes or run external custom models.


Phase 1: Pre-Staging Models for the Air-Gap

In an offline environment, neither Pieces nor local inference engines can download model weights dynamically. All assets must be staged on a connected machine and transferred across the perimeter.

1. Staging Ollama Blobs (External Local Model Setup)

If you run custom models via standalone Ollama on your air-gapped machine:

  1. On an internet-connected staging machine, pull the target model and a local embedding model:
    ollama pull qwen2.5-coder:7b
    ollama pull nomic-embed-text
    
  2. Archive the Ollama models directory:
    • Linux: ~/.ollama/models or /usr/share/ollama/.ollama/models
    • macOS: ~/.ollama/models
    • Windows: C:\Users\<Username>\.ollama\models
  3. Transfer the archive to the offline system via approved media (e.g., encrypted drive) and extract it to the identical path.
  4. Set the environment variable if using a non-default path:
    export OLLAMA_MODELS=/opt/local-ai/models
    ollama serve
    

2. Staging Pieces OS Local Models

If your deployed version of Pieces OS supports managed on-device Small Language Models (SLMs):


Method 1: The Native Runtime Switch (When Local SLMs Are Enabled)

If you are using a Pieces build that provides the integrated local model selector:

  1. Launch Pieces OS, followed by the Pieces Desktop App or your IDE extension.
  2. Open the Copilot Chat pane.
  3. Locate the Active Model indicator in the lower-left corner of the chat input area (defaulting to cloud options like GPT-4o or Gemini).
  4. Click Change Model to open the Manage Copilot Runtime modal.
  5. Filter by on-device models (indicated by a monitor or desktop badge).
  6. Select an installed local model (e.g., local Llama or Mistral variants).
+-------------------------------------------------------+
|  Copilot Chat View                                    |
|                                                       |
|  [User Prompt Input Area...]                          |
|                                                       |
|  +---------------------+                              |
|  | [*] Llama-3-8B-Local|  <-- Click to switch runtime |
|  +---------------------+                              |
+-------------------------------------------------------+

Operational Watchpoint:

Running local 7B+ parameter models on-device requires substantial hardware resources. 365Finds recommends at least 32GB of unified memory on Apple Silicon, or an NVIDIA GPU with a minimum of 8GB–12GB VRAM. If Pieces OS offloads to CPU-only inference in an isolated VM, response latency often degrades severely.


Method 2: The Architectural Inversion via Pieces MCP Server (365Finds Recommended)

When custom enterprise models (fine-tuned internal LLMs or bespoke Qwen/DeepSeek checkpoints) must run offline, forcing them through Pieces Copilot's proprietary chat interface is often the wrong approach.

365Finds strongly advocates inverting the pipeline: treat Pieces OS as your Air-Gapped Context Engine & Model Context Protocol (MCP) Server, while letting dedicated local frontends (Cursor, Continue.dev in VS Code) query your custom offline LLM.

Pieces OS automatically hosts a local MCP server, exposing workspace context, snippets, and Long-Term Memory over a local port without touching the internet.

Configuration Steps:

  1. Verify Pieces MCP Server Status:

    • Open the PiecesOS Quick Menu from the system tray/toolbar.
    • Expand Model Context Protocol (MCP) Servers.
    • Note the local Server-Sent Events (SSE) endpoint (typically running on http://localhost:39300/model-context-protocol/sse).
  2. Run Your Custom LLM via Ollama: Launch your custom model on the local network interface:

    OLLAMA_HOST=127.0.0.1:11434 ollama serve
    
  3. Configure Your Offline Editor Client (e.g., Continue.dev in VS Code): In your air-gapped IDE, configure your client configuration (config.json) to bridge the custom model with Pieces MCP:

    {
      "models": [
        {
          "title": "Custom Offline Coder",
          "provider": "ollama",
          "model": "qwen2.5-coder:7b",
          "apiBase": "http://127.0.0.1:11434"
        }
      ],
      "experimental": {
        "modelContextProtocolServers": [
          {
            "transport": {
              "type": "sse",
              "url": "http://localhost:39300/model-context-protocol/sse"
            }
          }
        ]
      }
    }
    

Why 365Finds Favors This Pattern:


Method 3: Programmatic Copilot Integration via Pieces SDKs

For specialized air-gapped development benches that require direct scripting, Pieces provides local client SDKs (Python, TypeScript) that connect directly to the Pieces OS daemon.

On Windows/macOS, point your client to http://localhost:1000; on Linux, use http://localhost:5323.

from pieces_os_client.wrapper import PiecesClient

# Initialize client against the local Pieces OS instance
pieces_client = PiecesClient(host="http://localhost:1000")

# Stream contextual code queries through the local daemon
question = "Review this local SQL migration for index anomalies."
for chunk in pieces_client.copilot.stream_question(question):
    if chunk.question and chunk.question.answers:
        for answer in chunk.question.answers.iterable:
            print(answer.text, end="")

pieces_client.close()

If you manage an offline pipeline, this programmatic approach allows automated scripts to pull context-rich snippet data from Pieces while passing prompts directly to an isolated vLLM instance.


Managing Port Collisions and System Constraints

In isolated environments, troubleshooting network sockets is critical:

ServiceDefault PortCommon Offline ConflictResolution
Pieces OS Core1000 (Win/macOS), 5323 (Linux)Local container or web proxy bindingCheck port availability using netstat -an or lsof -i :1000
Pieces MCP Server39300Port collision with ephemeral rangeVerify active port in PiecesOS system tray menu
External Ollama11434Pieces OS legacy daemon attempting to bind 11434Launch Ollama with custom port: OLLAMA_HOST=127.0.0.1:11435

If Pieces OS cannot reach its local services or if the Copilot interface stalls in an offline session, check that your system's local loopback interface (127.0.0.1 / localhost) is not blocked by overzealous endpoint detection and response (EDR) software or restrictive local firewall rules.

References