litellm/litellm-rust/crates/python-compat
Nate Armstrong b6669b4684
feat(gateway): gemini chat completions on google ai studio and vertex ai (#47098)
* feat(gateway): Gemini chat completions on Google AI Studio and Vertex AI

gemini/ deployments and vertex_ai/ deployments of Gemini models now serve
/v1/chat/completions, streamed and not, instead of being refused. Both surfaces share
one translation ported from the Python VertexGeminiConfig. Params map as Python maps
them: temperature, top_p, max_tokens and max_completion_tokens, n, stop, penalties
where the model takes them, seed, logprobs, tools with function declarations and the
built in search, code execution, url context, maps and computer use tools,
tool_choice, response_format as a response schema, reasoning_effort and thinking as a
thinking config, modalities, audio and labels. Messages become contents with a system
instruction when the cost map allows it, images, files, audio, function calls and
responses, and thought signatures carried back on tool call ids

AI Studio sends the key in x-goog-api-key from the deployment or GOOGLE_API_KEY,
GEMINI_API_KEY or PALM_API_KEY, and calls v1alpha for Gemini 3 and v1beta otherwise.
Vertex AI calls the project and location URL with a forwarded bearer or a Google
access token from vertex_credentials, the environment or ADC, and grafts the path onto
a custom api_base. Responses carry text, reasoning, tool calls, grounding annotations,
logprobs and the vertex_ai metadata, a blocked prompt or flagged answer comes back as
content_filter, and usage counts thoughts and cached tokens as Python does so cost is
recorded. The gateway resolves os.environ references in the deployment key, base and
Vertex params, passes the deployment Vertex params to the call, and loads the cost map
for gemini and vertex_ai deployments. Claude and partner models on Vertex AI stay
refused

* test(gateway): gemini cost map test double returns a Cow entry
2026-10-19 10:44:12 -07:00
..
benches feat(rust): add python-compat crate for Python data formats (#42510) 2026-09-22 12:16:56 -07:00
generated feat(rust): add python-compat crate for Python data formats (#42510) 2026-09-22 12:16:56 -07:00
scripts feat(rust): add python-compat crate for Python data formats (#42510) 2026-09-22 12:16:56 -07:00
src feat(gateway): gemini chat completions on google ai studio and vertex ai (#47098) 2026-10-19 10:44:12 -07:00
tests feat(rust): add python-compat crate for Python data formats (#42510) 2026-09-22 12:16:56 -07:00
AGENTS.md docs(agents): ban semicolons and colons in human-facing text (#45684) 2026-10-09 16:36:32 -07:00
Cargo.toml feat(rust): add python-compat crate for Python data formats (#42510) 2026-09-22 12:16:56 -07:00