Skip to content

Commit ff3543c

Browse files
authored
fix: construct provider options for mux-gateway provider (#972)
Fixes thinking not working for any model proxied via mux-gateway.
1 parent 7e1ef79 commit ff3543c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/common/utils/ai/providerOptions.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { log } from "@/node/services/log";
2121
import type { MuxMessage } from "@/common/types/message";
2222
import { enforceThinkingPolicy } from "@/browser/utils/thinking/policy";
23+
import { normalizeGatewayModel } from "./models";
2324

2425
/**
2526
* OpenRouter reasoning options
@@ -68,25 +69,23 @@ export function buildProviderOptions(
6869
): ProviderOptions {
6970
// Always clamp to the model's supported thinking policy (e.g., gpt-5-pro = HIGH only)
7071
const effectiveThinking = enforceThinkingPolicy(modelString, thinkingLevel);
71-
// Parse provider from model string
72-
const [provider] = modelString.split(":");
72+
// Parse provider from normalized model string
73+
const [provider, modelName] = normalizeGatewayModel(modelString).split(":", 2);
7374

7475
log.debug("buildProviderOptions", {
7576
modelString,
7677
provider,
78+
modelName,
7779
thinkingLevel,
7880
});
7981

80-
if (!provider) {
81-
log.debug("buildProviderOptions: No provider found, returning empty");
82+
if (!provider || !modelName) {
83+
log.debug("buildProviderOptions: No provider or model name found, returning empty");
8284
return {};
8385
}
8486

8587
// Build Anthropic-specific options
8688
if (provider === "anthropic") {
87-
// Extract model name from model string (e.g., "anthropic:claude-opus-4-5" -> "claude-opus-4-5")
88-
const [, modelName] = modelString.split(":");
89-
9089
// Check if this is Opus 4.5 (supports effort parameter)
9190
// Opus 4.5 uses the new "effort" parameter for reasoning control
9291
// All other Anthropic models use the "thinking" parameter with budgetTokens

0 commit comments

Comments
 (0)