Localrouter logo

Localrouter

Community
jayleaton

Fast & opinionated local AI routing: one MCP server that loads local image and video models on demand on your own GPU box (DGX Spark first)

Publisherjayleaton
Repositorylocalrouter
LanguageZig
Forks
5
Stars
50
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    Localrouter exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    50 stars and 5 forks from the linked repository.

[!WARNING] Early preview. LocalRouter is new and under active development: expect bugs and breaking changes. Please open an issue if something doesn't work.

LocalRouter turns one NVIDIA DGX Spark into a full-duplex "Jarvis" box. You talk to it and it talks back. You can interrupt it mid-sentence, and it can make a picture or a video while you talk. Everything runs on the box:

  • Chat: Qwen3.8 27B on TensorFold, with the DFlash2 drafter.
  • Voice: Fish Audio Drama 3, streamed as it speaks, with six fixed voices.
  • Hearing: Whisper large-v3-turbo with the Silero VAD.
  • Images: Qwen-Image 2.1 Turbo.
  • Video with audio: MiniMax H3.

One small Zig daemon owns the machine. It keeps the voice loop and chat warm, loads the other models when asked, makes room for them, and hands every tool to your agents over MCP and an OpenAI-compatible API.

Quick start

Tell your coding agent (Claude Code, Codex, T3, ...):

Read INSTALL.md and set up LocalRouter Jarvis on this box.

INSTALL.md is written for agents. It is a deterministic sequence of commands, with what to check at each step and what to ask you: which licences you accept, and whether the GPU may be used. To run it yourself:

bash
git clone https://github.com/jayleaton/localrouter && cd localrouter
tools/install/bootstrap.sh --profile jarvis-gb10 --dry-run   # the plan: steps, downloads, disk, memory, licences
tools/install/bootstrap.sh --profile jarvis-gb10 --accept    # after reading the licences the plan lists

What it does. It installs every model of deploy/profiles/jarvis-gb10.json, checks every download against its pin and qualifies chat and Drama 3 on the GPU. It leaves one systemd user service on 127.0.0.1:8190, which starts at boot and is reachable on your tailnet through tailscale serve. It is resumable: after a failure, do what it says and run it again. Models already on the box are reused, not downloaded again. tools/install/doctor.sh --profile jarvis-gb10 lists anything missing, with its fix.

A fresh install on DGX-01 (measured 2026-10-22):

PartMeasured
Downloads and builds31.5 min, 175.7 GB downloaded
Chat qualification on the GPU113 s
Drama 3 qualification on the GPU20.5 min
Image and video pack buildsnot yet timed end to end

What you get

WhereWhat
/voiceThe web app. A full-duplex voice conversation: barge-in, spoken picture requests, and a voice picker with previews
/v1OpenAI-compatible API: chat completions (whole or streamed, with tools), audio speech and transcriptions, images, videos, and the Realtime API at /v1/realtime
/mcpEvery tool over MCP: chat, synthesize_speech, transcribe_audio, generate_image, generate_video, list_models, list_voices, jobs. Setup for Claude Code, Codex, Cursor and any client: docs/MCP.md
bash
claude mcp add --transport http localrouter http://127.0.0.1:8190/mcp

Measured on a DGX Spark

DGX-01, NVIDIA GB10, 2026-10-22. Only figures we measured are listed.

