Skip to content

feat: gemini 3 in openrouter#1454

Merged
VisargD merged 4 commits into
Portkey-AI:mainfrom
turintech:feat/gemini-3-openrouter
Dec 8, 2025
Merged

feat: gemini 3 in openrouter#1454
VisargD merged 4 commits into
Portkey-AI:mainfrom
turintech:feat/gemini-3-openrouter

Conversation

@stefan-jiroveanu

@stefan-jiroveanu stefan-jiroveanu commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

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:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

@roh26it roh26it requested review from Copilot and narengogi November 29, 2025 01:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_details field 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.

Comment thread src/types/requestBody.ts
tool_call_id?: string;
citationMetadata?: CitationMetadata;
/** Reasoning details for models that support extended thinking/reasoning. (Gemini) */
reasoning_details?: any[];

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
choices: (ChatChoice & { message: Message & { reasoning: string } })[];
choices: (ChatChoice & { message: Message & {
reasoning: string;
reasoning_details?: any[]

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
reasoning_details?: any[]
reasoning_details?: Message['reasoning_details']

Copilot uses AI. Check for mistakes.
content_blocks.push({
type: 'thinking',
thinking: c.message.reasoning,
...(c.message.reasoning_details && { reasoning_details: c.message.reasoning_details }),

Copilot AI Nov 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
...(c.message.reasoning_details && { reasoning_details: c.message.reasoning_details }),

Copilot uses AI. Check for mistakes.
narengogi
narengogi previously approved these changes Dec 1, 2025
@VisargD

VisargD commented Dec 8, 2025

Copy link
Copy Markdown
Collaborator

Hi @stefan-jiroveanu , can you please fix the formatting with npm run format?

@stefan-jiroveanu

Copy link
Copy Markdown
Contributor Author

Should be formatted now

@VisargD VisargD merged commit cc4ab11 into Portkey-AI:main Dec 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants