Repository navigation
Studio: hint at Model auto-switch in the OpenAI "No model loaded" 400 - #7006
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a helper function _no_model_loaded_detail in inference.py to append a helpful hint about enabling the 'Model auto-switch' toggle to 'no model loaded' error messages when the feature is disabled. This helper is integrated into several endpoints, including audio generation, OpenAI completions/embeddings, Anthropic messages, and responses streaming. Additionally, corresponding unit tests have been added to verify this behavior under different configuration states. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e118319017
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if not get_inference_backend().active_model_name: | ||
| detail = _no_model_loaded_detail(detail) |
There was a problem hiding this comment.
Show the auto-switch hint when a non-GGUF model is active
This suppresses the new hint for every streaming /v1/responses request while a Transformers/non-GGUF model is active, but that includes a fixable case: openai_responses already calls _maybe_auto_switch_model before _responses_stream, and with auto-switch enabled a request whose model resolves to a downloaded GGUF will load it even over an active non-GGUF backend. With the toggle off, the same request still hits this GGUF-only 400 without the hint, so users naming a listed local GGUF get the bare error this change is meant to clarify.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 42cd52f: dropped the active_model_name gate, so the hint attaches whenever the toggle is off, matching the other no-model-loaded call sites (auto-switch's resolver branch does evict an active non-GGUF model to load a resolved GGUF).
|
@codex review |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Studio can already auto-load a requested model over the API before serving it, but it's opt-in and off by default (Model auto-switch, shipped in #6392/#6430). With it off, calling
/v1/chat/completionswith a model that/v1/modelslists returns a bare400 No model loaded. Call POST /inference/load first., and nothing tells you the toggle that fixes it exists. Users keep hitting this and reporting it (Discord).Fix
When auto-switch is off, the "no model loaded" error now adds a pointer to the toggle:
Turn the toggle on and the same request loads the model and serves it. The hint only shows when it would actually help. With auto-switch already on, hitting the error means the requested name just didn't match a downloaded model, so the pointer would be misleading and is left off.
The same hint now covers the other endpoints where auto-switch applies too, not just chat:
/v1/completions,/v1/embeddings, and the Anthropic/v1/messagesand/v1/messages/count_tokens. Streaming/v1/responsesgets it only when nothing is loaded at all, since that error also fires when a non-GGUF model is already up (where enabling auto-switch wouldn't change anything). The in-app UI routes are unchanged.Verification
Ran Studio and hit each endpoint live. With auto-switch off the hint shows up; with it on and an unrecognized model name it stays off. Added regression tests for both cases, including the streaming
/v1/responsesbehavior.test_openai_auto_switch.pypasses (150).