WhatMeasured
Voice turn: end of speech to first audioabout 0.9 s median (916 to 959 ms across today's smoke runs); 0.72 to 0.95 s for the first turn after an image or a video
Drama 3: first audio0.14 s p50, 0.18 s p95. Real-time factor 0.68. From its GPU qualification
Chat: first content0.15 s for a short prompt, streamed
"Generate a picture of a dog", spokenpicture done 8.1 to 10.2 s after the end of speech; spoken confirmation 8.8 to 11.4 s
Image: Qwen-Image 2.1 Turbo, 1024x10246.3 s warm
Video: MiniMax H3, 768x448 with audioa 1 s clip in about 24 s; a 5 s clip in 54 s warm
Memory with chat, Drama 3, Whisper and the image model warm24 + 42 + 3.6 + 35.2 GiB resident; 13.7 GiB still available after a start, 11 to 12 GiB in use, of 121.7 GiB

A video job unloads only the image model while it runs, and the image model comes back after it. Chat, Drama 3 and Whisper are never unloaded for an image or a video.

Hardware

Needjarvis-gb10 (the tested profile)
BoxNVIDIA DGX Spark (GB10, aarch64): 128 GB unified memory, at least 110 GiB visible to the OS
SoftwareDGX OS / Ubuntu 24.04, NVIDIA driver 580 or newer, CUDA 13 (nvcc), Docker with the NVIDIA runtime (for the image and video packs), systemd user services
Diskabout 250 GiB free for a fresh install (216 GiB plus a 30 GiB margin). --dry-run prints the exact figure
NetworkHTTPS to huggingface.co, github.com, ziglang.org, pypi.org, download.pytorch.org and nvcr.io during the install

No other profile is tested yet. The chat and Drama 3 engines here are GB10 builds, and their qualification refuses other GPUs.

How it works

  • One door for every agent. Add one MCP server, or point any OpenAI client at /v1.
  • Memory is managed for you. Each model says what it needs before it loads. If it does not fit, idle models of lower priority give way. Kept-warm models (the voice set and chat) come back by themselves, and only with room to spare.
  • Correct. The image and video engines are LocalRouter's own, written in Zig with their own GPU kernels. They are verified operation by operation against a Python reference of each model, then from prompt to pixels and audio samples. Chat and Drama 3 are qualified on the box's own GPU before the service serves them.
  • Small. One Zig binary. Every loaded model is its own process, so unloading returns all of its memory and a crash costs one job.

Image and video only (Docker)

bash tools/spark/install.sh installs just the image and video models as a Docker service. The script's header documents it: MODELS, PRECISIONS (FP8 by default, NVFP4 optional), IMAGE_MODELS, and binding with LOCALROUTER_BIND=localhost|tailscale|all. Prebuilt Qwen-Image 2.1 packs are optional, from Hugging Face, for non-commercial research or evaluation only under the Qwen Research License.

Connect an agent

Any MCP client: {"mcpServers": {"localrouter": {"type": "http", "url": "http://<host>:8190/mcp"}}}. For clients that only speak stdio: localrouter mcp-stdio --url http://<host>:8190.

MCP toolDoes
list_models, list_voicesthe models (what each can do, default_for, state, memory) and the speech voices
reserve_for, unload_model, load_modelmake room for a heavy job (what it unloads comes back after it), unload or load one model; never the chat model. The procedure is a skill: skills/jarvis-model-manager
generate_imagetext to image. Waits up to wait_s, returns the PNGs inline and as links, or a job id; edit inputs are refused by the current engines
generate_videotext to video. Waits up to wait_s, then returns the MP4's link or a job id; image inputs are refused by the current engines
chata chat completion from the chat model: the reply's text (or its tool calls), then the whole completion. reasoning: false answers without thinking
synthesize_speech, transcribe_audiospeech as WAV (inline and a link) in any listed voice; the transcript of a URL, base64 audio or a file on the box
get_job, cancel_jobfollow or stop a long job
release_modelsunload everything now

Config snippets for every client, an example call for every tool and the security note are in docs/MCP.md. The HTTP API, field by field, is in docs/AGENTS.md, and an agent skill is in skill/localrouter.

Configuration

localrouter serve --config tools.json (the installer writes one):

json
{
  "reserve_bytes": 8589934592,
  "defaults": {"text_to_image": "qwen-image-2.1-turbo"},
  "tools": [
    {"id": "qwen-image-2.1-turbo", "kind": "image", "engine": "qwen_image_turbo", "weights": "/models/qwen-image-2.1",
     "priority": 10, "keep_loaded": true, "options": {"precision": "fp8s"}},
    {"id": "qwen-image-2.1", "kind": "image", "engine": "qwen_image", "weights": "/models/qwen-image-2.1",
     "priority": 5, "options": {"precision": "fp8s"}},
    {"id": "qwen-image-2.1-nvfp4", "kind": "image", "engine": "qwen_image", "weights": "/models/qwen-image-2.1",
     "priority": 10, "options": {"precision": "nvfp4"}},
    {"id": "minimax-h3", "kind": "video", "engine": "minimax_h3", "weights": "/models/minimax-h3",
     "idle_ttl_s": 30, "options": {"max_width": 768, "max_height": 448, "max_seconds": 5}}
  ]
}
KeyDefaultMeaning
host, port127.0.0.1, 8190where the API listens. host is an IP, localhost, all (0.0.0.0) or tailscale (this machine's tailnet IPv4); --host takes the same
data_dir/datajob inputs and outputs (jobs/) and worker logs (logs/<tool>.log)
reserve_bytes8 GiBmemory always left free for the OS and other services
budget_bytes0 (none)a cap on what loaded models and running jobs may use
keep_outputs_s86400how long outputs stay
defaultsnonethe model a request that names none gets, per capability: {"text_to_image": "qwen-image-2.1-turbo"}. Unset: the first model (in config order) that can do it. Each must name a configured model with that capability, or serve refuses to start. localrouter models and list_models show the result
gpu_locknonethe host's GPU lock file, the one GPU jobs outside LocalRouter take exclusively. LocalRouter holds it once, shared and without waiting, while any of its models is loaded, and releases it when none is; while someone else holds it nothing loads (503). LocalRouter's own models never take it: they are admitted by memory alone, so chat, speech and transcription stay loaded side by side
allow_private_urlsfalselet input image URLs (edits, image to video) name loopback, private and link-local hosts; by default they are refused, redirects are never followed, and only the daemon's own output URLs are fetched from the machine itself
tools[].engine / cmda compiled-in engine, or any program speaking the worker protocol
tools[].priority0 (chat: 100)higher is unloaded later when memory is needed
tools[].keep_loadedfalse (chat: true)load at start, never unload for idleness, reload as soon as the scheduler is idle (unloading idle tools of lower priority)
tools[].qualificationnonea file the model's qualify script writes on this machine. Until it exists and says "qualified": true the model is listed ("qualified": false in /v1/models) and refused with a 503 saying it is not GPU-qualified on this host
tools[].idle_ttl_s120unload after this long unused (0: right after each job)
tools[].capabilitiesfrom the enginetext_to_image, image_edit, text_to_video, image_to_video, text_to_speech, speech_to_text, chat_completion
tools[].engineqwen_image (Qwen-Image 2.1, 25 steps), qwen_image_turbo (Qwen-Image 2.1 Turbo, its checkpoint's 8 steps; other step counts are refused), minimax_h3, openai_server (a model's own OpenAI-compatible server run as the worker: chat), testpattern
tools[].optionsengine settings (precision: fp8s, the default, or nvfp4; max_side; default steps; the Qwen engines' dit: the DiT pack directory, default <precision> or turbo-<precision>)

There is no authentication: it listens on localhost unless you choose otherwise; use a private network or a tailnet (the Jarvis install puts tailscale serve HTTPS in front of it; --host tailscale binds the tailnet address) and never all on an untrusted network.

Build and test

Zig 0.17.0; ffmpeg for video output. The GPU engines need nvcc and an NVIDIA GPU (sm_120 / sm_121); without -Dnvcc the binary builds without embedded CUDA kernels, and the GPU-free test engine runs the tests. The model engines remain registered but cannot generate without their kernels.

bash
zig build                                    # zig-out/bin/localrouter
zig build test                               # unit + integration tests (a real daemon and real workers)
zig build integration-exe && zig-out/bin/integration-test   # the integration tests one at a time, each named as it runs
zig build -Dnvcc=/usr/local/cuda/bin/nvcc -Dsm=121,120   # with the GPU engines
localrouter check selftest                   # a private daemon, one image and one video, no GPU

How it was built

The engines are ports, not wrappers. Each model was first reproduced in Python on the project's own kernels (the "twin", in tools/twin), measured against the reference implementation, then rewritten in Zig and gated against the twin: every operation alone and chained, then the whole generation, on the target GPU. The measured results and the milestones are in docs/dev.

Credits

LocalRouter stands on the work of these projects and teams:

  • TensorFold by Ash Hart. Its CUDA runtime, NVFP4 kernels and Python model implementations were the baselines our image and video engines were ported from and verified against. Its native server runs the chat model, and Drama 3 runs on it. Thank you, Ash; we expect to contribute parts of the Zig work back upstream.
  • Qwen (Alibaba): Qwen3.8 27B for chat, and Qwen-Image 2.1 and 2.1 Turbo for images.
  • z-lab: the DFlash2 speculative drafter for Qwen3.8 27B.
  • Fish Audio: Drama 3, the voice. Built with Fish Audio.
  • drama-tensorfold by plotarmordev (Apache-2.0), which ports Drama 3 to TensorFold.
  • OpenAI: Whisper large-v3-turbo, for speech to text.
  • Silero VAD: voice activity detection.
  • MiniMax: MiniMax H3, video with audio.
  • NVIDIA: the DGX Spark (GB10) and the NGC PyTorch container the packs are built in. The INT8 attention kernels are SageAttention's, as shipped in NVIDIA's comfy-kitchen.

The weights are downloaded from their publishers under their own licences. Check these terms before installing or using a model:

  • Qwen-Image 2.1 is restricted to non-commercial research or evaluation under its Research License.
  • MiniMax H3's Community License excludes the US, EU, UK and South Korea, and imposes downstream use conditions.
  • Fish Audio Drama 3's weights are under the Fish Audio Community License v1.0. It allows commercial use only under USD 500,000 annual revenue, and no Hosted Service (letting third parties generate speech through an API) without a separate licence from Fish Audio. So keep LocalRouter on loopback or your tailnet for it (details).

The Apache-2.0 licence below covers the software. See NOTICE.

License

Apache License 2.0. See LICENSE and NOTICE.

Installation

TypingMind
{
  "mcpServers": {
    "localrouter": {
      "command": "localrouter",
      "args": [
        "mcp-stdio",
        "--url",
        "http://{{config.HOST}}:{{config.PORT}}"
      ],
      "env": {
        "HOST": "<HOST>",
        "PORT": "<PORT>"
      }
    }
  }
}

Use Localrouter MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Localrouter is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Localrouter as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Localrouter MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "localrouter": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Localrouter MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Localrouter MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Localrouter to help me with this task?
Localrouter
Sure. I read it.
Here is what I found using Localrouter.

Option 2: Add an MCP server URL

Use this when Localrouter is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter http://{{config.HOST}}:{{config.PORT}} in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste http://{{config.HOST}}:{{config.PORT}} into the Server URL field.
  2. Enter a connection name for Localrouter.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the Localrouter connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the Localrouter tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the Localrouter tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Localrouter to help me with this task?
Localrouter
Sure. I read it.
Here is what I found using Localrouter.

Frequently asked questions

What is the Localrouter MCP server used for?

Localrouter is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Localrouter MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Localrouter with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Localrouter MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Localrouter connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Localrouter MCP to TypingMind?

Localrouter can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does Localrouter MCP provide in TypingMind?

Localrouter exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Localrouter MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Localrouter requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