Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: keep a user-set Hermes api_key in unsloth start hermes (#17320)
Nilayb71ee2a1d633
diff --git a/unsloth_cli/commands/start.py b/unsloth_cli/commands/start.pyindex c70f2dbf342..08bed037c65 100644--- a/unsloth_cli/commands/start.py+++ b/unsloth_cli/commands/start.py@@ -6088,12 +6088,13 @@ def _set_hermes_provider(legacy = providers.get(_HERMES_LEGACY_PROVIDER)if isinstance(legacy, dict) and legacy.get("key_env") == _HERMES_ENV_KEY:del providers[_HERMES_LEGACY_PROVIDER]- providers[_HERMES_PROVIDER] = {- "base_url": f"{base}/v1",- "api_mode": "openai",- "key_env": _HERMES_ENV_KEY,- **({"extra_body": request_body} if request_body else {}),- }+ # Merge, not replace: Hermes refuses to resume a session once a field it froze on this entry (a user's api_key) is gone.+ provider = _subdict(providers, _HERMES_PROVIDER)+ provider.update(base_url = f"{base}/v1", api_mode = "openai", key_env = _HERMES_ENV_KEY)+ if request_body:+ provider["extra_body"] = request_body+ else:+ provider.pop("extra_body", None)def _hermes_mcp_manifest(home: Path) -> tuple:diff --git a/unsloth_cli/tests/test_start.py b/unsloth_cli/tests/test_start.pyindex ced47008fc1..31774b7175e 100644--- a/unsloth_cli/tests/test_start.py+++ b/unsloth_cli/tests/test_start.py@@ -7626,6 +7626,30 @@ def test_write_hermes_config_preserves_and_idempotent(hermes_config):assert hermes_config.read_text() == before+def test_write_hermes_config_keeps_user_fields_on_the_provider(hermes_config):+ yaml = pytest.importorskip("yaml")+ start.write_hermes_config(BASE, MODEL, hermes_config, {"temperature": 0.2})+ config = yaml.safe_load(hermes_config.read_text())+ config["providers"]["unsloth-studio"]["api_key"] = "${MY_STATIC_KEY}"+ config["providers"]["unsloth-studio"]["base_url"] = "http://stale:1/v1"+ hermes_config.write_text(yaml.safe_dump(config, sort_keys = False))+ start.write_hermes_config(BASE, MODEL, hermes_config)+ assert yaml.safe_load(hermes_config.read_text())["providers"]["unsloth-studio"] == {+ "base_url": f"{BASE}/v1",+ "api_mode": "openai",+ "key_env": "UNSLOTH_API_KEY",+ "api_key": "${MY_STATIC_KEY}",+ }+++def test_write_hermes_config_replaces_a_non_mapping_provider(hermes_config):+ yaml = pytest.importorskip("yaml")+ hermes_config.write_text(yaml.safe_dump({"providers": {"unsloth-studio": "broken"}}))+ start.write_hermes_config(BASE, MODEL, hermes_config)+ provider = yaml.safe_load(hermes_config.read_text())["providers"]["unsloth-studio"]+ assert provider["key_env"] == "UNSLOTH_API_KEY"++def test_write_hermes_config_preserves_non_mapping_file(hermes_config, capsys):pytest.importorskip("yaml")original = "- just\n- a\n- list\n"