Skip to content

feat(gemini)!: judge Gemini models the map has no sampling flag for by the version in their name - #47684

Open
ryan-crabbe-berri wants to merge 8 commits into
mainfrom
litellm_gemini_sampling_version_fallback
Open

ryan-crabbe-berri wants to merge 8 commits into
mainfrom
litellm_gemini_sampling_version_fallback

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

#47645 taught LiteLLM to drop temperature, top_p and top_k for the Gemini models Google says ignore them, or to return a clear 400 without drop_params, but only for the model map rows someone flagged by hand. A Gemini model newer than the map, or a chat row nobody flagged like gemini-4-argon, still forwarded the knobs and came back 200 looking like it worked. Now the model map ships a rule that marks Gemini 3.6 Flash, 3.5 Flash-Lite and everything later as ignoring the knobs, LiteLLM fills it onto the Google rows nobody flagged and onto names the map has never seen, and the same contract applies, so a new Gemini release behaves right the day it appears and an explicit flag on a row still wins

Details

TLDR

  • Google ignores temperature, top_p and top_k on Gemini 3.6 Flash, 3.5 Flash-Lite and newer
  • fix(gemini)!: honor supports_sampling_params on the Gemini and Vertex path and flag Gemini 3.6 Flash, 3.5 Flash-Lite and later #47645 only covers model map rows someone flagged by hand
  • Newer Gemini models and unflagged rows like gemini-4-argon still forwarded the knobs
  • Now a model map rule marks those versions as ignoring the knobs
  • The rule fills unflagged Google rows and names the map has never seen
  • Same contract as flagged rows: dropped with drop_params, a clear 400 without it
  • Batch file rows get the same rule, including through a batch deployment, whose mode the proxy stamps onto the model's map row
  • A batch row is judged by the model its deployment runs it on, so a row that still says gemini/ gets the same cut
  • A batch deployment that sets drop_params true in its own settings drops the knobs too, instead of failing the upload
  • An explicit flag in the map still wins, and rows for other modes like audio or image keep forwarding

Intentional product change: gemini-4-argon on AI Studio and Vertex, plus the cyber-permissive Vertex variant, now drops the knobs under drop_params and returns a 400 without it, where before the knobs were forwarded and Google ignored them. Any future Gemini name at 3.6 or later gets the same treatment before the model map catches up. Callers who want temperature and top_p forwarded anyway list them in allowed_openai_params, or set supports_sampling_params: true in the deployment's model_info, which the map then honors as an explicit flag

The second commit came out of the live batch run. The proxy registers a batch deployment's model_info onto the backend model's map row, so on a batch proxy the gemini-4-argon row read mode: batch, the first cut treated that as a non-chat row and kept forwarding, and the uploaded row still carried the knobs. A batch row is a chat request, so a row stamped mode: batch is now judged by the version like a chat row. The third commit rewords the 400 that the batch upload and a lone top_k get, since it claimed a model map flag that a version-judged model does not have, and it now names both escape hatches

The fourth commit moves the version cut out of the Vertex code and into the model map as a fallback generalization rule, the same mechanism the Claude and Gemini chat baselines already use, so the Gemini and Vertex configs read the sampling flag for their own route the same way the Anthropic and Bedrock configs do. Along the way fill-missing backfill now also covers rows whose mode is batch and rows without a provider, and get_model_info returns the sampling flag

The fifth commit fixes a Bugbot finding on the fourth. A batch row whose model id kept a gemini/ prefix, say copied from an AI Studio call, was looked up under that prefix on the Vertex route. The AI Studio row exists, so the provider check rejected it, the rule never ran, the lookup raised and the reader fell open, storing the knobs even under drop_params. A batch row runs on the deployment's Vertex model whatever id it was written with, and the stored GCS path already binds it to that model, so the row is now shaped and gated for the deployment's model. A direct SDK upload names no deployment, so there the row's own id is used with its gemini/ or vertex_ai/ namespace stripped, the way a live call strips it

Main was then merged in (b2dddd4). It brought #31915's per-deployment drop_params for batch rows into the same mapper, and the sixth commit closes the gap that left. A batch deployment with drop_params: true in its litellm_params still refused a row carrying the knobs for a flagged model, because the batch rejection check was hard-wired to the no-drop path while the live chat path reads the deployment's setting. Both now read the same setting, so such a deployment drops the knobs instead of failing the upload. The same commit gives the upload stream's deployment model a default again, which Greptile caught breaking the two-argument callers, and keeps a row whose body.model is missing or not a string failing as a 400 that names the line when the deployment names no model

The seventh commit trims the deployment isolation test. supports_sampling_params became a model map schema field in #47645, so the Router copies a deployment's value onto the shared backend row the same way it copies supports_vision, and that shared row is where the Gemini check reads the per-deployment escape hatch from. The test's third case claimed the flag stays on the deployment that set it, and it only passed because get_model_info never returned the field. This PR returns it, so the case is dropped and the behavior is listed under Caveats

User Flow

Before: a developer tuning a gemini-4-argon app through the proxy sets temperature 0 and gets a 200, but Google ignored the setting and the answers stay random

  1. They send POST https://litellm-domain/v1/chat/completions with "model": "gemini/gemini-4-argon", "temperature": 0, "top_p": 0.9 and "top_k": 20
  2. The proxy forwards all three knobs to Google and returns 200 with a normal completion, with or without "drop_params": true
  3. They repeat the same request and get a different answer each time, because Google ignored the knobs and nothing told them so

After: the same request comes back with a clear 400 naming drop_params, and with drop_params on the knobs are stripped before the call

  1. They send the same POST https://litellm-domain/v1/chat/completions with "model": "gemini/gemini-4-argon", "temperature": 0, "top_p": 0.9 and "top_k": 20
  2. They get 400 with "gemini does not support parameters: ['temperature', 'top_p'], for model=gemini-4-argon. To drop these, set litellm.drop_params=True ..."
  3. They add "drop_params": true to the request, or the proxy admin turns it on in the config, and resend
  4. They get 200, and the request Google receives carries only max_output_tokens

Relevant issues

Follow-up to #47645, refs #47015

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Both legs run the same proxy config against real Vertex AI (project vertex-check-481318, location global), so every 200 below is a paid Google call. Before is a git archive of the merge base on main, After is a git archive of the PR tip for the chat, Messages, Responses and AI Studio cases, each started with python litellm/proxy/proxy_cli.py --config qa_fallback_vertex_config.yaml --port <port> --num_workers 2 --detailed_debug and LITELLM_LOCAL_MODEL_COST_MAP=True so the model map in the tree is the one in effect. gemini-4-argon is a real model whose model map rows carry no supports_sampling_params flag on either leg, so the only thing that differs between the legs is the rule. The wire lines quoted under each case are the POST Request Sent from LiteLLM entries from that proxy's debug log, which show exactly what reached Google

model_list:
  - model_name: vertex_ai/gemini-4-argon
    litellm_params:
      model: vertex_ai/gemini-4-argon
      vertex_project: vertex-check-481318
      vertex_location: global
  - model_name: vertex_ai/gemini-3.5-flash
    litellm_params:
      model: vertex_ai/gemini-3.5-flash
      vertex_project: vertex-check-481318
      vertex_location: global
  - model_name: gemini/gemini-4-argon
    litellm_params:
      model: gemini/gemini-4-argon
      api_key: os.environ/GEMINI_API_KEY
general_settings:
  master_key: sk-qa-1234

Each leg runs the chat completions cases first, then the same request through /v1/messages and /v1/responses, which the proxy bridges into the same Gemini call, then one AI Studio case. Every case is one curl with the master key. The response is piped through a small filter that prints the id, model, text and finish reason of a success, or the error object of a failure, followed by the HTTP status

The AI Studio case sends the knobs to gemini/gemini-4-argon without drop_params. Its Before run was captured against the same merge base while an AI Studio key was on the QA machine, and its After run needs no key because the 400 is returned before anything is sent to Google. No AI Studio key was reachable from the QA machine for this re-run, so the drop_params path is shown live on Vertex only, and the AI Studio route, which goes through the same Gemini config, is covered by the unit tests

The four batch cases at the end of each leg run the same trees against a second config that holds one batch deployment for Vertex AI pointed at gemini-4-argon and at the real GCS bucket the e2e suite uses (litellm-e2e-vertex-batch in the same project) with that suite's service account key as vertex_credentials, once as written below and once with litellm_settings: drop_params: true added. Two rows go through each, one whose model is written as vertex_ai/gemini-4-argon and one that keeps the AI Studio id gemini/gemini-4-argon, as a row copied from an AI Studio batch file would. Each row is uploaded with POST /v1/files?model=vertex-batch and purpose=batch, and when the upload succeeds the stored row is read back with GET /v1/files/<id>/content, which returns the converted Vertex rows exactly as they sit in the bucket. The After batch cases were captured at c2c76fc, the tip before main was merged in. The commits since then touch the batch path only for a deployment that sets drop_params: true in its own litellm_params, which a unit test covers, and the bucket credentials were not reachable from the QA machine when the chat cases were re-run at the tip, so the batch leg was not repeated

