Skip to content

Unsloth Studio / Desktop: link other Unsloth instances and serve their models through one API as @name/model - #12092

Draft
LeoBorcherding wants to merge 32 commits into
unslothai:mainfrom
LeoBorcherding:feat/studio-linked-instances
Draft

LeoBorcherding wants to merge 32 commits into
unslothai:mainfrom
LeoBorcherding:feat/studio-linked-instances

Conversation

@LeoBorcherding

Copy link
Copy Markdown
Collaborator

Link other Unsloth Studio instances (a Colab runtime, a WSL session, another PC on the LAN) to this one, and every model they serve shows up in this instance's /v1/models as @name/model. One base URL and one API key reach every GPU; requests for an @name/ model are forwarded to that instance with its own key, which stays server-side.

What it adds

  • Settings → API → Linked instances: add by URL and API key, rename, re-test, remove. Keys are encrypted at rest and never sent to the browser.
  • Forwarding: /v1/chat/completions, /v1/completions, /v1/messages, /v1/responses, /v1/embeddings and image generations route by the @name/ prefix. Streaming passes through, and usage is requested and counted even when the caller didn't ask for it.
  • API monitor: forwarded requests appear in the log with prompt, reply, tokens and timing. A reasoning model's first-token clock starts when it starts thinking, not when the answer arrives.
  • API page rail: one card per instance with latency, connection kind (Cloudflare tunnel, LAN, this PC), the loaded chat or image model, and VRAM. Multi-GPU machines show the pooled total, then one row per card for 2 or 3 cards, or a compact per-card grid from 4 up.
  • Details dialog: version, runtime, per-card VRAM, CPU, RAM, disk, uptime and models.

Only the installation owner, from a UI session, can manage links. API-key callers can use linked models but cannot list or change the links.

Screenshots

API page, before (main) and after:

before
after

Settings → API, before and after (the Colab tunnel URL is blurred):

before
after

Row menu, details for a 2-GPU machine, and the Add form:

row menu
details
add

A forwarded request in the API monitor:

monitor

2, 4, 8 and 16 GPU cards. The 4, 8 and 16 are fake local servers returning spoofed /api/system data, there only to check the layout:

many gpus

Where it was run

Every row is the real app, not a mock, measured at e1c01abdcc.

Instance Hardware Reached via What ran
Desktop (this machine) R9700, Windows 11 n/a Linking, rail, dialogs, monitor
@colab NVIDIA L4, Colab Cloudflare tunnel Info, model listing, image model shown in the rail
@rx6500 RX 6500 XT + RX 5700 XT, Windows, ROCm 7.13 LAN Chat streamed through /v1, pooled VRAM, per-card rows
@wsl, @wslb R9700, WSL2 localhost Listing, info, forwarding

Not run:

  • An instance behind a slow or flaky tunnel for hours.
  • A release older than the /api/system fields. Every field is treated as optional, but nothing that old was linked.

Tests

  • studio/backend/tests/test_linked_instances.py: 27 pass.
  • studio/frontend/tests/linked-instance-gpu-pool.test.ts: 4 pass.
  • Frontend typecheck is clean.

…mote's own API; API page panel and details dialog
…w and grows on scroll, detail pane follows the newest request, no truncated labels
The rail, the settings row and the details dialog read only the first GPU, so a machine with an RX 6500 XT and an RX 5700 XT showed as one 4 GB card (and the settings row as 2x RX 6500 XT). They now name each card, sum the VRAM, and the dialog adds a Total VRAM line.
The rail groups cards by model and draws one VRAM cell per card in rows of up to 8. The details dialog puts Total VRAM first and scrolls the per-card list past two cards, numbering each card and wrapping long names instead of cutting them off.
/v1/models only flags chat models, so an instance running an image model read as idle.
…soning

A thinking model streams reasoning_content first, so TTFT waited for the answer and the
monitor showed a 46 s first token and a four-figure tok/s.
@danielhanchen danielhanchen added the security# Moves a security boundary: sandbox, allowlist, permission or network guard label Sep 27, 2026
…instances

# Conflicts:
#	studio/frontend/src/features/api-monitor/api-monitor-page.tsx
Main's contrast-slider scan covers the rail: its bar tracks now use the contrast-wash gain.
/v1/models lists every linked instance's models as @name/id, embedding
models included, but /v1/embeddings had no linked branch, so a client that
picked one got the local embedding path or an error instead of the instance
that serves it. It now resolves and forwards like completions does. Test
added.
…CI contracts

The Hebrew and Swedish overlays arrived with the merge of main and had none
of the 61 linked-instance strings, which fails the strict i18n check. The
linked-instance routes are owner-only installation objects, so the account
isolation matrix skips them with that reason, as it does for NPU models. The
usage-examples contract reads the filtered catalog set, the API page's
overflow contract leaves the font-mono example request alone, and a blank
line from the merge resolution is formatted away.
Image, speech and separation models carry a task, and none of their
endpoints forwards a linked id, so advertising them sent a client that
picked one to the local media runtime. They are left out until their
endpoint forwards. Test added.
The catalog filter ran after probe, so the status cards in Settings still
listed media models as copyable ids. The filter now runs in probe, which
both read. Test added.
Chat completions ran the local tool admission before resolving a linked
model, so on a managed install a full-access request to a linked model was
refused here although the linked server applies its own policy. It now
resolves first, as responses and messages already do. Test added.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

affects UI# conflicts# new-feature# security# Moves a security boundary: sandbox, allowlist, permission or network guard >3000#

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants