Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

fix: avoid dual gemini thinking controls

Alishahryar1e4d6dc1f94f7
diff --git a/providers/gemini/request.py b/providers/gemini/request.py
index 37651024..b307701f 100644
--- a/providers/gemini/request.py
+++ b/providers/gemini/request.py
@@ -53,7 +53,6 @@ def build_request_body(request_data: Any, *, thinking_enabled: bool) -> dict:
extra_body.update(deepcopy(request_extra))
if thinking_enabled:
- body["reasoning_effort"] = "high"
_apply_thinking_config(extra_body)
else:
body["reasoning_effort"] = "none"
diff --git a/tests/providers/test_gemini.py b/tests/providers/test_gemini.py
index 866a04b0..5205f760 100644
--- a/tests/providers/test_gemini.py
+++ b/tests/providers/test_gemini.py
@@ -99,7 +99,7 @@ def test_build_request_body_basic(gemini_provider):
assert body["model"] == "gemini-2.5-flash"
assert body["messages"][0]["role"] == "system"
- assert body["reasoning_effort"] == "high"
+ assert "reasoning_effort" not in body
eb = body.get("extra_body")
assert isinstance(eb, dict)
literal_extra_body = eb.get("extra_body")
@@ -119,6 +119,7 @@ def test_build_request_body_sdk_wire_json_has_literal_extra_body(gemini_provider
body = gemini_provider._build_request_body(req)
wire_json = _simulate_openai_sdk_wire_json(body)
+ assert "reasoning_effort" not in wire_json
assert "google" not in wire_json
literal_extra_body = wire_json.get("extra_body")
assert isinstance(literal_extra_body, dict)
@@ -153,6 +154,7 @@ def test_build_request_body_preserves_caller_extra_body(gemini_provider):
body = gemini_provider._build_request_body(req)
+ assert "reasoning_effort" not in body
eb = body.get("extra_body")
assert isinstance(eb, dict)
assert eb.get("metadata") == {"user": "u1"}
@@ -177,6 +179,7 @@ def test_build_request_body_merges_caller_nested_google(gemini_provider):
body = gemini_provider._build_request_body(req)
+ assert "reasoning_effort" not in body
eb = body.get("extra_body")
assert isinstance(eb, dict)
assert eb.get("metadata") == {"user": "u1"}
@@ -221,6 +224,17 @@ async def test_stream_response_text(gemini_provider):
assert any(
'"text_delta"' in event and "Hello back!" in event for event in events
)
+ kwargs = mock_create.call_args.kwargs
+ assert "reasoning_effort" not in kwargs
+ extra_body = kwargs.get("extra_body")
+ assert isinstance(extra_body, dict)
+ literal_extra_body = extra_body.get("extra_body")
+ assert isinstance(literal_extra_body, dict)
+ google = literal_extra_body.get("google")
+ assert isinstance(google, dict)
+ thinking_config = google.get("thinking_config")
+ assert isinstance(thinking_config, dict)
+ assert thinking_config.get("include_thoughts") is True
@pytest.mark.asyncio