model_list:
  - model_name: vertex-batch
    litellm_params:
      model: vertex_ai/gemini-4-argon
      vertex_project: vertex-check-481318
      vertex_location: us-central1
      vertex_credentials: <path to the service account key>
      gcs_bucket_name: litellm-e2e-vertex-batch
    model_info:
      mode: batch
general_settings:
  master_key: sk-qa-1234

Before (49b5444)

vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4675/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, a 200 even though Google ignores all three knobs on this model, whose model map row carries no flag
{
  "id": "SmndavnhM6Gb4_UPuYGTwAc",
  "model": "vertex_ai/gemini-4-argon",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, all three knobs forwarded to Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4675/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "Tmndavq_A9CQ4_UP9varoQ8",
  "model": "vertex_ai/gemini-4-argon",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, drop_params changed nothing and all three knobs still reached Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

control: vertex_ai/gemini-3.5-flash keeps the knobs, no drop_params

  1. Command
curl -s http://localhost:4675/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-3.5-flash","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "UWndauuoH-iQ4_UP7vfF6Ag",
  "model": "vertex_ai/gemini-3.5-flash",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, Gemini 3.5 Flash is older than Google's cut so the knobs are forwarded
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-3.5-flash:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

POST /v1/messages, vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4675/v1/messages -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","max_tokens":2000,"messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20}' -w '\nHTTP %{http_code}\n'
  1. Observed output, a 200 on the Messages route too
{
  "id": "xWzdaqekHeiQ4_UP7vfF6Ag",
  "model": "vertex_ai/gemini-4-argon",
  "text": "Blue",
  "stop_reason": "end_turn"
}
HTTP 200
  1. Wire log, the Messages request is bridged into the same Gemini call and all three knobs reach Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

POST /v1/messages, vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4675/v1/messages -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","max_tokens":2000,"messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "yGzdarCBGd6Y4_UPhPjhuQM",
  "model": "vertex_ai/gemini-4-argon",
  "text": "Blue",
  "stop_reason": "end_turn"
}
HTTP 200
  1. Wire log, drop_params changed nothing
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

POST /v1/responses, vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4675/v1/responses -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","input":"Name one color. One word.","temperature":0,"top_p":0.9,"max_output_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, a 200 on the Responses route too
{
  "id": "resp_tXmD7wVuOtSVUv_5TqS9HP_rk09-qWtlAudz9jqdF9HEWw_hiLk6VyckgJQiOHdytZtfaQb3t-n0YG6epxgadc1SIsFMNbH7BpONjzPmv95S5IcnZqQFYufW1RFNiYOpor6F8P13M9SQGKkPFMdA43RX5Ks87TXgnVjA3rRVu6XRughc37IR5vZIk0rB888cubuVeoP64o9vNJ_RnWuKmRJy6edGwjrJg2XQER1K3v1_flCexhFTD7Ikah5IkntPtGIfw7XUYKreGmK0JL3iY39hd7bh89SfcGZLphqZUWHW_ftjDr25bUFZBQRRHlLJE7lCDykcxejVOIwo5J8iRhzj9uPyjtkWrtGXXA_GqeKJ3JWs_2dHvxGOgmwiz-cLIIImD6BhgM4wZqUrxFTpEugPyN58P_q1lH8=",
  "model": "vertex_ai/gemini-4-argon",
  "output_text": "Blue",
  "status": "completed"
}
HTTP 200
  1. Wire log, the Responses request is bridged into the same Gemini call and temperature and top_p reach Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000}}'

POST /v1/responses, vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4675/v1/responses -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","input":"Name one color. One word.","temperature":0,"top_p":0.9,"max_output_tokens":2000,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "resp_9Eq64joy8f2kKqnQ891LcOcjqB9qUY1ZpxZNuMzYMffw-ygUO86MyB6PJiwtAxZ_LDj6oJUZjUmHzhqjjxxbEqoUIknYBTKVOAYZLXO-ul-JSBytizFg-_yp_jXxxtEzkAfih_cr5kH_2S5UrX6aA1hIfELq1XYIpurGlSO8ZOg8Inm6lSAukcLMBrG_5saR5FIEl84HgM8mSym-950qHTZalRu9ToGy-bcLPn3YJgqjz4OBLYX3pnKAbwj4wFdlbgcvjOIVhqX31TdGzBP8xKKDw_mra9cKXGaj_Bb1HzsHZV11MPMVBTz-SRCSBzMOCodVyunBncnbNiy9HQxdS-jjulWSJ6g4UQaxNj4MtnLHfgD9SoZBGE3lvZ6nyuAMkQv0rcRcdG2s0Oc7wSM_Xio-L8ke7VMVhg0=",
  "model": "vertex_ai/gemini-4-argon",
  "output_text": "Blue",
  "status": "completed"
}
HTTP 200
  1. Wire log, drop_params changed nothing
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000}}'

