feat: gemini 3 in openrouter#1454
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for Gemini 3's reasoning details feature in OpenRouter integration. The changes enable the handling of extended thinking/reasoning information from models that support this capability.
Key Changes:
- Added
reasoning_detailsfield to the Message interface to support Gemini 3's reasoning output - Updated OpenRouter response types and transformation logic to handle reasoning details
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/types/requestBody.ts | Added optional reasoning_details field to Message interface with documentation |
| src/providers/openrouter/chatComplete.ts | Extended OpenRouter response types and transform logic to include reasoning_details in content blocks and message output |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| tool_call_id?: string; | ||
| citationMetadata?: CitationMetadata; | ||
| /** Reasoning details for models that support extended thinking/reasoning. (Gemini) */ | ||
| reasoning_details?: any[]; |
There was a problem hiding this comment.
The reasoning_details field uses any[] which reduces type safety. Consider defining a proper interface or type for reasoning details to ensure type correctness and improve maintainability. For example: reasoning_details?: ReasoningDetail[] where ReasoningDetail is a defined interface.
| choices: (ChatChoice & { message: Message & { reasoning: string } })[]; | ||
| choices: (ChatChoice & { message: Message & { | ||
| reasoning: string; | ||
| reasoning_details?: any[] |
There was a problem hiding this comment.
The reasoning_details field uses any[] which reduces type safety. This should match the type definition in the Message interface. Consider using a properly typed interface instead of any[] to ensure consistency and type safety across the codebase.
| reasoning_details?: any[] | |
| reasoning_details?: Message['reasoning_details'] |
| content_blocks.push({ | ||
| type: 'thinking', | ||
| thinking: c.message.reasoning, | ||
| ...(c.message.reasoning_details && { reasoning_details: c.message.reasoning_details }), |
There was a problem hiding this comment.
The reasoning_details are being added to the thinking content block, but it's unclear if this is the appropriate location. Consider whether reasoning_details should only be included at the message level (line 218) or if duplication in both the content block and message is intentional. If both are needed, add a comment explaining why.
| ...(c.message.reasoning_details && { reasoning_details: c.message.reasoning_details }), |
|
Hi @stefan-jiroveanu , can you please fix the formatting with |
|
Should be formatted now |
Description: : Added support for gemini 3 in openrouter
https://openrouter.ai/google/gemini-3-pro-preview
Tests Run/Test cases added: (required)
nan
Type of Change: