Skip to content

Studio: API examples behind one tab row, an access group, API page fixes - #15467

Merged
shimmyshimmer merged 5 commits into
mainfrom
studio-api-settings-tabs
Oct 27, 2026
Merged

shimmyshimmer merged 5 commits into
mainfrom
studio-api-settings-tabs

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Studio: API examples behind one tab row, an access group, API page fixes

Settings > API

  • One tab row for every example. The Chat, Images / Video, Audio and Decision API sections, each with its own title, are now one untitled block behind a Library-style tab row (Hellix, an icon per tab, the active tab a raised pill). The API page's empty state uses the same row (shared ApiExampleTabNav).
  • Agents opens the Agents settings tab instead of showing an inline agent snippet, on both Settings > API and the API page. Decision and Agents are owner-only, like their section and tab.
  • Jump links removed. The row of shortcut chips above the token form duplicated the tabs. "Open in API" requests from Images, Audio and training (openMediaApi, openAudioApi, openDecisionTry) still select their tab, which mounts the card that takes the request, then scroll it into view. Settings search for the Images / Video, Audio or Decision API lands on the tab button, since each card renders only on its tab.
  • One "Access & monitoring" heading holds Agent access (MCP), Keyless API access (now a row with its Remote & LAN link) and the API monitor card with its auto-open toggle.
  • The "Load or download a model" note sits above the Basic / With tools / Advanced sampling toggle.

Decision API

  • Docs was baseline-aligned against the title, whose baseline is its icon's foot, so it sat low. The row is centred; with the title hidden (in the tab) Docs ends the description.
  • The settings rows are no longer boxed.
  • Open Connections works from the API page. It called setActiveTab, which does nothing with no settings dialog open; it now uses openDialog("connections").
  • The hosted-model note reads "To use a cloud hosted decision model, add TypeSafe, OpenRouter etc. in Connections." (English; other locales keep their wording.)

API page

  • On the native macOS titlebar the root insets non-chat pages by the titlebar height, so the API page's model picker sat a row below where Chat, Images, Video and Audio keep theirs. The sticky picker bar takes that inset back, and like Chat's header it is z-40 and click-through except the picker, so the empty row still drags the window.

Model hub Run

  • Measured from the rendered pixels (2x), the play triangle sat 0.75px low; it is recentred. "Run" is half a pixel above its ink centre so the low "un" reads centred. Text snaps to whole pixels, so this is a transform on the label, not padding.