gemini/gemini-4-argon (AI Studio), sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4650/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"gemini/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, the same 200 on the AI Studio route
{
  "id": "qP_XaqOLBeLj_uMPouTMkA4",
  "model": "gemini/gemini-4-argon",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, all three knobs forwarded to AI Studio
https://generativelanguage.googleapis.com/v1alpha/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

POST /v1/files purpose=batch, vertex_ai/gemini-4-argon row with sampling knobs, no drop_params

  1. Command, the file is one row aimed at vertex_ai/gemini-4-argon that carries the three knobs, uploaded as a batch file through the vertex-batch deployment
cat batch_row_argon.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "vertex_ai/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4652/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vMjYzNzlhMmUtYzg5Yi00YjBjLTk0ZDEtY2Y4MjE2OWU0MzgzO21vZGVsLHZlcnRleC1iYXRjaA","bytes":269,"created_at":1792541343,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/26379a2e-c89b-4b0c-94d1-cf82169e4383","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the three knobs sit in the row that Google will ignore and nothing told the caller
curl -s http://localhost:4652/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vMjYzNzlhMmUtYzg5Yi00YjBjLTk0ZDEtY2Y4MjE2OWU0MzgzO21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

POST /v1/files purpose=batch, vertex_ai/gemini-4-argon row with sampling knobs, drop_params true in litellm_settings

  1. Command, the file is one row aimed at vertex_ai/gemini-4-argon that carries the three knobs, uploaded as a batch file through the vertex-batch deployment
cat batch_row_argon.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "vertex_ai/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4653/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vMTg5Njc0NzAtYTdjOC00MDM0LTlmZWUtOWE0NmE1MjVjMzg5O21vZGVsLHZlcnRleC1iYXRjaA","bytes":269,"created_at":1792541344,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/18967470-a7c8-4034-9fee-9a46a525c389","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the knobs are still there because nothing marked them unsupported
curl -s http://localhost:4653/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vMTg5Njc0NzAtYTdjOC00MDM0LTlmZWUtOWE0NmE1MjVjMzg5O21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

batch upload, row written as gemini/gemini-4-argon through the Vertex batch deployment, no drop_params

  1. Command, the file is one row whose model is written as gemini/gemini-4-argon, the AI Studio id, with the three knobs, uploaded as a batch file through the same Vertex vertex-batch deployment
cat batch_row_argon_gemini_prefix.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gemini/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4670/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon_gemini_prefix.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted and stored under the deployment's gemini-4-argon path
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vZmE3NjNkNDQtNzhhNy00Yzc1LTgxYjYtNmIzMzdkNTNhMjQwO21vZGVsLHZlcnRleC1iYXRjaA","bytes":269,"created_at":1792892478,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/fa763d44-78a7-4c75-81b6-6b337d53a240","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the three knobs sit in the row and nothing told the caller
curl -s http://localhost:4670/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vZmE3NjNkNDQtNzhhNy00Yzc1LTgxYjYtNmIzMzdkNTNhMjQwO21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

batch upload, row written as gemini/gemini-4-argon through the Vertex batch deployment, drop_params true

  1. Command, the file is one row whose model is written as gemini/gemini-4-argon, the AI Studio id, with the three knobs, uploaded as a batch file through the same Vertex vertex-batch deployment
cat batch_row_argon_gemini_prefix.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gemini/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4671/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon_gemini_prefix.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vYTYwZTdlNDMtNzFmZC00NjM4LTkzMGItZDg2M2NlNTJlYmY2O21vZGVsLHZlcnRleC1iYXRjaA","bytes":269,"created_at":1792892479,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/a60e7e43-71fd-4638-930b-d863ce52ebf6","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the knobs are still there because nothing marked them unsupported
curl -s http://localhost:4671/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vYTYwZTdlNDMtNzFmZC00NjM4LTkzMGItZDg2M2NlNTJlYmY2O21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

After (1c9304a)

vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4680/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, a 400 that names the knobs and tells the caller how to drop or force them, with no change to the model map row
{
  "error": {
    "message": "litellm.UnsupportedParamsError: vertex_ai does not support parameters: ['temperature', 'top_p'], for model=gemini-4-argon. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['temperature', 'top_p'] in your request.\n\nLiteLLM: model group 'vertex_ai/gemini-4-argon' failed with the error above. No fallback was attempted.",
    "type": "invalid_request_error",
    "param": null,
    "code": "400"
  }
}
HTTP 400
  1. Wire log, nothing was sent to Google for this request

vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4680/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "iu_fat7iHq6c998Pg_m8sAg",
  "model": "vertex_ai/gemini-4-argon",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, temperature, top_p and top_k are all gone and only max_output_tokens reaches Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'max_output_tokens': 2000}}'

