LibreChat/api/utils
Marco Beretta 9649541971
💠 feat: Add Gemini 4 Argon Support (#17200)
* feat: Add Gemini 4 Argon Support

Registers gemini-4-argon (GA 2026-10-13) for both the Gemini API and
Google Cloud Gemini Enterprise Agent Platform, following the Gemini 3.8
Flash integration.

- Model dropdown (config.ts) and both GOOGLE_MODELS examples
- Shared 1,048,576-token context window in googleModels; output stays
  capped at the 65,535 synchronous limit by googleSettings
- Thinking rule: medium default, minimal substituted with low, ignored
  sampling params and rejected thinkingBudget stripped; the allowlisted
  cyber-permissive variant defaults to high
- Introductory rates ($2 in / $10 out / $0.10 implicit cache read per
  1M) with the 2026-12-01 revert to $4 / $20 / $0.20 noted at both
  call sites; no long-context premium tier
- Tests: thinking default and levels, minimal substitution, legacy param
  strip, Vertex eu multi-region, OpenAI-compatible addParams strip,
  context window, value key and rates

Refs #17074

* test: Cover Gemini 4 Argon Request Shape and Billing End to End

Adds a Gemini-compatible mock endpoint whose addParams carry sampling
params, an E2E_REPORT_LLM_CONFIG fake-model marker that reports the
resolved agent request, and scenarios asserting that an Argon turn sends
no ignored sampling params (with gemini-2.5-pro as the control) and is
billed at the Argon rates.

* test: Read the Resolved Agent Request From the Graph in Argon Scenarios

The hook's agents are the unresolved agent configs, so the report now
reads the graph's agent context. The scenarios select the Gemini model
explicitly and key billed rates by model so a mismatch names the model.

* test: Match the Mobile Model Option Name in Argon Scenarios

* fix: Route Gemini 4 Argon to a Multi-Region Vertex Endpoint by Default

Argon is served only from the global, us and eu multi-regions, so with
GOOGLE_LOC unset a Vertex request now uses global instead of the
us-central1 regional default; a configured location is kept as is.
Argon also rejects a candidate count, so candidateCount, candidate_count
and its OpenAI alias n are stripped for Argon on the native and
Gemini-compatible paths.

* chore: Bump @librechat/agents to 4.0.6 for Gemini 4 Argon Input Rules

* fix: Move Regional Vertex Locations to Their Multi-Region for Gemini 4 Argon

A configured regional location such as europe-west1 does not serve
Argon, so it now resolves to the multi-region that contains it (europe-*
to eu, us-* to us) wherever the location comes from, GOOGLE_LOC or
addParams. A region outside us and eu is kept rather than sent to
global, so data never leaves the configured geography silently.

* fix: Route Gemini 4 Argon Past Regional Vertex Endpoint Overrides
2026-10-17 21:44:44 +02:00
..
logger.js
tokens.spec.js 💠 feat: Add Gemini 4 Argon Support (#17200) 2026-10-17 21:44:44 +02:00