Skip to content

Commit b5e82df

Browse files
committed
Hack to exclude thinking tokens by default
1 parent 0eab7f0 commit b5e82df

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/api/providers/openrouter.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH
7474

7575
let { id: modelId, maxTokens, temperature, topP, reasoning } = model
7676

77+
// OpenRouter sends reasoning tokens by default for Gemini 2.5 Pro
78+
// Preview even if you don't request them. This is not the default for
79+
// other providers (including Gemini), so we need to explicitly disable
80+
// i We should generalize this using the logic in `getModelParams`, but
81+
// this is easier for now.
82+
if (modelId === "google/gemini-2.5-pro-preview" && typeof reasoning === "undefined") {
83+
reasoning = { exclude: true }
84+
}
85+
7786
// Convert Anthropic messages to OpenAI format.
7887
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
7988
{ role: "system", content: systemPrompt },

0 commit comments

Comments
 (0)