control: vertex_ai/gemini-3.5-flash keeps the knobs, no drop_params

  1. Command
curl -s http://localhost:4680/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-3.5-flash","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, unchanged
{
  "id": "je_fare_NdCQ4_UP9varoQ8",
  "model": "vertex_ai/gemini-3.5-flash",
  "content": "Blue",
  "finish_reason": "stop"
}
HTTP 200
  1. Wire log, the knobs still reach Google exactly as in Before
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-3.5-flash:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'temperature': 0, 'top_p': 0.9, 'max_output_tokens': 2000, 'top_k': 20}}'

POST /v1/messages, vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4680/v1/messages -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","max_tokens":2000,"messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20}' -w '\nHTTP %{http_code}\n'
  1. Observed output, the same 400 on the Messages route, in the Anthropic error shape
{
  "error": {
    "type": "invalid_request_error",
    "message": "litellm.UnsupportedParamsError: vertex_ai does not support parameters: ['temperature', 'top_p'], for model=gemini-4-argon. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['temperature', 'top_p'] in your request.\n\nLiteLLM: model group 'vertex_ai/gemini-4-argon' failed with the error above. No fallback was attempted."
  }
}
HTTP 400
  1. Wire log, nothing was sent to Google for this request

POST /v1/messages, vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4680/v1/messages -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","max_tokens":2000,"messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "j-_fao2dFqGb4_UPuYGTwAc",
  "model": "vertex_ai/gemini-4-argon",
  "text": "Blue",
  "stop_reason": "end_turn"
}
HTTP 200
  1. Wire log, only max_output_tokens reaches Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'max_output_tokens': 2000}}'

POST /v1/responses, vertex_ai/gemini-4-argon, sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4680/v1/responses -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","input":"Name one color. One word.","temperature":0,"top_p":0.9,"max_output_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, the same 400 on the Responses route
{
  "error": {
    "message": "litellm.UnsupportedParamsError: vertex_ai does not support parameters: ['temperature', 'top_p'], for model=gemini-4-argon. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['temperature', 'top_p'] in your request.\n\nLiteLLM: model group 'vertex_ai/gemini-4-argon' failed with the error above. No fallback was attempted.",
    "type": "invalid_request_error",
    "param": null,
    "code": "400"
  }
}
HTTP 400
  1. Wire log, nothing was sent to Google for this request

POST /v1/responses, vertex_ai/gemini-4-argon, sampling knobs, drop_params true

  1. Command
curl -s http://localhost:4680/v1/responses -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"vertex_ai/gemini-4-argon","input":"Name one color. One word.","temperature":0,"top_p":0.9,"max_output_tokens":2000,"drop_params":true}' -w '\nHTTP %{http_code}\n'
  1. Observed output
{
  "id": "resp_i05baGlQLbPBj7yVVkEcaC8Pzh9ZUXwmTH-gkPsMfwjgdi4n8sATBYdsR3KY0TOYMd7SUzuESBaigLe9kpzobo_jqstlAg-AozTd_X0Rf5WFaFcQKNkhgzNnpwJLLbr3zqwcuxTmCmUiceOyi5vLGN7qP5HAeaowfMQcF97QPZ58by70HxyF8TbhkHkury0rBe6S34wKfqTXTVRw-eWOsHpq1CP25uCkAe1UIPJ2HKlXUK0oRUdW8WnBkGk40LwNL7nf1y2ovnoNfo1mUpP5BIKTLVd1ievP8v5FDLtdwdJkkMjwSBRGDi5nblYsgYQFELQVzI8eyNkMHU9sDwUAsPhoK0yuvSjWYwtf43YarTwhuZnOEImSL67XK8cA5vYXqD_mnWq7jBcjC0t6E2UozbdtFSjn15-Gnf0=",
  "model": "vertex_ai/gemini-4-argon",
  "output_text": "Blue",
  "status": "completed"
}
HTTP 200
  1. Wire log, only max_output_tokens reaches Vertex AI
https://aiplatform.googleapis.com/v1/projects/vertex-check-481318/locations/global/publishers/google/models/gemini-4-argon:generateContent
-d '{'contents': [{'role': 'user', 'parts': [{'text': 'Name one color. One word.'}]}], 'generationConfig': {'max_output_tokens': 2000}}'

gemini/gemini-4-argon (AI Studio), sampling knobs, no drop_params

  1. Command
curl -s http://localhost:4680/v1/chat/completions -H 'Authorization: Bearer sk-qa-1234' -H 'Content-Type: application/json' -d '{"model":"gemini/gemini-4-argon","messages":[{"role":"user","content":"Name one color. One word."}],"temperature":0,"top_p":0.9,"top_k":20,"max_tokens":2000}' -w '\nHTTP %{http_code}\n'
  1. Observed output, the same 400 on the AI Studio route, from a proxy that holds no AI Studio key at all, so the cut fires before any call is attempted
{
  "error": {
    "message": "litellm.UnsupportedParamsError: gemini does not support parameters: ['temperature', 'top_p'], for model=gemini-4-argon. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params dynamically send allowed_openai_params=['temperature', 'top_p'] in your request.\n\nLiteLLM: model group 'gemini/gemini-4-argon' failed with the error above. No fallback was attempted.",
    "type": "invalid_request_error",
    "param": null,
    "code": "400"
  }
}
HTTP 400
  1. Wire log, nothing was sent to Google for this request

The four batch cases below were captured at c2c76fc, the tip before main was merged in, as the proof intro explains

POST /v1/files purpose=batch, vertex_ai/gemini-4-argon row with sampling knobs, no drop_params

  1. Command, the file is one row aimed at vertex_ai/gemini-4-argon that carries the three knobs, uploaded as a batch file through the vertex-batch deployment
