Description
When using google/gemini-3.6-flash or google/gemini-3.5-flash-lite through OpenRouter, OpenCode automatically sends:
{
"temperature": 1,
"top_p": 0.95,
"top_k": 64
}
Google documents temperature, top_p, and top_k as deprecated for these models and instructs clients to remove them:
https://ai.google.dev/gemini-api/docs/generate-content/latest-model#migrate-to-gemini-3-6-flash
This causes OpenRouter requests using provider.require_parameters: true to fail before inference because the Google AI Studio and Vertex endpoints do not advertise top_k:
HTTP 404
No endpoints found that can handle the requested parameters.
note... a controlled test succeeds top_k is omitted so i guess technically that would fix my problem, but it's misleading when tuning behavior to hardcode values that dont do anything
Expected: OpenCode should not automatically add temperature, top_p, or top_k for Gemini 3.6 Flash, Gemini 3.5 Flash-Lite, and future Gemini models covered by Google’s sampling-parameter deprecation
Plugins
no
OpenCode version
1.18.4
Steps to reproduce
- Configure the OpenRouter model:
{
"$schema": "https://opencode.ai/config.json",
"model": "openrouter/google/gemini-3.6-flash",
"provider": {
"openrouter": {
"models": {
"google/gemini-3.6-flash": {
"name": "Gemini 3.6 Flash",
"options": {
"provider": {
"only": ["google-ai-studio", "google-vertex"],
"require_parameters": true
},
"reasoning": {
"effort": "low",
"exclude": true
}
}
}
}
}
}
}
- Run:
opencode run --pure \
--model openrouter/google/gemini-3.6-flash \
"Reply with the single word done."
- Observe the pre-inference 404.
- Capture the outgoing /chat/completions request w/ mitmproxy or add a breakpoint. It contains:
{
"temperature": 1,
"top_p": 0.95,
"top_k": 64
}
- Send the same request without top_k. It routes successfully with
HTTP 200.
same thing w/ gemini-3.5-flash-lite
Screenshot and/or share link
no
Operating System
macOS 15.7.7
Terminal
ghostty
Description
When using google/gemini-3.6-flash or google/gemini-3.5-flash-lite through OpenRouter, OpenCode automatically sends:
Google documents temperature, top_p, and top_k as deprecated for these models and instructs clients to remove them:
https://ai.google.dev/gemini-api/docs/generate-content/latest-model#migrate-to-gemini-3-6-flash
This causes OpenRouter requests using provider.require_parameters: true to fail before inference because the Google AI Studio and Vertex endpoints do not advertise top_k:
HTTP 404
No endpoints found that can handle the requested parameters.
note... a controlled test succeeds top_k is omitted so i guess technically that would fix my problem, but it's misleading when tuning behavior to hardcode values that dont do anything
Expected: OpenCode should not automatically add temperature, top_p, or top_k for Gemini 3.6 Flash, Gemini 3.5 Flash-Lite, and future Gemini models covered by Google’s sampling-parameter deprecation
Plugins
no
OpenCode version
1.18.4
Steps to reproduce
{
"temperature": 1,
"top_p": 0.95,
"top_k": 64
}
HTTP 200.
same thing w/ gemini-3.5-flash-lite
Screenshot and/or share link
no
Operating System
macOS 15.7.7
Terminal
ghostty