Skip to content

Commit 7939d06

Browse files
committed
fix: add minimax-m2 to reasoning_details models for OpenRouter
1 parent fe1a9f5 commit 7939d06

File tree

3 files changed

+26
-41
lines changed

3 files changed

+26
-41
lines changed

packages/types/src/providers/openrouter.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,3 @@ export const OPEN_ROUTER_REASONING_BUDGET_MODELS = new Set([
8383
"anthropic/claude-3.7-sonnet:thinking",
8484
"google/gemini-2.5-flash-preview-05-20:thinking",
8585
])
86-
87-
// Models that use the reasoning_details array format instead of the legacy reasoning string format
88-
// These models return reasoning in delta.reasoning_details[] structure
89-
// See: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks
90-
export const OPEN_ROUTER_REASONING_DETAILS_MODELS = new Set(["google/gemini-3-pro-preview"])

src/api/providers/fetchers/openrouter.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
isModelParameter,
77
OPEN_ROUTER_REASONING_BUDGET_MODELS,
88
OPEN_ROUTER_REQUIRED_REASONING_BUDGET_MODELS,
9-
OPEN_ROUTER_REASONING_DETAILS_MODELS,
109
anthropicModels,
1110
} from "@roo-code/types"
1211

@@ -267,11 +266,5 @@ export const parseOpenRouterModel = ({
267266
modelInfo.maxTokens = 32768
268267
}
269268

270-
// Enable preserveReasoning for models that use reasoning_details array format
271-
// This ensures reasoning_details are stored and sent back in multi-turn conversations
272-
if (OPEN_ROUTER_REASONING_DETAILS_MODELS.has(id)) {
273-
modelInfo.preserveReasoning = true
274-
}
275-
276269
return modelInfo
277270
}

src/api/providers/openrouter.ts

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
openRouterDefaultModelInfo,
77
OPENROUTER_DEFAULT_PROVIDER_NAME,
88
OPEN_ROUTER_PROMPT_CACHING_MODELS,
9-
OPEN_ROUTER_REASONING_DETAILS_MODELS,
109
DEEP_SEEK_DEFAULT_TEMPERATURE,
1110
} from "@roo-code/types"
1211

@@ -230,39 +229,37 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
230229
yield { type: "reasoning", text: delta.reasoning }
231230
}
232231

233-
// Handle reasoning_details array format for models that use it (Gemini 3, etc.)
232+
// Handle reasoning_details array format (used by Gemini 3, Claude, OpenAI o-series, etc.)
234233
// See: https://openrouter.ai/docs/use-cases/reasoning-tokens#preserving-reasoning-blocks
235-
if (OPEN_ROUTER_REASONING_DETAILS_MODELS.has(modelId)) {
236-
const deltaWithReasoning = delta as typeof delta & {
237-
reasoning_details?: Array<{
238-
type: string
239-
text?: string
240-
summary?: string
241-
data?: string
242-
id?: string | null
243-
format?: string
244-
index?: number
245-
}>
246-
}
234+
const deltaWithReasoning = delta as typeof delta & {
235+
reasoning_details?: Array<{
236+
type: string
237+
text?: string
238+
summary?: string
239+
data?: string
240+
id?: string | null
241+
format?: string
242+
index?: number
243+
}>
244+
}
247245

248-
if (deltaWithReasoning.reasoning_details && Array.isArray(deltaWithReasoning.reasoning_details)) {
249-
for (const detail of deltaWithReasoning.reasoning_details) {
250-
// Store the full reasoning detail object for later use
251-
this.currentReasoningDetails.push(detail)
246+
if (deltaWithReasoning.reasoning_details && Array.isArray(deltaWithReasoning.reasoning_details)) {
247+
for (const detail of deltaWithReasoning.reasoning_details) {
248+
// Store the full reasoning detail object for later use
249+
this.currentReasoningDetails.push(detail)
252250

253-
let reasoningText: string | undefined
251+
let reasoningText: string | undefined
254252

255-
// Extract text based on reasoning detail type for display
256-
if (detail.type === "reasoning.text" && typeof detail.text === "string") {
257-
reasoningText = detail.text
258-
} else if (detail.type === "reasoning.summary" && typeof detail.summary === "string") {
259-
reasoningText = detail.summary
260-
}
261-
// Note: reasoning.encrypted types are intentionally skipped as they contain redacted content
253+
// Extract text based on reasoning detail type for display
254+
if (detail.type === "reasoning.text" && typeof detail.text === "string") {
255+
reasoningText = detail.text
256+
} else if (detail.type === "reasoning.summary" && typeof detail.summary === "string") {
257+
reasoningText = detail.summary
258+
}
259+
// Note: reasoning.encrypted types are intentionally skipped as they contain redacted content
262260

263-
if (reasoningText) {
264-
yield { type: "reasoning", text: reasoningText }
265-
}
261+
if (reasoningText) {
262+
yield { type: "reasoning", text: reasoningText }
266263
}
267264
}
268265
}

0 commit comments

Comments
 (0)