Skip to content

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.

Studio: keep Think off working on Claude Opus 5.5 and Sonnet 5.5 (#13104)

Nilay264eec55213d
diff --git a/studio/backend/core/inference/external_provider.py b/studio/backend/core/inference/external_provider.py
index e148e7a5b7e..9de1262a8b6 100644
--- a/studio/backend/core/inference/external_provider.py
+++ b/studio/backend/core/inference/external_provider.py
@@ -519,9 +519,7 @@ def _extract_web_search_action(item: dict[str, Any]) -> dict[str, Any]:
return arguments
-# Families that accept `prompt_cache_retention: "24h"`. Everything else 400s with "prompt_cache_retention is not
-# supported on this model" and the turn dies (openai/codex#39397), while an unmatched model just falls back to
-# in-memory caching -- so guess narrow.
+# unsupported families return 400 for `prompt_cache_retention`; omit it to retain in-memory caching.
_OPENAI_EXTENDED_CACHE_FAMILY = re.compile(r"^(?:gpt-5(?:\.\d+)?(?:[-.]|$)|gpt-4\.1$)")
@@ -529,20 +527,27 @@ class _AnthropicThinkingSpec(NamedTuple):
prefixes: tuple[str, ...]
kind: Literal["adaptive", "manual"]
efforts: tuple[str, ...]
- # Claude 5 thinks unless told otherwise, so "Thinking: off" must send an explicit disable. Fable/Mythos 5 400 on
- # it (thinking is always on).
+ # off must be explicit; Fable/Mythos 5 and Opus 5.5 reject it; Sonnet 5.5 uses `between_tools`.
thinking_default_on: bool = False
can_disable: bool = True
+ disable_type: str = "disabled"
_ANTHROPIC_THINKING_SPECS = (
_AnthropicThinkingSpec(
- prefixes = ("claude-fable-5", "claude-mythos-5"),
+ prefixes = ("claude-fable-5", "claude-mythos-5", "claude-opus-5-5"),
kind = "adaptive",
efforts = ("none", "low", "medium", "high", "xhigh", "max"),
thinking_default_on = True,
can_disable = False,
),
+ _AnthropicThinkingSpec(
+ prefixes = ("claude-sonnet-5-5",),
+ kind = "adaptive",
+ efforts = ("none", "low", "medium", "high", "xhigh", "max"),
+ thinking_default_on = True,
+ disable_type = "between_tools",
+ ),
_AnthropicThinkingSpec(
prefixes = ("claude-opus-5", "claude-sonnet-5"),
kind = "adaptive",
@@ -2876,22 +2881,19 @@ class ExternalProviderClient:
effort = "none"
elif enable_thinking is True:
effort = "medium"
- # Models that think by default need an explicit disable; omitting the field leaves thinking on. Anthropic only
- # accepts it at effort <= high, so send it alone (server default effort is high).
+ # send default-on disables alone: Anthropic defaults to valid `high` effort, while higher efforts reject them.
if (
effort == "none"
and thinking_spec
and thinking_spec.thinking_default_on
and thinking_spec.can_disable
):
- body["thinking"] = {"type": "disabled"}
- # Normalize one semantic Thinking control into Anthropic's two model-era APIs: adaptive effort on Claude 4.6+,
- # manual budget_tokens on 4.5.
+ body["thinking"] = {"type": thinking_spec.disable_type}
+ # the shared control maps to adaptive effort on Claude 4.6+ and manual `budget_tokens` on Claude 4.5.
if effort and effort != "none":
- # Anthropic rejects top_k whenever thinking is enabled.
+ # Anthropic rejects `top_k` while thinking is enabled.
body.pop("top_k", None)
- # 4.5/4.6 require temperature=1 with thinking and forbid top_p in the same request; 4.7 removed
- # temperature entirely (any value 400s), so skip the override there.
+ # Claude 4.5/4.6 require `temperature=1` and forbid `top_p` with thinking; Claude 4.7 rejects temperature.
if not sampling_removed:
body["temperature"] = 1
body.pop("top_p", None)
@@ -2899,9 +2901,7 @@ class ExternalProviderClient:
thinking_spec is None and _anthropic_model_newer_than_specs(model)
)
if adaptive:
- # Force display="summarized": it defaults to "omitted" on Opus 4.7, which emits an empty thinking
- # block and leaves the panel blank. Harmless no-op on 4.6. An unlisted id older than that gets no
- # thinking field, since Claude 4.5 and earlier reject the adaptive shape.
+ # summarized display prevents blank Opus 4.7 panels; unlisted older models reject adaptive thinking.
body["thinking"] = {"type": "adaptive", "display": "summarized"}
# Adaptive effort lives under `output_config.effort`, not top-level (top-level 400s "Extra inputs are
# not permitted"). Allowed: low|medium|high|xhigh|max.
diff --git a/studio/backend/tests/test_anthropic_thinking_translation.py b/studio/backend/tests/test_anthropic_thinking_translation.py
index 075c09a158c..ab56ab9d9ff 100644
--- a/studio/backend/tests/test_anthropic_thinking_translation.py
+++ b/studio/backend/tests/test_anthropic_thinking_translation.py
@@ -499,18 +499,31 @@ def test_claude_5_uses_adaptive_thinking_and_effort(monkeypatch, model):
def test_thinking_off_disables_explicitly_on_opus_5(monkeypatch):
- """Opus 5 thinks by default, so "off" must send an explicit disable."""
+ """Opus 5 defaults to thinking, so off requires an explicit disable."""
body = _capture_body(monkeypatch, model = "claude-opus-5", enable_thinking = False)
assert body["thinking"] == {"type": "disabled"}
assert "output_config" not in body
def test_thinking_off_omits_disable_on_fable_5(monkeypatch):
- """Fable 5 thinking is always on and 400s on an explicit disable."""
+ """Fable 5 always thinks and rejects explicit disable requests with HTTP 400."""
body = _capture_body(monkeypatch, model = "claude-fable-5", enable_thinking = False)
assert "thinking" not in body
[email protected]("off", ({"enable_thinking": False}, {"reasoning_effort": "none"}))
+def test_thinking_off_on_sonnet_5_5_sends_between_tools(monkeypatch, off):
+ body = _capture_body(monkeypatch, model = "claude-sonnet-5-5", **off)
+ assert body["thinking"] == {"type": "between_tools"}
+ assert "output_config" not in body
+
+
[email protected]("off", ({"enable_thinking": False}, {"reasoning_effort": "none"}))
+def test_thinking_off_omits_disable_on_opus_5_5(monkeypatch, off):
+ body = _capture_body(monkeypatch, model = "claude-opus-5-5", **off)
+ assert "thinking" not in body
+
+
@pytest.mark.parametrize(
("model", "web", "code", "compaction", "fast"),
(
diff --git a/studio/frontend/src/features/chat/api/chat-adapter.ts b/studio/frontend/src/features/chat/api/chat-adapter.ts
index 4128888811d..981b7631f4f 100644
--- a/studio/frontend/src/features/chat/api/chat-adapter.ts
+++ b/studio/frontend/src/features/chat/api/chat-adapter.ts
@@ -6149,7 +6149,11 @@ export function createOpenAIStreamAdapter(
// A carried thought is reasoning whatever this request's thinking setting says.
setParseThink(
isExternalRequest
- ? requestParsesThinkTags(externalReasoningFields)
+ ? requestParsesThinkTags({
+ ...externalReasoningFields,
+ provider_type: externalProvider?.providerType,
+ external_model: externalSelection?.modelId,
+ })
: reasoningAlwaysOn ||
Boolean(resumedThought) ||
requestParsesThinkTags(localReasoningFields),
diff --git a/studio/frontend/src/features/chat/provider-capabilities.ts b/studio/frontend/src/features/chat/provider-capabilities.ts
index f891e3fdc79..087c9ce741f 100644
--- a/studio/frontend/src/features/chat/provider-capabilities.ts
+++ b/studio/frontend/src/features/chat/provider-capabilities.ts
@@ -836,8 +836,8 @@ const NO_REASONING_CAPS: ReasoningCaps = {
const ANTHROPIC_REASONING_MODELS = [
{
- // Fable / Mythos 5 always think: `thinking.type "disabled"` 400s, so there is no off switch.
- prefixes: ["claude-fable-5", "claude-mythos-5"],
+ // Fable, Mythos 5, and Opus 5.5 return 400 for disabled thinking; no off switch.
+ prefixes: ["claude-fable-5", "claude-mythos-5", "claude-opus-5-5"],
supportsOff: false,
levels: ["low", "medium", "high", "xhigh", "max"],
},
diff --git a/studio/frontend/src/features/chat/utils/chat-generation-recovery.ts b/studio/frontend/src/features/chat/utils/chat-generation-recovery.ts
index cd4756fd153..cdd085a9ea7 100644
--- a/studio/frontend/src/features/chat/utils/chat-generation-recovery.ts
+++ b/studio/frontend/src/features/chat/utils/chat-generation-recovery.ts
@@ -406,7 +406,16 @@ export function requestParsesThinkTags(payload: {
enable_thinking?: boolean | null;
reasoning_effort?: string | null;
thinking?: { type?: string } | null;
+ provider_type?: string | null;
+ external_model?: string | null;
+ model?: string | null;
}): boolean {
+ const provider = payload.provider_type?.trim().toLowerCase();
+ const model = (payload.external_model ?? payload.model)?.trim().toLowerCase();
+ const sonnet55BetweenTools =
+ provider === "anthropic" &&
+ (model === "claude-sonnet-5-5" || model?.startsWith("claude-sonnet-5-5-") === true);
+ if (sonnet55BetweenTools) return true;
return !(
payload.thinking?.type === "disabled" ||
payload.enable_thinking === false ||
diff --git a/studio/frontend/tests/literal-think-when-thinking-off.test.ts b/studio/frontend/tests/literal-think-when-thinking-off.test.ts
index 59eb4d41f22..b4f5c0b3e17 100644
--- a/studio/frontend/tests/literal-think-when-thinking-off.test.ts
+++ b/studio/frontend/tests/literal-think-when-thinking-off.test.ts
@@ -119,6 +119,32 @@ test("a recovery before the first client save reads the choice from the request"
);
assert.equal(requestParsesThinkTags({ reasoning_effort: "low" }), true);
assert.equal(requestParsesThinkTags({}), true);
+ for (const model of [
+ "claude-sonnet-5-5",
+ "claude-sonnet-5-5-20261001",
+ "CLAUDE-SONNET-5-5",
+ ]) {
+ assert.equal(
+ requestParsesThinkTags({
+ provider_type: "anthropic",
+ external_model: model,
+ reasoning_effort: "none",
+ }),
+ true,
+ model,
+ );
+ }
+ for (const model of ["claude-opus-5-5", "claude-sonnet-5-50"]) {
+ assert.equal(
+ requestParsesThinkTags({
+ provider_type: "anthropic",
+ external_model: model,
+ reasoning_effort: "none",
+ }),
+ false,
+ model,
+ );
+ }
const { raw, carried } = generationRawContent([]);
const replayed = `${raw}Use <think>hi</think> in your prompt.`;
@@ -166,7 +192,7 @@ test("the adapter and recovery follow the turn's think parse state", () => {
assert.match(
adapter,
// A resumed thought is reasoning whatever the request's own setting says.
- /setParseThink\(\s*isExternalRequest\s*\? requestParsesThinkTags\(externalReasoningFields\)\s*: reasoningAlwaysOn \|\|\s*Boolean\(resumedThought\) \|\|\s*requestParsesThinkTags\(localReasoningFields\),\s*\);/,
+ /setParseThink\(\s*isExternalRequest\s*\? requestParsesThinkTags\(\{\s*\.\.\.externalReasoningFields,\s*provider_type: externalProvider\?\.providerType,\s*external_model: externalSelection\?\.modelId,\s*\}\)\s*: reasoningAlwaysOn \|\|\s*Boolean\(resumedThought\) \|\|\s*requestParsesThinkTags\(localReasoningFields\),\s*\);/,
"the live stream and recovery must read thinking off from the same request fields",
);
assert.match(adapter, /\.\.\.externalReasoningFields,/);
diff --git a/studio/frontend/tests/provider-capabilities-current-models.test.ts b/studio/frontend/tests/provider-capabilities-current-models.test.ts
index 96777d033fd..ce3b2855fc5 100644
--- a/studio/frontend/tests/provider-capabilities-current-models.test.ts
+++ b/studio/frontend/tests/provider-capabilities-current-models.test.ts
@@ -58,18 +58,27 @@ test("Claude 5 and Opus 4.8 expose the adaptive effort ladder", () => {
});
test("Fable 5 thinks always, so no off switch is offered", () => {
- // `thinking.type: "disabled"` 400s on Fable/Mythos 5
+ // Fable/Mythos 5 reject `thinking.type: "disabled"` with HTTP 400
const caps = getExternalReasoningCapabilities("anthropic", "claude-fable-5");
assert.equal(caps.supportsReasoning, true);
assert.equal(caps.supportsReasoningOff, false);
assert.ok(![...caps.reasoningEffortLevels].includes("none"));
});
+test("Opus 5.5 cannot turn thinking off, Sonnet 5.5 can", () => {
+ const opus = getExternalReasoningCapabilities("anthropic", "claude-opus-5-5");
+ assert.equal(opus.supportsReasoning, true);
+ assert.equal(opus.supportsReasoningOff, false);
+ assert.ok(![...opus.reasoningEffortLevels].includes("none"));
+ const sonnet = getExternalReasoningCapabilities("anthropic", "claude-sonnet-5-5");
+ assert.equal(sonnet.supportsReasoningOff, true);
+});
+
test("fast mode is offered on Opus 5 / 4.8 and nowhere else", () => {
for (const model of ["claude-opus-5", "claude-opus-4-8-2026-02-01"]) {
assert.equal(providerSupportsFastMode("anthropic", model), true, model);
}
- // 4.7 errors on `speed`; 4.6 accepts it but answers at standard speed
+ // 4.7 rejects `speed`; 4.6 accepts it without changing response speed
for (const model of ["claude-opus-4-7", "claude-opus-4-6", "claude-sonnet-5"]) {
assert.equal(providerSupportsFastMode("anthropic", model), false, model);
}