Skip to content

Unsloth Studio: redesigned API page, multi-model support and a Run settings fix - #14455

Merged
shimmyshimmer merged 28 commits into
mainfrom
studio-api-page-redesign
Oct 21, 2026
Merged

shimmyshimmer merged 28 commits into
mainfrom
studio-api-page-redesign

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Unsloth Studio: redesigned API page, multi-model support and a Run settings fix

The API page grew one control at a time and read as a row of seven unrelated buttons over six oversized cards. It also only knew about one model, even with "Keep multiple models loaded" on. This reorganizes it around what people come to it for: where to point a client, which models are serving, and what the last requests did.

Layout

  • Header: the server status (Ready / Serving / No model loaded, plus "· N models") sits next to the title. A gear button (no outline; a filled circle on hover) opens API settings.
  • Endpoint card: the base URL (copy on hover) and the model controls: the picker, Reload, and Eject, the one labeled button ("Eject all" with several models loaded). Below them, one row per model answering requests, laid out in shared columns: the exact model value to send (quant included, copy on hover with its slot reserved), a Run settings button, an API example button, Context and Slots on the primary model, and a per-model eject.
  • Summary: the six stat cards become one divided strip. Tokens shows the total, with input and output in its hint.
  • Request log: a search field, the Library page's tab strip as the status filter (with per-status counts that count requests only, so they match the summary; a failed model load still lists under Errors), a model filter once the log holds more than one model (the summary follows it), and pause / refresh / clear as icon buttons. An "N of M" count shows only while a filter hides rows. Pause turns amber while the feed is stopped. Rows show their age ("now", "5m ago") on the server's clock, with the total time and generation speed on the second line. Hovering a row's time shows its input and output tokens. ArrowUp / ArrowDown step through requests, and the detail pane groups its numbers into Timing and Tokens (Input (prompt), Output (completion), Total). Copy buttons sit inside the Prompt, Reply and Error boxes, and any box that holds one line draws as a pill.
  • Empty log: a quick-start curl request against this server's base URL and the loaded model, plus a button into API keys and more examples.
  • Surfaces: the Train page's cards (elevated-card bg-card): a soft border and glow in light mode, borderless in dark mode. Corners on the API page and the API example sit a step tighter (cards 32 to 29 px, boxes 2 px less), scoped by an api-rounding class so Train keeps its own.
  • Saved load settings: shorter copy, one list instead of a card per model. The guided tour copy follows the new layout.

Multiple models

  • Every serving model is listed and can be ejected or reconfigured on its own. The primary model's Run settings opens its live settings. A kept model's opens what it has saved, as its row in the picker does. The toolbar's single Run settings button is gone, since it could only reach the primary.
  • Ejecting the primary while another model was kept flipped the page to "No model loaded", though the kept model was still answering requests. The status now reads Ready and the kept model stays listed.
  • The list refreshes on every load or unload the monitor records, not only when the primary changes.
  • The model picker trigger (here and in Chat) lists the loaded model names separated by • instead of "2 models loaded" plus one model's format and quant.

