شعار Localrouter

Localrouter

المجتمع
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)

الناشرjayleaton
المستودعlocalrouter
اللغةZig
التفريعات
5
النجوم
50
الأدوات المتاحة
0
نوع نقل البياناتstdio, streamable-http
الفئات
الترخيصApache-2.0
الروابط
  • اربط الأدوات بسير عمل الذكاء الاصطناعي

    يتيح Localrouter إمكانات MCP التي يمكن لتطبيقات الذكاء الاصطناعي العميلة ووكلاء الذكاء الاصطناعي المتوافقة استخدامها.

  • الأدوات المتاحة: 0

    تصفّح الإجراءات القابلة للاستدعاء أدناه، بما في ذلك أسماؤها وأوصافها عندما يوفّرها الخادم.

  • إعدادات جاهزة للنسخ

    استخدم أمثلة إعداد التثبيت لتهيئة هذا الخادم في تطبيق MCP العميل المفضّل لديك.

  • مؤشرات الاهتمام بالمصدر المفتوح

    النجوم: 50، والنسخ المتفرعة: 5 في المستودع المرتبط.

[!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.

التثبيت

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

استخدم MCP الخاص بـ Localrouter مع نماذج ذكاء اصطناعي متعددة

يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا بمجرد توصيل Localrouter، يمكنك استخدامه مع نماذج ذكاء اصطناعي مختلفة في TypingMind بدلًا من إعداده لكل نموذج على حدة. يمكنك تشغيل MCP محليًا على جهازك أو الاتصال بعنوان URL لخادم MCP بعيد.

الخيار 1: استخدام الموصل المحلي

استخدم هذا الخيار عندما يحتاج خادم MCP إلى الوصول إلى ملفات محلية أو تطبيقات أو موارد خاصة على جهاز الكمبيوتر لديك.

1

فتح إعدادات MCP

في TypingMind، انتقل إلى «الإعدادات»، ثم «الإعدادات المتقدمة»، ثم «بروتوكول سياق النموذج»، واختر «إعداد الموصل».

  1. افتح TypingMind في متصفحك.
  2. انقر على أيقونة الإعدادات.
  3. انتقل إلى الإعدادات المتقدمة.
  4. افتح قسم بروتوكول سياق النموذج.
  5. انقر على «إعداد الموصل» واختر «هذا الجهاز».
شاشة إعداد موصل MCP في TypingMind مع تحديد «هذا الجهاز»
2

تنفيذ أمر الموصل

اختر «هذا الجهاز»، وانسخ الأمر من TypingMind وشغّله في Terminal. أبقِ العملية قيد التشغيل أثناء استخدام MCP.

  1. انسخ أمر الإعداد الذي يعرضه TypingMind.
  2. افتح Terminal على macOS أو Windows Terminal على Windows.
  3. الصق الأمر ونفّذه.
  4. وافق على تثبيت الحزمة إذا طلب منك Terminal تأكيد المتابعة.
  5. أبقِ نافذة Terminal والعملية التي تعمل فيها قيد التشغيل أثناء استخدام أدوات MCP.
3

أضف Localrouter كخادم

عندما تظهر حالة الموصل «جاهز»، انقر على «تعديل الخوادم» والصق إعدادات خادم MCP.

  1. انتظر حتى تظهر حالة الموصل «جاهز».
  2. انقر على «تعديل الخوادم».
  3. الصق إعدادات خادم MCP الخاص بـ Localrouter.
  4. احفظ قائمة الخوادم.
  5. حدّث الحالة إذا أردت التأكد من أن الموصل لا يزال جاهزًا.
إعدادات MCP في TypingMind تعرض خادمًا نشطًا وزر «تعديل الخوادم»
{
  "mcpServers": {
    "localrouter": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

استخدام الاتصال مع نماذج مختلفة

احفظ قائمة الخوادم، وافتح «الإضافات»، وفعّل أدوات MCP الخاصة بـ Localrouter، ثم اختر أي نموذج ذكاء اصطناعي مدعوم في TypingMind واستخدم الأدوات في المحادثة أو أسندها إلى وكيل ذكاء اصطناعي.

  1. افتح صفحة الإضافات في TypingMind.
  2. فعّل أدوات MCP الخاصة بـ Localrouter.
  3. ابدأ محادثة واختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  4. استخدم أدوات MCP في المحادثة أو عيّنها لوكيل ذكاء اصطناعي.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر عند الحاجة دون إعادة الاتصال بـ MCP.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام Localrouter لمساعدتي في هذه المهمة؟
Localrouter
بالتأكيد. قرأته.
إليك ما وجدته باستخدام Localrouter.

الخيار 2: إضافة عنوان URL لخادم MCP

استخدم هذا الخيار عندما يكون Localrouter مستضافًا بالفعل عن بُعد أو عندما يريد فريقك موصلًا مشتركًا واحدًا يمكن لعدة مستخدمين الوصول إليه.

1

فتح موصلات MCP

في TypingMind، انتقل إلى «الإضافات»، وافتح «موصلات MCP»، ثم اختر «إضافة رابط».

  1. افتح TypingMind في متصفحك.
  2. انتقل إلى الإضافات.
  3. افتح موصلات MCP.
  4. انقر على «إضافة عنوان URL».
نموذج إضافة عنوان URL لخادم MCP مخصص في TypingMind
2

لصق عنوان URL للخادم

أدخل http://{{config.HOST}}:{{config.PORT}} في حقل «رابط الخادم». أضف اسمًا للاتصال أو وصفًا أو أيقونة أو ترويسات HTTP مخصصة أو إعدادات عميل OAuth إذا كان الخادم يتطلب ذلك.

  1. ألصق http://{{config.HOST}}:{{config.PORT}} في حقل «رابط الخادم».
  2. أدخل اسمًا لاتصال Localrouter.
  3. أضف وصفًا وأيقونة لتسهيل التعرّف على الاتصال إن أردت.
  4. أضف ترويسات HTTP مخصصة أو تفاصيل عميل OAuth إذا كان الخادم يتطلب المصادقة.
3

إنشاء الاتصال

انقر على «إنشاء اتصال»، ثم عُد إلى قائمة الإضافات وتأكد من أن اتصال MCP الجديد نشط.

  1. انقر على «إنشاء اتصال».
  2. عُد إلى قائمة موصلات MCP.
  3. تأكد من ظهور اتصال Localrouter بحالة «نشط».
  4. حدّث قائمة الإضافات إذا لم يظهر الاتصال فورًا.
4

تبديل النماذج دون إعادة الاتصال

ابدأ محادثة مع نموذجك المفضل، وفعّل أدوات Localrouter من «الإضافات»، وانتقل إلى نموذج آخر عند الحاجة. يظل اتصال MCP متاحًا في مساحة عمل TypingMind.

  1. ابدأ محادثة جديدة في TypingMind.
  2. اختر نموذج الذكاء الاصطناعي الذي تريد استخدامه.
  3. فعّل أدوات Localrouter من قسم الإضافات.
  4. اطلب من النموذج استخدام الأداة عند الحاجة.
  5. انتقل إلى نموذج ذكاء اصطناعي آخر وأعد استخدام اتصال MCP نفسه.
محادثة في TypingMind تستخدم أدوات MCP المفعّلة مع نموذج ذكاء اصطناعي محدّد
هل يمكنك استخدام Localrouter لمساعدتي في هذه المهمة؟
Localrouter
بالتأكيد. قرأته.
إليك ما وجدته باستخدام Localrouter.

الأسئلة الشائعة

ما استخدامات خادم MCP Localrouter؟

Localrouter هو خادم MCP يتيح لتطبيقات الذكاء الاصطناعي المتوافقة الاتصال بأدوات ومصادر سياق خارجية. في TypingMind، يمكنك إضافة خادم MCP هذا مرة واحدة وإتاحة أدواته في مساحة عملك للذكاء الاصطناعي.

هل يمكنني استخدام خادم MCP Localrouter مع نماذج ذكاء اصطناعي متعددة في TypingMind؟

نعم. يربط TypingMind أدوات MCP على مستوى مساحة العمل، لذا يمكنك استخدام Localrouter مع نماذج ذكاء اصطناعي مختلفة مثل Claude أو ChatGPT أو Gemini أو غيرها من النماذج التي أعددتها في TypingMind، دون إعداد خادم MCP لكل نموذج على حدة.

لماذا تستخدم موصل MCP Localrouter مع TypingMind؟

يُعد TypingMind من أفضل واجهات المحادثة مع النماذج اللغوية الكبيرة، إذ يجمع نماذج ذكاء اصطناعي متعددة ومطالبات وإضافات ووكلاء ذكاء اصطناعي ومفاتيح API وأدوات MCP في مساحة عمل واحدة. بعد توصيل Localrouter، يمكنك استخدام أدوات MCP الخاصة به عبر نماذجك المفضلة مع الحفاظ على سير عمل محادثاتك منظمًا في TypingMind.

كيف أوصّل خادم MCP Localrouter بـ TypingMind؟

يمكن توصيل Localrouter بـ TypingMind باستخدام موصل MCP المحلي أو بإضافة عنوان URL لخادم MCP بعيد. استخدم الموصل المحلي عندما يحتاج الخادم إلى الوصول إلى ملفات أو تطبيقات أو موارد خاصة على جهازك، واستخدم عنوان URL للخادم عندما يكون خادم MCP مستضافًا عن بُعد.

ما الأدوات التي يوفّرها خادم MCP Localrouter في TypingMind؟

يتيح Localrouter إمكانات MCP يمكنك تفعيلها من صفحة الإضافات في TypingMind واستخدامها في المحادثات أو تعيينها لوكلاء ذكاء اصطناعي.

هل أحتاج إلى مشاركة مفاتيح API الخاصة بي مع TypingMind لاستخدام خادم MCP Localrouter؟

لا. يعطي TypingMind الأولوية للعمل المحلي ويُبقي مزوّدي النماذج ومفاتيح API والمطالبات وإعدادات MCP تحت تحكمك. إذا كان Localrouter يتطلب مصادقة، فأضف الترويسات أو إعدادات OAuth أو الإعدادات المحلية المطلوبة لخادم MCP هذا عند إنشاء الاتصال.

خوادم MCP ذات صلة

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