Repository navigation
Unsloth Studio: link other Unsloth instances and serve their models as @name/model - #18310
Open
danielhanchen wants to merge 3 commits into
Open
danielhanchen wants to merge 3 commits into
danielhanchen wants to merge 3 commits into
Conversation
…model Owner-only registry of linked Unsloth Studio instances. /v1 chat, completions, responses, messages, embeddings and image generation forward an @name/model id to that instance with its stored key; /v1/models lists their models. Tools stay off on a linked instance until the owner allows them: tool fields are stripped, enable_tools is sent as false, and a header makes the remote hard-disable tools for the request. Relayed replies keep only JSON, SSE and media types. Plain http is allowed only to loopback and LAN hosts, checked again on every request. Split from #12092 and #12388. Co-authored-by: LeoBorcherding <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linking another machine (a Colab session, WSL, a PC on the LAN) makes its models usable through this machine's API as
@name/model, with one key.Split from #12092 and #12388 (by @LeoBorcherding), rebased on current
main. The security changes from #12388 are part of this PR, so no merge state ever forwards tool requests to a linked machine.What it does
/api/linked-instances): add, edit, remove, test, status, hardware info. The remote's API key is stored encrypted next to the other provider credentials./v1/chat/completions,/v1/completions,/v1/responses,/v1/messages(+count_tokens),/v1/embeddingsand/v1/images/generationsforward an@name/modelid to that instance./v1/modelslists their models after the local ones, including model aliases.Safety
enable_tools: falseis sent, and anX-Unsloth-Linked-Tools-Offheader makes the remote hard-disable tools for that request (a body flag alone loses to a remote launched with--enable-tools). Changing an instance's address turns tools off again.nosniffand a sandbox CSP.httpis accepted only for loopback and private LAN hosts, and checked again on every request, so a DNS change cannot send the key in the clear. Environment proxies are ignored for these requests.Tests
tests/test_linked_instances.py(48 tests) plus the account matrix entries for the new routes.enable_tools: false, no other tool fields and the tools-off header. With tools allowed, the fields arrived unchanged. On Unsloth Studio / Desktop: link other Unsloth instances and serve their models through one API as @name/model #12092's code, both cases forwardedenable_tools: trueandpermission_mode: "off".main(21 failures; they need packages this test environment did not have, such as PyTorch).Follow-ups stacked on this: #18311 (Settings UI), then #18312 (API page cards) and #18332 (Images on a linked machine).