API example

  • The code icon on each model row opens a dialog with a syntax-highlighted Python OpenAI-client request for that model, carrying the sampling the server fills in for omitted fields. The values come from a new GET /api/inference/sampling-defaults?model=, which runs the same resolution as the request path (operator UNSLOTH_SAMPLING_* pins, then the model's recommendation, then the schema default).

  • The endpoint routes to a kept model's own slot and passes the loaded model's default thinking mode, as /v1/chat/completions does, and resolves nothing against a resident hidden from the caller (another account's model stays private, as on the monitor).

  • Only one row is the primary even when two local files share a public name, so Eject and Run settings act on the right file. A kept standalone .gguf or HF cache snapshot opens the same saved settings record the picker uses.

Performance

  • The page stops polling the monitor while the tab or window is hidden and polls at once when it shows again. It used to poll every 1.5 s in a background tab or a minimized Desktop window.

  • Each poll shares unchanged entries with the previous snapshot (monitor-snapshot.ts), and request rows are memoized, so a quiet server re-renders nothing and a busy one re-renders only the rows that changed. The relative-time clock ticks only while the log has rows, and search filtering is deferred so typing stays responsive.

  • On the Remote & LAN tab, the remote and LAN status polls skip their request while the window is hidden. LAN URLs publish to the shared store only when they change: every poll used to hand over a fresh array, re-rendering each base URL reader every five seconds.

Floating API monitor

  • Polls only while the tab is visible and checks at once when it shows again, and shares unchanged snapshots with the last poll, so a quiet server re-renders nothing. The first snapshot after each stand up stays a fresh object, so automatic opening still works after a visit to the API page.
  • Lists every serving model (the primary first, "+N" for the rest) instead of reading "No model loaded" while a kept model still answers. The status dot is labeled (Ready / Serving / No model), and a failed poll keeps the last rows and reads "Can't reach Unsloth" instead of blanking.
  • The stats tile's text sits centered: its labels' line boxes padded below the ink, so even padding read high.
  • Request rows open the API page with that request selected. Labels match the page (In flight, Avg time, Open API page), and a finished request with no duration no longer reads "live".

API settings tab

  • Usage examples sit right under the keys, so a key just created shows up in the request below it.
  • Remote and LAN access become a status card (Off / Starting / Online, with the URL when online) and a Manage button into the Remote & LAN tab, instead of a second copy of both panels and their two five-second polls.

Run settings

  • Run settings opened from a model row on the API page (its gear, or the Slots link) opens alone, with no back button to the model list. Opened from a row inside the picker, it keeps the back button.
  • Every Run settings page has more room between "Remember for this model" and the buttons.
  • Fix: Run settings did nothing when the model list was already open. The pointerdown closed the picker and the click reopened it on the settings request inside the exit animation. The picker's close-edge effect then cleared the target it had just adopted. The clear now happens during render, in order with the adoption (model-selector.tsx, so Chat's shortcut benefits too).

Other fixes

  • The API example panel's light-mode fill ignored the contrast setting (contrast-slider.test.ts). It now uses the contrast-aware wash.
  • Stat values used text-ui-22, a token that does not exist.
  • The Throughput hint read "N tokens · generation only" while N counted prompt and completion tokens. Speed and token total are now separate cards.
  • A finished row with no duration said "running".
  • The search placeholder was cut off. A failed Eject left a banner that could not be dismissed. Load errors were truncated in the toolbar.
  • A filter that matches nothing offers Clear filters.

Screenshots

Light mode, two models loaded side by side:

API page, light mode

Dark mode:

API page, dark mode

Model rows: Run settings and API example icons beside each model:

Model rows with Run settings and API example icons

API example for gemma-3-270m, showing its recommended sampling (temperature 1, top_p 0.95, top_k 64):

API example dialog

Copy buttons fade in on hover without moving the row:

Model rows at rest and hovered

Verification

  • npm run typecheck, npm test (13099 pass, 0 fail), npm run build. Backend: pytest studio/backend/tests/test_sampling_defaults_route.py (2 pass). New frontend tests: api-monitor-snapshot.test.ts (snapshot sharing, tab counts, floating monitor polling), api-settings-tab.test.ts, an input/output case in api-monitor-throughput.test.ts, api-sampling-example.test.ts and a kept-model case in api-monitor-slots-settings-request.test.ts.
  • An isolated Unsloth Studio install built from this branch on macOS (CPU), with unsloth/SmolLM2-135M-Instruct-GGUF and unsloth/gemma-3-270m-it-GGUF (Q4_K_M) loaded side by side under "Keep multiple models loaded: When they fit". I sent requests naming each model, ejected the primary from its row (only that one unloaded, the page still read Ready), and opened Run settings for the kept model (its own page opens), and opened the API example for each model (SmolLM shows temperature 0.7, gemma temperature 1 and top_k 64, matching their recommendations).
  • Run settings clicked 8 times after Escape / an outside click and 4 times with the model list open: all 12 opened the settings page. Before the fix, every list-open attempt left the list showing.
  • Polling: with the tab hidden, 0 monitor requests in 6 s (4 while visible), and a request as soon as it shows again. Over three idle polls the log saw no DOM mutations.
  • Floating monitor: 5 s polls while closed, none while hidden, a request within 0.5 s of showing, and it opened itself on API key traffic, also after a round trip through the API page. A row click opened the API page with that request selected.
  • API settings: a new key appeared in the curl example right under it, Manage opened Remote & LAN, and that tab made no status requests while hidden.
  • Checked in light and dark mode, plus a phone-width layout.

Not covered here

  • GPU-backed loads (vLLM / SGLang run settings) and multi-slot queues under real load.
  • Pressing Run on a kept model's settings (the reload itself) was not exercised.
  • Starting remote or LAN access from the new status card's Manage path (only the off state was checked).

shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
shimmyshimmer added a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T09:13:46.016528Z b6f22c5 Manual request
🔒 Security Review ✅ Completed 2026-10-21T09:18:01.056846Z b6f22c5 Manual request

Security findings

Advisory findings (1)

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 10dddab7b5

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
…ng defaults, guarded primary Run settings, standalone GGUF settings key
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 21, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 2a1f84e8d0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex security review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: b6f22c5130

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: b6f22c5130

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Oct 21, 2026
@shimmyshimmer
shimmyshimmer merged commit 97d38c7 into main Oct 21, 2026
@shimmyshimmer
shimmyshimmer deleted the studio-api-page-redesign branch October 21, 2026 09:24
danielhanchen added a commit that referenced this pull request Oct 21, 2026
## Problem

Five checks fail on main, so the `Repo tests (CPU, studio)`, `Repo tests
(CPU, rest)` and `workflow-trigger lint` shards are red on every open PR
(for example #14472, #14482, #14488, #14490 and #14494). All five
reproduce on main `4d7ebf5cea`.

| Test | Introduced by | Fault |
|---|---|---|
|
`tests/security/test_lint_risky_loaders.py::test_the_tree_matches_the_baseline`
| #14437 | Baseline. Two new dynamic-import sites: `import_module` in
`studio/backend/core/rag/embeddings.py`, and a third
`import_from_string` in `unsloth/models/sentence_transformer.py`
(`_require_word_tokenizer`). Both are safe, see below. |
|
`tests/studio/test_tauri_branding_contract.py::test_desktop_surfaces_do_not_restore_studio_branding`
| #14473 | Product. "Studio" became "Unsloth Studio" in the Markdown
import errors and the Tauri webview reject message. The desktop contract
allows "Unsloth" there, never "Unsloth Studio". "Unsloth" meets both
#14473's rule (no bare "Studio") and this one. |
|
`tests/studio/test_usage_examples_model_source_contract.py::test_auto_switch_section_sits_above_the_usage_examples`
| #14455 | Test. The redesign moved the usage examples above the monitor
link on purpose, and its own `api-settings-tab.test.ts` pins that. |
|
`tests/studio/test_usage_examples_model_source_contract.py::test_monitor_can_unload_the_loaded_model`
| #14455 | Test. Unloading moved from a standalone button on the page
into the model picker's eject (`ApiModelLoadControls`). The `/unload`
path itself is unchanged. |
|
`tests/studio/test_settings_compact_overflow_contract.py::test_api_monitor_entries_and_expanded_text_can_shrink`
| #14455 | Test. Entry rows are now rounded cards (no `border-b`), and
the prompt/reply box's `rounded-lg` became conditional, so the class
literals the test matched are gone. The overflow guards themselves are
still in the source. |

## Fix

- **Risky loaders:** two baseline entries with reasons.
- `embeddings.py` imports only the three `sentence_transformers.models`
paths written out in a literal tuple, to wrap their `import_from_string`
with the trust gate.
- `_require_word_tokenizer` imports only after its caller has refused
any `tokenizer_class` outside `sentence_transformers.*`, and only dotted
identifiers.
- **Branding:** "Unsloth Studio" to "Unsloth" in those seven Markdown
import errors and the Rust reject message.
`conversation-markdown-import.test.ts` now matches `/Unsloth Markdown/`.
- **#14455 contracts:** rewritten to guard what the redesign keeps:
- the auto-switch section still follows the monitor link, and the usage
examples come before both;
- the page passes `unloadActiveModel` to the load controls as
`onUnloadActive`, and eject is withheld while `busy` (`modelLoading ||
unloading`, #11223's rule);
  - the `/unload` call still reads the internal id from status;
  - entry rows keep `w-full min-w-0`;
  - the prompt/reply box keeps `max-h-72 overflow-auto break-words`;
  - the model id keeps `min-w-0 break-all`.

## Verification

- The four Python files: 78 passed (5 failed on main).
- `studio/frontend/tests/conversation-markdown-import.test.ts`: 20
passed.
- Sabotage, each run against the rewritten tests, each failing exactly
one test:
- removing `min-w-0` from the entry row, or `break-words` from the text
box: the overflow test fails;
- dropping `unloading` from `busy`, or passing `onEject` while busy: the
unload test fails;
- putting the auto-switch section above the monitor link: the order test
fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant