Skip to content

Gemini 3.6 Flash / 3.5 Flash lite sends deprecated sampling parameters through OpenRouter #38767

Description

@anandpant

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

  1. 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
              }
            }
          }
        }
      }
    }
  }

  1. Run:
opencode run --pure \
  --model openrouter/google/gemini-3.6-flash \
  "Reply with the single word done."
  1. Observe the pre-inference 404.
  2. Capture the outgoing /chat/completions request w/ mitmproxy or add a breakpoint. It contains:

{
"temperature": 1,
"top_p": 0.95,
"top_k": 64
}

  1. 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions