Skip to content

Can I get thinking part from openrouter provider using google/gemini-2.5-pro? #2999

@Jinglever

Description

@Jinglever

Question

I have set up the extra body, inject "reason" parameter in it, But I still cannot get the thinking part.

model = OpenAIChatModel(
        'google/gemini-2.5-pro',
        provider=OpenRouterProvider(api_key=api_key),
)

agent = Agent(
    model=get_gemini25_pro(),
    output_type=str,
    system_prompt="you are a helpful assistant.",
    model_settings=ModelSettings(
        temperature=0.0,
        extra_body={
            "reasoning": {
                "effort": "high",
            }
        }
    ),
)

result = agent.run_sync("What is the capital of France?")
print(result.all_messages())

what I got is :

[ModelRequest(parts=[SystemPromptPart(content='you are a helpful assistant.', timestamp=datetime.datetime(2025, 9, 25, 5, 56, 27, 929500, tzinfo=datetime.timezone.utc)), UserPromptPart(content='What is the capital of France?', timestamp=datetime.datetime(2025, 9, 25, 5, 56, 27, 929505, tzinfo=datetime.timezone.utc))]), ModelResponse(parts=[TextPart(content='The capital of France is **Paris**.')], usage=RequestUsage(input_tokens=13, output_tokens=289, details={'reasoning_tokens': 281, 'image_tokens': 0}), model_name='google/gemini-2.5-pro', timestamp=datetime.datetime(2025, 9, 25, 5, 56, 29, tzinfo=TzInfo(UTC)), provider_name='openrouter', provider_response_id='gen-1758779788-3fP9CLDnRGS6oAH0D0iN')]

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions