Phase
Get LUCID
Browse documentation
Docs / Getting Started

Connect Open WebUI, Pi, OpenCode, Hermes & MCP

LUCID speaks both the Ollama API (/api/*) and the OpenAI Chat Completions API (/v1/chat/completions, /v1/models) on your machine, with full native tool calling across local GPUs, multi-GPU sharded clusters, and invited Trusted Circle peers. Use LUCID Desktop's built-in Tools & Skills Hub (powered by the MCP 2026-07-28 dual-era engine, Web Browser MCP auto-launcher, Tor .onion search, and /slash skills—see Built-in Tools, Skills, and Visual MCP) or plug in any external chat UI or autonomous agent below—everything stays private on 127.0.0.1.

Tip

Which port should I use?

  • LUCID Desktop app: http://127.0.0.1:11435 (click Copy API Address in the model pane to verify the active port)
  • Standalone lucidd CLI: http://127.0.0.1:11434

1. Set your context window for coding agents#

Before wiring up a coding agent, open LUCID Desktop → Settings & Safety → Context Window and switch from 8K (Default) to 32K (Coding). LUCID restarts its local engine automatically so system prompts, file reads, and multi-step tool histories fit comfortably without truncation.

If you run lucidd from the command line, pass --llama-ctx-size 32768. See Context window sizing and memory headroom for 64K–256K RAM/VRAM guidance.

2. Open WebUI (native tool calling out of the box)#

Open WebUI works directly with LUCID using native tool calling—you do not need to switch Open WebUI to Legacy tool mode.

  1. Open Open WebUI → Admin Panel → Settings → Connections → Ollama API.
  2. Set the Ollama base URL:
    • Open WebUI installed natively: http://127.0.0.1:11435 (or :11434 for CLI lucidd).
    • Open WebUI running in Docker: http://host.docker.internal:11435 (or :11434 for CLI lucidd). LUCID allows Host: host.docker.internal on the Ollama and OpenAI APIs while keeping the private /api/lucid/* control API strictly loopback-only.
  3. Click Verify Connection. Your local and invited circle models appear immediately (served from LUCID's startup cache without blocking).
  4. Optional: paste your Open WebUI URL into LUCID Desktop → Settings & Safety → Chat App URL (Open WebUI) so you can launch it in one click from the model pane.

Open WebUI v0.12.3+ features—including native tools / tool_choice, think flags, conversation history thinking fields, and presence_penalty / frequency_penalty—are handled cleanly on both /api/chat and /v1/chat/completions.

Note

Per-client reply length (num_predict / max_tokens): Each client sends its own output limit differently—LUCID Desktop sends 4096, Pi/OpenCode configure maxTokens per model, and Open WebUI omits num_predict by default. Whenever a client omits a token cap, LUCID defaults to 4096 tokens (rather than llama.cpp's unbounded default or a tiny 512-token cutoff), always clamped by policy.toml's max_tokens_ceiling (8192 default). To request longer replies in Open WebUI, open Chat Controls → Advanced Params → num_predict (up to max_tokens_ceiling).

Launch a coding agent from the terminal#

With LUCID Desktop or lucidd running, use:

lucidd pi --local-only
lucidd opencode --model qwen3.8-27b-bench
lucidd pi --endpoint http://127.0.0.1:11434 --print-env
lucidd opencode -- run "Explain this repository"

Both launchers default to --model auto and look for LUCID Desktop on port 11435 before trying standalone lucidd on port 11434. They preflight the model and pin that model for the session. --local-only applies both to preflight and to inference requests. Arguments after -- are passed to the agent. Use the launcher's own --model and --endpoint to change its routing. --print-env prints the generated settings as JSON without launching the agent. The launchers use temporary or process-only provider configuration. Pi saves sessions in its usual project directory and honors --session-dir and --no-session. Both launchers start in plain chat when a model does not support tools.

lucidd claude reports the compatibility gap. Claude Code needs an Anthropic-compatible gateway, and LUCID currently provides Ollama and OpenAI inference APIs.

Let LUCID pick a model#

Send "model": "auto" or "model": "lucid" to Ollama chat, generate, or show, or OpenAI chat completions. A real local model with that name wins. Otherwise LUCID starts with a warm on-device chat model, then checks other ready local models and trusted-circle slice plans. When no local route is ready and peer routing is allowed, LUCID checks authorized network providers. An exact remote match takes precedence within that fallback. Within each group, LUCID prefers tool support, then a larger context window, then sorts by alias. It returns the selected alias in model and X-Lucid-Resolved-Model. If no eligible model is ready, inference returns HTTP 503 with Retry-After: 5.

3. Pi (1.6.1+)#

Point Pi at LUCID's OpenAI-compatible /v1 endpoint in ~/.pi/agent/models.json. Replace your-model-name with any model shown in LUCID Desktop or curl -s http://127.0.0.1:11435/v1/models:

{
  "providers": {
    "lucid": {
      "baseUrl": "http://127.0.0.1:11435/v1",
      "api": "openai-completions",
      "apiKey": "lucid",
      "models": [
        {
          "id": "your-model-name",
          "name": "Your Model (LUCID)",
          "reasoning": false,
          "input": ["text"],
          "contextWindow": 32768,
          "maxTokens": 8192
        }
      ]
    }
  }
}

Then select the model in Pi with /model. No extra compatibility hacks are needed: LUCID accepts Pi 1.6.1's default "developer" system role, "stream_options": {"include_usage": true}, "store": false, "max_completion_tokens", and returns real llama.cpp prompt and completion token counts. (If you run standalone CLI lucidd, change :11435 to :11434.)

4. OpenCode (2.4.2+)#

OpenCode can connect to LUCID through ~/.config/opencode/opencode.json and automatically discovers models and tool support via Ollama's /api/tags and /api/show endpoints.

Configure ~/.config/opencode/opencode.json#

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "lucid": {
      "package": "@opencode/ai/providers/openai-compatible",
      "name": "LUCID",
      "settings": {
        "baseURL": "http://127.0.0.1:11435/v1",
        "apiKey": "lucid"
      },
      "models": {
        "your-model-name": {
          "name": "Your Model (LUCID)",
          "capabilities": { "tools": true, "input": ["text"] },
          "limit": {
            "context": 32768,
            "output": 8192
          }
        }
      }
    }
  }
}

Automatic Ollama discovery (/api/tags and /api/show)#

If you use OpenCode's native Ollama discovery (OLLAMA_HOST=http://127.0.0.1:11435, or :11434 for standalone lucidd), LUCID serves:

  • GET /api/tags with the integer size and details.parameter_size fields required by Ollama clients.
  • POST /api/show listing "tools" in capabilities for every llama.cpp model so agents enable native tool calling automatically.

Verify both endpoints in a terminal anytime:

curl -s http://127.0.0.1:11435/api/tags
curl -s http://127.0.0.1:11435/api/show -H "Content-Type: application/json" -d '{"model":"your-model-name"}'

5. Hermes & other OpenAI-compatible agents#

Any OpenAI-compatible agent—including Hermes Agent, Continue, or custom Python/Node tool loops—works out of the box against LUCID's /v1 endpoint (including from Client Mode devices routing over Noise to your Trusted Circle GPUs):

base_url: http://127.0.0.1:11435/v1   # or :11434 for standalone lucidd
api_key: lucid-local                  # any non-empty string
model: your-model-name                # or "auto"

Keep two fail-closed tool-calling bounds in mind:

  • On a local or sharded coordinator: up to 64 tools and 1.5 MiB combined prompt + schemas + tool history.
  • Over a remote peer relay (Client Mode): up to 64 tools and 256 KiB combined input—keep the active MCP toolset focused when running agents remotely.

6. Built-in MCP 2026-07-28 engine and Web Browser MCP#

LUCID Desktop (v0.2.0-rc42) embeds a native MCP 2026-07-28 dual-era client inside Tools & Skills Hub with zero manual JSON editing:

  • Dual-era protocol negotiation: Every server probe first attempts stateless single-round-trip server/discover using Mcp-Protocol-Version: 2026-07-28 (including Mcp-Name header mirroring, self-describing _meta envelopes, and MRTR input_required result formatting). If the server does not implement server/discover, LUCID automatically falls back to legacy MCP (2025-11-25 through 2024-11-05 initialize → notifications/initialized → tools/list).
  • Transports: Supports both persistent stdio subprocess sessions (pooled across turns so servers stay warm and cleanly drained on exit or runtime updates) and Streamable HTTP endpoints.
  • Managed portable Node.js LTS (v24.23.0): For npx-based servers on machines without a system Node installation, Tools & Skills Hub can install a private portable Node.js v24.23.0 LTS runtime fetched exclusively from https://nodejs.org and verified against compile-time SHA-256 hashes (managed-runtimes.json).
  • Context-aware output budgeting: Large MCP tool responses (such as web page DOM snapshots) are budgeted against the active model's context window so multi-step loops avoid silent context overflow.
  • Tor / TailsOS lock-off: All external MCP subprocesses, Streamable HTTP servers, and managed runtime downloads are automatically disabled in Tor / TailsOS mode.

Web Browser MCP (Chrome DevTools) levels and session modes#

LUCID Desktop includes a built-in Web Browser preset backed by Chrome DevTools MCP with automatic browser discovery (Chrome, Microsoft Edge, Brave, Vivaldi, Chromium, or a custom binary path—including chromeless Windows Microsoft Edge CDP auto-launch when Chrome is not installed).

Tool levels control how many browser tools are exposed to the model (keeping prompt budgets tight on smaller context windows or remote peers):

Level Tools Exposed Best For
Slim 3 tools (navigate, evaluate, screenshot) Small context windows (8K–16K), fast browsing, and Client Mode remote peer routing (256 KiB input cap).
Basic 12 core navigation, click, input, and inspection tools Everyday interactive web workflows at 32K+ context.
All Full Chrome DevTools suite (~33 tools) Deep network/console/DOM debugging and performance traces.
Custom Exact tools checked after Test & Discover Locking down a bespoke minimal tool subset.

Session modes control how the Chromium browser process is launched and isolated:

Mode Behavior
Visible Opens a visible, clean browser window so you can watch every navigation and click in real time.
Persistent Keeps cookies and logins inside LUCID's dedicated isolated browser profile across chats.
Attach Connects to a running browser over a loopback Chrome DevTools Protocol (CDP) URL, with a 1-click Launch <Browser> button.
Headless Runs the browser silently in the background with no visible window.

Every browser and MCP tool call still waits for terminal Ed25519 receipt verification and displays LUCID Desktop's inline Allow Once / Allow for This Chat / Deny approval card before executing.

Technical details: how tool calling works under the hood#

Both HTTP surfaces—Ollama POST /api/chat and OpenAI POST /v1/chat/completions—route through the exact same signed-manifest, fair-queue, and Ed25519 receipt-verification pipeline.

Wire format differences#

Surface Streaming default Tool arguments format Tool finish marker Token usage
Ollama POST /api/chat stream: true (NDJSON) JSON object ({"city":"Austin"}) done_reason: "stop" prompt_eval_count & eval_count from llama.cpp
OpenAI POST /v1/chat/completions stream: false (SSE + data: [DONE] when true) JSON string ("{\"city\":\"Austin\"}") finish_reason: "tool_calls" Real usage (prompt_tokens, completion_tokens, total_tokens), including streaming when stream_options.include_usage: true

Receipt verification & contract enforcement before releasing tool calls#

Because tool calls can trigger file edits or shell commands inside a coding agent, LUCID never releases unverified or partial tool calls:

  1. Buffered until terminal verification: While plain assistant text streams immediately, tool-call chunks are reassembled by index, committed into the streaming SHA-256 CommitmentAccumulator, and held until the terminal Ed25519 SignedReceipt verifies (binding manifest hash, signer/delivering PeerId, and exact streamed chunks—both on remote peers and locally).
  2. Signed tool contract (ToolCallPolicy): Before returning tool calls to your client, lucidd verifies that every call has a unique non-empty ID, calls only a declared function name, respects tool_choice (auto, none, required, or a forced function), and honors parallel_tool_calls: false (at most one call per turn). Cancellation never commits a partial call.
  3. Backend routing & fail-closed bounds:
    • Tool requests automatically route only to llama.cpp workers (pinned b12977, using llama-server --jinja). mlx and echo workers fail closed with 400 Bad Request on tool requests.
    • store: false is accepted on /v1/chat/completions; store: true is rejected with 400 Bad Request (LUCID never stores server-side conversation transcripts).
    • Shared fail-closed bounds: up to 64 tools per request, 32 tool calls per message/turn, 4 KiB tool descriptions, 16 KiB / depth-16 schemas (64 KiB total), 32 KiB arguments per call (128 KiB per turn), and 1.5 MiB combined input locally (4 MiB HTTP body cap) vs 256 KiB when relayed to a peer.

For exact request/response schemas and headers, see the HTTP API reference.


Written directly from the Phase, LUCID, LUMEN & PLASM source code. Raw Markdown · Edit or report an inaccuracy on GitHub.