Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/common/utils/ai/providerOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
import { log } from "@/node/services/log";
import type { MuxMessage } from "@/common/types/message";
import { enforceThinkingPolicy } from "@/browser/utils/thinking/policy";
import { normalizeGatewayModel } from "./models";

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

log.debug("buildProviderOptions", {
modelString,
provider,
modelName,
thinkingLevel,
});

if (!provider) {
log.debug("buildProviderOptions: No provider found, returning empty");
if (!provider || !modelName) {
log.debug("buildProviderOptions: No provider or model name found, returning empty");
return {};
}

// Build Anthropic-specific options
if (provider === "anthropic") {
// Extract model name from model string (e.g., "anthropic:claude-opus-4-5" -> "claude-opus-4-5")
const [, modelName] = modelString.split(":");

// Check if this is Opus 4.5 (supports effort parameter)
// Opus 4.5 uses the new "effort" parameter for reasoning control
// All other Anthropic models use the "thinking" parameter with budgetTokens
Expand Down