Skip to content

💠 feat: Add Gemini 4 Argon Support - #17200

Merged
berry-13 merged 8 commits into
devfrom
berry-13/feat-gemini-4-argon
Oct 17, 2026
Merged

berry-13 merged 8 commits into
devfrom
berry-13/feat-gemini-4-argon

Conversation

@berry-13

@berry-13 berry-13 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Google released Gemini 4 Argon (gemini-4-argon) as GA on 2026-10-13 for both the Gemini API and Google Cloud Gemini Enterprise Agent Platform. LibreChat had no entry for it: the model was missing from the default Google list, its usage was priced at the generic gemini fallback ($0.50 / $1.50 per 1M, a 4-7x under-count), and requests could still carry minimal thinking and thinkingBudget, which Argon rejects with HTTP 400.

This registers Argon the way the Gemini 3.8 Flash integration (#15519) did: in the default model list and both GOOGLE_MODELS examples, with the shared 1,048,576-token context window, the Flash-family request rule (default medium thinking, minimal substituted with low, ignored sampling params and thinkingBudget stripped), and the introductory rates of $2 input / $10 output / $0.10 implicitly cached input per 1M, with the 2026-12-01 change to $4 / $20 / $0.20 noted at both call sites. The allowlisted gemini-4-argon-cyber-permissive variant defaults to high, as Google documents. Argon also rejects a candidate count, so candidateCount, candidate_count and the OpenAI alias n are stripped for it. On Vertex, Argon is served only from the global, us and eu multi-regions, so with GOOGLE_LOC unset it now uses global instead of the us-central1 default, and a configured regional location moves to the multi-region that contains it (europe-* to eu, us-* to us). A configured multi-region, including eu, is kept as is, and a region outside us and eu is never moved to global. Output stays at the 65,535 synchronous cap, so the shared 1M window leaves a positive input budget. Long decode beyond 64K is out of scope, as the issue allows.

Related to #17074

Depends on LibreChat-AI/agents#620, which lets Argon take image, audio, video and PDF input on the Gemini API client and drops a trailing model turn that Argon rejects. This PR bumps @librechat/agents once that is released.

Type of change

  • Feature
  • Tests / tooling / CI

Testing

Tested environments/configuration:

  • Provider/model: Google (API key) and Vertex AI with GOOGLE_LOC=eu, gemini-4-argon

Automated tests:

  • packages/api: google/llm.spec.ts, utils/tokens.spec.ts, openai/config.google.spec.ts (224 passed), covering the thinking default, explicit levels, minimal substitution, legacy and sampling param removal, the cyber-permissive default, the eu multi-region endpoint on Vertex, the global default when GOOGLE_LOC is unset, regional-to-multi-region resolution from GOOGLE_LOC and addParams, the candidate-count strip, and the OpenAI-compatible addParams strip
  • packages/data-schemas: tx.spec.ts (290 passed), covering the value key, rates, cache rates and the absence of a long-context tier
  • api/utils/tokens.spec.js (185 passed)
  • With the source changes reverted, 9 of the new tests fail
  • Playwright mock scenarios in e2e/specs/mock/scenarios/gemini-argon.spec.ts (desktop light, desktop dark, mobile): a Gemini-compatible gateway whose addParams carry sampling values sends none of them for gemini-4-argon while gemini-2.5-pro keeps them, the context budget stays positive, and an Argon turn is recorded at the $2 / $10 rates
  • npx tsc --noEmit in packages/api, packages/data-schemas and packages/data-provider

Screenshots / recordings

No layout or styling change; gemini-4-argon is a new entry in the Google model list.

Risk / compatibility

The December 1 price change is a comment, matching the existing Flash entries, so tx.ts needs its rates updated on that date.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • Required documentation PR: N/A

Copilot AI balanced review requested due to automatic review settings October 17, 2026 09:01

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown
Contributor

Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures.

[WebServer] 2026-10-17 09:03:10 info: [GenerationJobManager] Configured with in-memory stores

[WebServer] 2026-10-17 09:03:10 info: HTTP server timeout configuration

[WebServer] 2026-10-17 09:03:10 info: Server listening at http://localhost:3080

[WebServer] 2026-10-17 09:03:10 info: [MCPServersRegistry] Creating new instance

[WebServer] 2026-10-17 09:03:10 info: OAuth reconnect manager initialized successfully.

[WebServer] 2026-10-17 09:03:10 info: Created collection: projects

🤖: global setup has been started
🤖: using baseURL http://localhost:3080
🤖: using E2E user: testuser@example.com
[WebServer] 2026-10-17 09:03:12 info: [agent-triggers] durable delivery engine started

[WebServer] 2026-10-17 09:03:13 info: [schedules] engine started

[WebServer] 2026-10-17 09:03:13 info: Server readiness checks passing.

🤖: 🗝  authenticating user: testuser@example.com
🤖: ✔️  localStorage: set Nav as Visible /home/runner/work/LibreChat/LibreChat/e2e/storageState.json
🤖: ✔️  user successfully registered
[WebServer] 2026-10-17 09:03:23 info: [Login] [Login successful] [Username: [REDACTED_EMAIL]] [Request-IP: ::1] {"requestId":"c2a39d2d-56e4-44af-8d3c-dc1bf5fe64bf","request_id":"c2a39d2d-56e4-44af-8d3c-dc1bf5fe64bf","request_method":"POST","request_path":"/api/auth"}

🤖: ✔️  user successfully authenticated
🤖: ✔️  authentication state successfully saved in /home/runner/work/LibreChat/LibreChat/e2e/storageState.json
🤖: global setup has been finished

Running 1 test using 1 worker

[1/1] [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets
[chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets
Lighthouse run 1/3 attempt 1 did not complete, retrying: Command failed: /opt/hostedtoolcache/node/24.16.0/x64/bin/node /home/runner/work/LibreChat/LibreChat/node_modules/lighthouse/cli/index.js http://localhost:3080/c/16390000-0000-4000-8000-000000000001 --quiet --preset=desktop --throttling-method=provided --only-categories=performance --chrome-flags=--headless=new --extra-headers={"Cookie":"token_provider=librechat; refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjZhZDMzOWQ3ZDBiYTE0NzE0MjdmYTM3OCIsInNlc3Npb25JZCI6IjZhZDMzOWRlZDBiYTE0NzE0MjdmYTM5OSIsImlzc3VlZEF0TXMiOjE3OTIyMjc4MDY4MjQsImlhdCI6MTc5MjIyNzgwNiwiZXhwIjoxNzkyMjMxNDA2fQ.PjypNRHTDXMcFP2eoRK9LxUvfwj327zdiZRbrimljbI; session_hint=1792231406824~%3A6ad339d7d0ba1471427fa378"} --output=json --output=html --output-path=/home/runner/work/LibreChat/LibreChat/.lighthouse/lhr-1

Lighthouse run 1/3 wrote /home/runner/work/LibreChat/LibreChat/.lighthouse/lhr-1.report.json

Lighthouse run 2/3 attempt 1 did not complete, retrying: Command failed: /opt/hostedtoolcache/node/24.16.0/x64/bin/node /home/runner/work/LibreChat/LibreChat/node_modules/lighthouse/cli/index.js http://localhost:3080/c/16390000-0000-4000-8000-000000000001 --quiet --preset=desktop --throttling-method=provided --only-categories=performance --chrome-flags=--headless=new --extra-headers={"Cookie":"token_provider=librechat; refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjZhZDMzOWQ3ZDBiYTE0NzE0MjdmYTM3OCIsInNlc3Npb25JZCI6IjZhZDMzOWRlZDBiYTE0NzE0MjdmYTM5OSIsImlzc3VlZEF0TXMiOjE3OTIyMjc4MDY4MjQsImlhdCI6MTc5MjIyNzgwNiwiZXhwIjoxNzkyMjMxNDA2fQ.PjypNRHTDXMcFP2eoRK9LxUvfwj327zdiZRbrimljbI; session_hint=1792231406824~%3A6ad339d7d0ba1471427fa378"} --output=json --output=html --output-path=/home/runner/work/LibreChat/LibreChat/.lighthouse/lhr-2

  1) [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

    Error: Command failed: /opt/hostedtoolcache/node/24.16.0/x64/bin/node /home/runner/work/LibreChat/LibreChat/node_modules/lighthouse/cli/index.js http://localhost:3080/c/16390000-0000-4000-8000-000000000001 --quiet --preset=desktop --throttling-method=provided --only-categories=performance --chrome-flags=--headless=new --extra-headers={"Cookie":"token_provider=librechat; refreshToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjZhZDMzOWQ3ZDBiYTE0NzE0MjdmYTM3OCIsInNlc3Npb25JZCI6IjZhZDMzOWRlZDBiYTE0NzE0MjdmYTM5OSIsImlzc3VlZEF0TXMiOjE3OTIyMjc4MDY4MjQsImlhdCI6MTc5MjIyNzgwNiwiZXhwIjoxNzkyMjMxNDA2fQ.PjypNRHTDXMcFP2eoRK9LxUvfwj327zdiZRbrimljbI; session_hint=1792231406824~%3A6ad339d7d0ba1471427fa378"} --output=json --output=html --output-path=/home/runner/work/LibreChat/LibreChat/.lighthouse/lhr-2
    Runtime error encountered: Something went wrong with recording the trace over your page load. Please run Lighthouse again. (NO_NAVSTART)


    attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/test-failed-1.png
    ────────────────────────────────────────────────────────────────────────────────────────────────

    Error Context: e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/error-context.md

    attachment #3: trace (application/zip) ─────────────────────────────────────────────────────────
    e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip
    Usage:

        npx playwright show-trace e2e/lighthouse/.test-results/load-serial-database-latency-stays-within-web-vitals-budgets-chrome/trace.zip

    ────────────────────────────────────────────────────────────────────────────────────────────────


🤖: global teardown has been started
2026-10-17 09:05:38 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-17 09:05:38 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
🤖:  ✅  Connected to Database
🤖:  ✅  Found user in Database
🤖:  ✅  Deleted 1 convos & 2 messages
🤖:  ✅  Deleted user from Database
🤖: global teardown has been started
2026-10-17 09:05:39 �[32minfo�[39m: �[32mMongo Connection options�[39m
2026-10-17 09:05:39 �[32minfo�[39m: �[32m{�[39m
�[32m  "bufferCommands": false�[39m
�[32m}�[39m
2026-10-17 09:05:39 �[31merror�[39m: �[31mIndex build failed for "Conversation": Operation interrupted because client was closed�[39m
🤖:  ✅  Connected to Database
🤖:  ⚠️  User not found in Database
  1 failed
    [chrome] › e2e/lighthouse/load.spec.ts:10:5 › serial database latency stays within web-vitals budgets 

Open the full run

@berry-13
berry-13 marked this pull request as ready for review October 17, 2026 09:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T17:10:49.653939Z 68166e8 New commits
🔒 Security Review ✅ Completed 2026-10-17T09:34:34.637308Z 19570af Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19570afb3a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/data-provider/src/config.ts
Comment thread .env.example
Comment thread packages/api/src/endpoints/google/llm.ts Outdated
Comment thread packages/api/src/endpoints/google/llm.ts
Comment thread packages/api/src/endpoints/google/llm.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 706983a3d6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/endpoints/google/llm.ts
@berry-13
berry-13 force-pushed the berry-13/feat-gemini-4-argon branch from 0cf1ea8 to 381b92e Compare October 17, 2026 13:41
@berry-13

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 381b92e3dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/endpoints/google/llm.ts
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
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.
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.
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.
…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.
@berry-13
berry-13 force-pushed the berry-13/feat-gemini-4-argon branch from 381b92e to 68166e8 Compare October 17, 2026 17:08
@berry-13
berry-13 merged commit 9649541 into dev Oct 17, 2026
50 checks passed
@berry-13
berry-13 deleted the berry-13/feat-gemini-4-argon branch October 17, 2026 19:44
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