API page model rows

  • The context, speed, total time and request facts hug their content with one 40px gap (fixed columns left a short value's slack before the next fact), their icons are 1em of the value beside them, and total time uses the scheduled-tasks clock, in the rows and the request log.
  • Context uses the same sans text-ui-12 as the other facts (it was mono) and is as wide as its text: a new fitContent prop on ContextUsageChip drops the ch widths, which assume the mono face and left about 22px of slack.
  • Multi-model hint. Keep multiple models loaded is off by default, so while it is off and at most one model is loaded the served-models line adds "Enable loading multiple models in Settings", which opens Settings > Resources > Model memory. It hides once the setting is on or two or more models are loaded, and waits for the setting's read so it never flashes for users who have it on. Managed accounts, which cannot open Resources, see "One model at a time" without a link.
  • The Saved load settings description is one line: "Requests naming these models load them with their saved Run settings. Forgetting one also removes it from the picker."

Appearance icon

  • Appearance uses Hugeicons BrushCleaningIcon in the settings nav, the sidebar menu and its customizer. It is in @hugeicons/core-free-icons from 4.3.5; this pins 4.1, so the MIT icon is vendored as lib/brush-cleaning-icon.ts rather than bumping the whole icon set.

Verification

  • npm run typecheck, npm test (14086 pass), npm run build.
  • Tests: api-settings-tab, decision-api-section, mcp-access-section updated; api-page-titlebar-row.test.ts and api-rows-and-appearance-icon.test.ts added.
  • Checked live in a local Studio with Playwright: each tab, Agents opening its tab, an "Open in API" style scroll target picking its tab, Decision with Docs inline and no box, Open Connections opening Settings > Connections from the API page, the access group, and the Run button's ink (24 / 24 device px around the triangle, 25 / 27 around the label), the multi-model hint with one and no models (link landing on Model memory) and hidden with five models or the setting on.
  • The macOS titlebar row was checked by applying the native chrome CSS variables in the browser (picker at 11px on both Chat and the API page); the Desktop app itself was not built here, so window dragging in that row is not exercised.

- Settings > API: one untitled Library-style tab row (Chat, Images / Video,
  Audio, Decision, Agents) replaces a section per API and the jump links above
  the token form. Agents opens the Agents settings tab. "Open in API" requests
  pick their tab; settings search lands on the tab button.
- MCP, keyless API access and the API monitor sit under one heading.
- The no-model note sits above the Basic / With tools toggle.
- Decision API: Docs centred beside the title (beside the description when the
  title is hidden), rows unboxed, Open Connections works from the API page, and
  the hosted-model note reads "To use a cloud hosted decision model...".
- API page: the model picker sits in the native macOS titlebar row, as Chat's.
- Model hub Run: the triangle recentred and the label nudged half a pixel up,
  measured from the rendered ink.
- Appearance uses Hugeicons BrushCleaningIcon (MIT; in core-free-icons from
  4.3.5, vendored as lib/brush-cleaning-icon.ts since this pins 4.1) in the
  settings nav, the sidebar menu and its customizer.
- API page served-model rows: the context, speed, time and request facts hug
  their content with one 32px gap, their icons are 1em of the value beside
  them, and total time uses the scheduled-tasks clock (also in the log).
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 27, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-27T03:00:01.884891Z a711924 Manual request
ℹ️ 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

Copy link
Copy Markdown

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

Reviewed commit: a711924d62

ℹ️ 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".

…e-model users to multi-model loading

Context on the API page's model rows now uses the same sans text-ui-12 as speed, time and requests, sized to its text; the facts sit 40px apart. While Keep multiple models loaded is off and at most one model is loaded, the served-models line links to Settings > Resources > Model memory. The Saved load settings description is shorter.
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 27, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 27, 2026
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 27, 2026
@shimmyshimmer
shimmyshimmer merged commit 9fb0221 into main Oct 27, 2026
0 of 39 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-api-settings-tabs branch October 27, 2026 03:23
danielhanchen added a commit that referenced this pull request Oct 27, 2026
…s group (#15500)

## Problem

`Repo tests (CPU, studio)` fails on main since #15467, so every PR based
on it inherits two failures (#15482 today):

```
tests/studio/test_settings_compact_overflow_contract.py::test_settings_monitor_link_can_shrink
E   assert '<SettingsSection title={t("settings.resources.liveMonitor.apiTitle")}>' in '...'
tests/studio/test_usage_examples_model_source_contract.py::test_auto_switch_section_sits_below_the_monitor_link
E   ValueError: substring not found
```

Bisected locally: both pass at 9fb0221~1 and fail from 9fb0221
(#15467) onwards.

## Product or test

The tests. #15467 reorganised the API page on purpose:

- `MonitorLink` takes `hideHeading`. Its `SettingsSection` keeps the
same title, now with a second prop on its own line.
- The API tab renders `<MonitorLink hideHeading={true} />` inside a new
titled `<SettingsSection title="Access & monitoring">`.
- The usage examples now render inside `ApiExamplesPanel`.

Both tests matched the old spellings: the one-line `<SettingsSection
title={...}>`, the bare `<MonitorLink />` and `<UsageExamples`. The
invariants they guard still hold on main:

- the monitor never lands as a bare card among other sections
- the examples come before the monitor link, which comes before
auto-switch

## Fix

- `test_settings_monitor_link_can_shrink`:
- checks that `MonitorLink` renders its own `SettingsSection` titled
`settings.resources.liveMonitor.apiTitle`, whatever other props it takes
- new: wherever a settings page renders `<MonitorLink hideHeading ...>`,
it must sit inside an open, titled `SettingsSection`
- `test_auto_switch_section_sits_below_the_monitor_link`: same order
(`UsageExamples` or `ApiExamplesPanel`, then `MonitorLink`, then
`ModelAutoSwitchSection`), matched by tag name instead of exact
spelling.

## Verification

- Both files: 22 passed (2 failed on main).
- Sabotage on main's sources, one at a time, each fails:
- `<MonitorLink hideHeading={true} />` moved out of its
`SettingsSection`
  - `<ModelAutoSwitchSection />` removed
  - the monitor section title changed
- ruff format and check are clean.
shimmyshimmer added a commit that referenced this pull request Oct 29, 2026
…amples (#15890)

## What changed

After you create an API token on Settings > API, the commands and
examples that need it now include it again, so you can copy them
straight into a terminal.

Reported on r/unsloth: creating a token used to fill it into the
commands for connecting clients, but after #15467 the API page's Agents
tab only links to Settings > Agents, whose command never carried a
token. The Settings > API examples also lost the token as soon as you
left that tab.

- **Settings > Agents:** the generated command and the subagent setup
command get `--api-key <new token>` when Studio is reached on a
non-loopback address (LAN, tunnel). Loopback stays keyless, since the
CLI mints its own key there. Only a token created in this page session
is used: an explicit key is cached by the CLI per server, so a stale one
would replace a working saved key.
- **Settings > API:** the Chat, Images / Video and Audio examples and
the Agent access (MCP) section keep the new token after you switch tabs,
close Settings, or press Done on the token card. They used to read it
from the API tab's own state, which only one tab at a time keeps
mounted.
- **API page (monitor):** the "No API traffic yet" examples and the
per-model example request dialog use the new token instead of
`sk-unsloth-YOUR_KEY`, and the example box is redacted from reload
snapshots when it holds a real token.

The token lives in a small in-memory store (`fresh-api-key-store.ts`):
never persisted, gone on reload, and dropped when that token is revoked
(matched on its `key_prefix`). The one-time "Your token" card is
unchanged.

Settings > Agents right after creating a token, opened on a non-loopback
address. The token is masked in the screenshot.

![Agents
command](https://raw.githubusercontent.com/shimmyshimmer/unsloth-staging-4/pr-media/pr/15890/agents_before_after-ff5436ea847a.png)

Settings > API after switching to Remote & LAN and back, and the API
page's examples.

![API
examples](https://raw.githubusercontent.com/shimmyshimmer/unsloth-staging-4/pr-media/pr/15890/api_examples_before_after-5ab1c563487a.png)

## How it was verified

- `npm run typecheck`, `npm run build`, `npm test` (14377 pass, 0 fail).
New `tests/agents-fresh-api-key.test.ts` covers the command with and
without a fresh key, loopback staying keyless, revoke only dropping the
matching token, and the Settings > API and API page wiring. Two layout
tests that named the old `revealed` variable now name `freshKey`.
- Local Studio from this branch, opened through a non-loopback hostname
mapped to 127.0.0.1 so the commands take their LAN form: create a token,
then Settings > Agents, Settings > API after switching tabs, and the API
page. Same steps on the base bundle show no token / the placeholder.

## Not tested here

Windows PowerShell commands were not run (same builder path, covered by
the existing shell tests). A real LAN or tunnel client was not
connected.
shimmyshimmer added a commit that referenced this pull request Oct 29, 2026
## What changed

Settings > API gets a "Quickstart" heading over the Chat / Images /
Video / Audio / Decision / Agents tab row, styled like "Access tokens"
above it, so the ready-to-run examples read as their own section instead
of trailing off the token list.

The heading is translated in every locale
(`settings.apiKeys.quickstartTitle`). The cards under the tabs stay
untitled, as #15467 set up; the test that pinned an untitled block now
expects exactly this one heading and still no per-card titles.

Settings > API, left is main, right is this branch.

![Before and
after](https://raw.githubusercontent.com/shimmyshimmer/unsloth-staging-4/pr-media/pr/15898/quickstart_before_after-7a4ce12e021b.png)

## How it was verified

- `npm run typecheck`, `npm run build`, `npm test` (14371 pass, 0 fail).
- Local Studio: Settings > API, compared against the `main` bundle.
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