cat batch_row_argon.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "vertex_ai/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4677/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is refused with a 400 naming the row, the knobs and drop_params, so nothing reaches the bucket
{"error":{"message":"Batch input file line 1 could not be converted to a Vertex AI request: litellm.UnsupportedParamsError: gemini-4-argon does not support temperature, top_p, top_k: Google ignores sampling params on this model, so LiteLLM treats it as `supports_sampling_params: false`. To drop unsupported params, set `litellm.drop_params = True`, or set `supports_sampling_params: true` in the model's model_info to forward them anyway.","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

POST /v1/files purpose=batch, vertex_ai/gemini-4-argon row with sampling knobs, drop_params true in litellm_settings

  1. Command, the file is one row aimed at vertex_ai/gemini-4-argon that carries the three knobs, uploaded as a batch file through the vertex-batch deployment
cat batch_row_argon.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "vertex_ai/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4678/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vODdlNGUxOTUtODEzMC00NzcwLTg1ZGEtZWY0MTRmNTZjODhjO21vZGVsLHZlcnRleC1iYXRjaA","bytes":224,"created_at":1792896492,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/87e4e195-8130-4770-85da-ef414f56c88c","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the knobs are stripped and only max_output_tokens is left
curl -s http://localhost:4678/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vODdlNGUxOTUtODEzMC00NzcwLTg1ZGEtZWY0MTRmNTZjODhjO21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

batch upload, row written as gemini/gemini-4-argon through the Vertex batch deployment, no drop_params

  1. Command, the file is one row whose model is written as gemini/gemini-4-argon, the AI Studio id, with the three knobs, uploaded as a batch file through the same Vertex vertex-batch deployment
cat batch_row_argon_gemini_prefix.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gemini/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4677/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon_gemini_prefix.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the same 400, the row is judged by the deployment's Vertex model and not by the gemini/ id it was written with
{"error":{"message":"Batch input file line 1 could not be converted to a Vertex AI request: litellm.UnsupportedParamsError: gemini-4-argon does not support temperature, top_p, top_k: Google ignores sampling params on this model, so LiteLLM treats it as `supports_sampling_params: false`. To drop unsupported params, set `litellm.drop_params = True`, or set `supports_sampling_params: true` in the model's model_info to forward them anyway.","type":"invalid_request_error","param":null,"code":"400"}}
HTTP 400

batch upload, row written as gemini/gemini-4-argon through the Vertex batch deployment, drop_params true

  1. Command, the file is one row whose model is written as gemini/gemini-4-argon, the AI Studio id, with the three knobs, uploaded as a batch file through the same Vertex vertex-batch deployment
cat batch_row_argon_gemini_prefix.jsonl
{"custom_id": "req-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gemini/gemini-4-argon", "messages": [{"role": "user", "content": "Name one color. One word."}], "max_tokens": 8, "temperature": 0, "top_p": 0.9, "top_k": 20}}
curl -s 'http://localhost:4678/v1/files?model=vertex-batch' -H 'Authorization: Bearer sk-qa-1234' -F purpose=batch -F file=@batch_row_argon_gemini_prefix.jsonl -w '\nHTTP %{http_code}\n'
  1. Observed output, the upload is accepted
{"id":"file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vY2RmMzMyNjUtYTQ2YS00ODI0LWFiYWItNTU3ZjcyNWJkMDA1O21vZGVsLHZlcnRleC1iYXRjaA","bytes":224,"created_at":1792896493,"filename":"litellm-vertex-files/publishers/google/models/gemini-4-argon/cdf33265-a46a-4824-abab-557f725bd005","object":"file","purpose":"batch","status":"uploaded","expires_at":null,"status_details":null}
HTTP 200
  1. Stored row read back through the proxy, the knobs are stripped exactly as for the vertex_ai row and only max_output_tokens is left
curl -s http://localhost:4678/v1/files/file-bGl0ZWxsbTpnczovL2xpdGVsbG0tZTJlLXZlcnRleC1iYXRjaC9saXRlbGxtLXZlcnRleC1maWxlcy9wdWJsaXNoZXJzL2dvb2dsZS9tb2RlbHMvZ2VtaW5pLTQtYXJnb24vY2RmMzMyNjUtYTQ2YS00ODI0LWFiYWItNTU3ZjcyNWJkMDA1O21vZGVsLHZlcnRleC1iYXRjaA/content -H 'Authorization: Bearer sk-qa-1234'
{"request": {"contents": [{"role": "user", "parts": [{"text": "Name one color. One word."}]}], "generationConfig": {"max_output_tokens": 8}, "labels": {"litellm_custom_id": "req-1", "litellm_custom_id_raw": "b32_ojsxcljr"}}}

Type

🆕 New Feature

Caveats (if any)

Medium

  • Callers of gemini-4-argon who send the knobs without drop_params now get a 400, the same deliberate break fix(gemini)!: honor supports_sampling_params on the Gemini and Vertex path and flag Gemini 3.6 Flash, 3.5 Flash-Lite and later #47645 made for the flagged rows, only this time no model map row changed
  • A batch file upload whose rows aim at gemini-4-argon with the knobs is refused the same way without drop_params, where before the file was stored with the knobs in it
  • A batch row whose model differs from the deployment's is now shaped and gated for the model the deployment runs it on, where before the row's own id decided. Through the proxy the deployment's model always ran the job, so only the stored request shape can change, and only for rows that named a different model
  • supports_sampling_params: true in one deployment's model_info reaches every deployment of that backend model in the process, because the Router writes it onto the shared model map row the way it writes supports_vision. The escape hatch has worked that way since fix(gemini)!: honor supports_sampling_params on the Gemini and Vertex path and flag Gemini 3.6 Flash, 3.5 Flash-Lite and later #47645 made the flag a map field, this PR only makes it visible through get_model_info. Keeping the flag on the deployment that set it would need the Gemini check to read the deployment's model_info at every gate, which is follow-up work

Low

  • The rule only matches names shaped like gemini-N or gemini-N.M, so a tuned endpoint id or a name without a version keeps forwarding the knobs
  • A name the map has never seen is judged by the rule alone, which skips tts, image, live, audio, embedding, computer-use, robotics, transcribe and translate names, so any other non-text variant called through chat completions before it has a map row would have its knobs dropped too
  • A row the Router registers from model_info without a mode is filled by the rule like a chat row
  • Fill-missing backfill now also runs for rows whose mode is batch and rows with no provider, so every shipped rule, not only this one, can fill such rows for the first time
  • The live legs below run through Vertex AI plus one AI Studio case that returns its 400 before any call. The AI Studio drop_params path was not re-run live at the tip because no AI Studio key was reachable from the QA machine, and it is covered by unit tests on the shared Gemini config
  • The After batch cases were captured at c2c76fc rather than the tip. The deployment-level drop_params fix on the batch path since then is covered by a unit test that fails on the merge commit and passes on the tip, not by a live upload
  • Two warn-once deprecation tests from fix(vertex_ai): log Gemini 3 sampling deprecation once per model per worker #40868 used made-up gemini-3.9 names that now drop the knobs, so they were moved to gemini-3.5 names to keep exercising the shared notice

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

…y the version in their name

Google ignores temperature, top_p and top_k on Gemini 3.6 Flash, 3.5 Flash-Lite and every later
model. The model map carries supports_sampling_params: false for the rows we know about, but a
chat row without the flag, or a model newer than the map, kept forwarding the knobs silently.
When no row answers, read the version out of the model name and apply the same drop-or-400
contract. A row whose mode is not chat keeps forwarding, since the notice covers the text models.

gemini-4-argon has a chat row without the flag, so it now drops the knobs under drop_params and
returns the 400 naming drop_params without it, like the flagged rows.
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai review

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The PR changes sampling-parameter behavior across Google Gemini calls and Vertex batch uploads.

Fix the existing test callers before merging

Findings

  1. P1 Existing batch tests fail ▶

Summary

The PR adds a model-map rule that rejects or drops sampling settings for newer Gemini text models while preserving explicit flags. The latest change makes Vertex batch rows use the deployment's model and removes Google provider prefixes

Existing tests still call _OpenAIToVertexBatchUploadStream without its new required argument and need fixing before merge

The earlier unnumbered live-check finding is addressed by the supplied Messages, Responses, and Vertex batch runs

  • Newer Gemini text calls reject or drop ignored sampling settings.
  • Vertex batch rows use the model their deployment will run.

Reviews (4) · Last reviewed commit: "fix(vertex_ai): gate a batch row's sampl..." · Reviewed by Greptile

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@codspeed

codspeed Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 1 benchmark is dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 35 untouched benchmarks


Comparing litellm_gemini_sampling_version_fallback (1c9304a) with main (549e6d4)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (1005293) during the generation of this report, so 549e6d4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

…le too

The proxy registers a batch deployment's model_info onto the backend model's
map row, so vertex_ai/gemini-4-argon carried mode: batch on a batch proxy and
the version rule treated it as a non-chat row and kept forwarding the knobs.
A live upload on the PR tip stored temperature, top_p and top_k in the bucket
on both legs. Batch rows are chat requests, so a batch row is judged by the
version like a chat row, and the batch transformation now has the regression
@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…on rule never set

A model judged by its version has no supports_sampling_params flag in the map,
so the batch and top_k rejection said something a reader could not find. The
message now says Google ignores the knobs and names both escape hatches
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

…rule

The hand-rolled version regex and raw model map lookup in the Vertex config move into a gemini-sampling-params-ignored rule in the model map. The rule fills supports_sampling_params false onto Google rows that lack the flag and resolves unmapped Gemini 3.6+, 3.5 flash-lite and 4+ ids, while an explicit flag on a row still wins

The Gemini and Vertex configs now read the flag through the shared tri-state reader for their own route, so a batch deployment whose stamped row says mode batch is judged by the same rule as a chat row. Fill-missing backfill now also covers rows whose mode is batch and rows without a litellm_provider, and get_model_info returns supports_sampling_params
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

…b runs on

A batch file row whose model kept a gemini/ prefix, copied from an AI Studio
call, was looked up under that prefix on the Vertex route. The AI Studio row
exists, so the provider check rejected it and the fallback rule never ran, the
lookup raised, and the reader fell open: temperature, top_p and top_k were
stored even under drop_params. The row runs on the deployment's Vertex model
either way, which the stored GCS path already binds it to, so the row is now
shaped and gated for that model, falling back to its own id only for a direct
SDK upload that names no deployment, with the Google namespace stripped the
way a live call strips it
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

…ng_version_fallback

# Conflicts:
#	litellm/llms/vertex_ai/files/transformation.py
…pling knobs

A batch deployment with `litellm_params: drop_params: true` still rejected rows that
carried temperature, top_p or top_k for a Gemini model flagged
`supports_sampling_params: false`, because the batch mapper passed `drop_params=False`
to the rejection check while the live chat path reads the deployment's drop_params.
Both gates now read the same flag, so the knobs are dropped instead of the upload
failing with a 400

The upload stream's `deployment_model` argument defaults to None again, so the
two-argument callers (direct SDK uploads and the existing batch tests) keep working,
and a row whose body.model is missing or not a string is still reported as a 400
naming the line when the deployment names no model
… deployment isolation test

supports_sampling_params became a cost-map schema field in #47645, so the router
writes a deployment's value onto the shared backend row the same way it does
supports_vision and friends. That shared row is the only place the Gemini sampling
check reads the per-deployment escape hatch from, so the flag is not
deployment-scoped like supports_regex_lookaround and supports_assistant_prefill are.
The case only passed before because get_model_info never emitted the field, and this
branch now surfaces it, so the parametrization is reduced to the flags that really
stay on the deployment that set them
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1c9304a. Configure here.

@mateo-berri mateo-berri 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.

LGTM. Thanks!

}
},
{
"name": "gemini-sampling-params-ignored",

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.

Non-blocking, gemini-flash-latest and gemini-flash-lite-latest cost the same as 3.6 Flash and 3.5 Flash-Lite yet still forward the knobs, so i'd flag both rows



@pytest.mark.parametrize("flag", ["supports_regex_lookaround", "supports_assistant_prefill", "supports_sampling_params"])
@pytest.mark.parametrize("flag", ["supports_regex_lookaround", "supports_assistant_prefill"])

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.

Non-blocking, i'd scope supports_sampling_params per deployment in a follow-up, reading deployment_model_info like bedrock_model_supports_regex_lookaround, since the 400 now points users there

@mateo-berri

mateo-berri commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Update, spend-logs-guard ran on my review and passed, so there's no need to merge main in

This branch has not been deployed

No deployments
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.

2 participants