converse-mcp-server 3.2.4 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -234,6 +234,7 @@ SUMMARIZATION_MODEL=gpt-5-nano # Default: gpt-5-nano
234
234
 
235
235
  - **gemini-3.1-pro-preview** (aliases: `pro`, `gemini-pro`): Most advanced reasoning with expanded thinking levels (1M context, 64K output)
236
236
  - **gemini-3.5-flash** (aliases: `gemini-3.5`, `flash-3.5`): Frontier-level agentic and coding performance at Flash speed (1M context, 65K output)
237
+ - **gemini-3.8-flash** (aliases: `gemini-3.8`, `flash-3.8`): Current-generation Flash with stronger long-horizon agentic performance (1M context, 65K output; thinking levels low/medium/high — no minimal)
237
238
  - **gemini-2.5-pro** (alias: `pro 2.5`): Deep reasoning with thinking budget (1M context, 65K output)
238
239
  - **gemini-2.5-flash** (alias: `flash`): Ultra-fast (1M context, 65K output)
239
240
  - **gemini-2.5-flash-lite** (alias: `flash-lite`): Lightweight fast model (1M context, 65K output)
@@ -301,7 +302,7 @@ Reach these with the `copilot:` namespace (e.g. `copilot:gpt-5.6-terra`); uses y
301
302
 
302
303
  - **OpenAI**: `gpt-5.6-sol` (aliases: `gpt-5.6`, `gpt-5`), `gpt-5.6-terra`, `gpt-5.6-luna` (all support `reasoning_effort`)
303
304
  - **Anthropic**: `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-4.8` (aliases: `opus`, `claude`)
304
- - **Google**: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.5-flash` (alias: `gemini-flash`)
305
+ - **Google**: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.8-flash` (aliases: `gemini-3.8`, `flash-3.8`), `gemini-3.5-flash` (alias: `gemini-flash`)
305
306
  - Any other `copilot:<id>` is forwarded to the Copilot backend verbatim
306
307
 
307
308
  ## 📚 Help & Documentation
@@ -371,18 +372,42 @@ CODEX_APPROVAL_POLICY=never # never (default), untrusted, on-fa
371
372
 
372
373
  These must be set in your system environment or when launching Claude Code, NOT in the project .env file:
373
374
 
374
- | Variable | Description | Default | Example |
375
- | ----------------------- | --------------------------- | -------- | ------------------------------------ |
376
- | `MAX_MCP_OUTPUT_TOKENS` | Token response limit | `25000` | `200000` |
377
- | `MCP_TOOL_TIMEOUT` | Tool execution timeout (ms) | `120000` | `5400000` (90 min for deep research) |
375
+ | Variable | Description | Default | Example |
376
+ | ------------------------------------ | ----------------------------------------------------------------------- | ------------------------------- | --------------------------- |
377
+ | `MAX_MCP_OUTPUT_TOKENS` | Token response limit | `25000` | `200000` |
378
+ | `MCP_TOOL_TIMEOUT` | Wall-clock limit per tool call (ms) | ~28 hours when unset | `7200000` (2 h) |
379
+ | `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` | Idle window (ms) — aborts a call that produces no output for this long | 30 min (stdio) / 5 min (HTTP) | `3600000` (60 min) |
378
380
 
379
381
  ```bash
380
382
  # Example: Set globally before starting Claude Code
381
383
  export MAX_MCP_OUTPUT_TOKENS=200000
382
- export MCP_TOOL_TIMEOUT=5400000 # 90 minutes for deep research models
384
+ export CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT=3600000 # 60 min for long silent agentic calls
383
385
  claude # Then start Claude Code
384
386
  ```
385
387
 
388
+ Or persist them in `~/.claude/settings.json`:
389
+
390
+ ```json
391
+ {
392
+ "env": {
393
+ "MAX_MCP_OUTPUT_TOKENS": "200000",
394
+ "CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT": "3600000"
395
+ }
396
+ }
397
+ ```
398
+
399
+ **The idle timeout is usually what kills long calls.** Agentic models (Codex, Claude Agent SDK) can work silently for 30+ minutes; Converse holds one MCP request open the whole time, and Claude Code aborts it after the idle window with an error like _"failed after 30 minutes of silence. The idle timeout aborted it."_ Progress-notification heartbeats can't prevent this — Claude Code doesn't send a `progressToken` on `tools/call`, so an MCP server has no spec-compliant way to emit them ([claude-code#58687](https://github.com/anthropics/claude-code/issues/58687)). Raising the idle window is the only fix.
400
+
401
+ #### Codex CLI Tool Timeout
402
+
403
+ If you register Converse in OpenAI's Codex CLI, note that Codex enforces its own **hard 300-second default** per MCP tool call (`tool_timeout_sec`, undocumented — it exists only in Codex's config schema). Progress notifications don't extend it. Raise it in `~/.codex/config.toml`:
404
+
405
+ ```toml
406
+ [mcp_servers.converse]
407
+ # ... command/env ...
408
+ tool_timeout_sec = 3600 # default 300 kills long calls at 5 minutes
409
+ ```
410
+
386
411
  ### Model Selection
387
412
 
388
413
  Use `"auto"` for automatic model selection, or specify exact models:
@@ -421,7 +446,7 @@ Use `"auto"` for automatic model selection, or specify exact models:
421
446
  Provider priority order (subscription-based SDK providers first, then API-key providers):
422
447
 
423
448
  1. Codex (`codex`)
424
- 2. Gemini via Antigravity CLI (`gemini`, `gemini:flash`)
449
+ 2. Gemini via Antigravity CLI (`gemini` → Gemini 3.8 Flash, `gemini:pro`)
425
450
  3. Claude Agent SDK (`claude` → Claude Fable 5)
426
451
  4. Copilot (`copilot`)
427
452
  5. OpenAI (`gpt-5.6`)
@@ -532,6 +557,13 @@ For development setup, see the [Development](#-development) section below.
532
557
 
533
558
  - Clear cache and reinstall: `npm run clean`
534
559
 
560
+ **Long tool calls aborted mid-run (idle/timeout errors):**
561
+
562
+ - The abort almost always comes from the MCP _client_, not Converse — Converse's own limits are 30 min per provider call and 90 min per async job.
563
+ - Claude Code: raise `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` (idle window, default 30 min stdio / 5 min HTTP) and check `MCP_TOOL_TIMEOUT` (wall-clock). See [Claude Code Environment Variables](#claude-code-environment-variables-systemglobal).
564
+ - Codex CLI: set `tool_timeout_sec` under `[mcp_servers.converse]` in `~/.codex/config.toml` — the undocumented default is 300 seconds.
565
+ - Immune alternative: run the call with `async: true` and poll `check_status` — each poll is a fresh short request, so no client timeout applies.
566
+
535
567
  ### Debug Mode
536
568
 
537
569
  ```bash
package/docs/API.md CHANGED
@@ -391,6 +391,7 @@ Provide models as plain name strings in the `models` array. Bare names and alias
391
391
  |-------|---------|---------|--------|-------|
392
392
  | `gemini-3.1-pro-preview` | `pro`, `gemini-pro` | 1M | 64K | Most advanced reasoning, expanded thinking levels |
393
393
  | `gemini-3.5-flash` | `gemini-3.5`, `flash-3.5` | 1M | 65K | Frontier agentic/coding at Flash speed |
394
+ | `gemini-3.8-flash` | `gemini-3.8`, `flash-3.8` | 1M | 65K | Current-generation Flash; thinking low/medium/high only |
394
395
  | `gemini-2.5-pro` | `pro 2.5` | 1M | 65K | Deep reasoning with thinking budget |
395
396
  | `gemini-2.5-flash` | `flash` | 1M | 65K | Ultra-fast |
396
397
  | `gemini-2.5-flash-lite` | `flash-lite` | 1M | 65K | Lightweight fast model |
@@ -476,7 +477,7 @@ Any other model works via its full `provider/model` slug (e.g. `anthropic/claude
476
477
 
477
478
  The **Antigravity CLI** (`agy`) provides subscription-based access to Gemini models through Google OAuth:
478
479
 
479
- - **Models** (text-only): `gemini` (= `gemini:pro`, Gemini 3.1 Pro), `gemini:flash` (Gemini 3.5 Flash)
480
+ - **Models** (text-only): `gemini` (= `gemini:flash`, Gemini 3.8 Flash), `gemini:pro` (Gemini 3.1 Pro)
480
481
  - **Authentication**: Google OAuth via `agy` (one-time interactive login)
481
482
  - **Setup**: install the Antigravity CLI and run `agy` once to log in
482
483
  - **Billing**: uses your Antigravity subscription/compute allowance instead of API credits
@@ -502,7 +503,7 @@ Reach these with the `copilot:` namespace (e.g. `copilot:gpt-5.6-terra`); uses y
502
503
 
503
504
  - **OpenAI**: `gpt-5.6-sol` (aliases: `gpt-5.6`, `gpt-5`), `gpt-5.6-terra`, `gpt-5.6-luna` (all accept `reasoning_effort`)
504
505
  - **Anthropic**: `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-5` (aliases: `opus`, `claude`), `claude-opus-4.8`
505
- - **Google**: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.5-flash` (alias: `gemini-flash`)
506
+ - **Google**: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.8-flash` (aliases: `gemini-3.8`, `flash-3.8`), `gemini-3.5-flash` (alias: `gemini-flash`)
506
507
  - Any other `copilot:<id>` is forwarded to the Copilot backend verbatim
507
508
 
508
509
  ### Model Selection
@@ -522,7 +523,7 @@ Use `"auto"` for automatic selection, or specify exact models:
522
523
  "opus" // Anthropic API (-> claude-opus-5)
523
524
  "claude" // Claude Agent SDK (-> Claude Fable 5)
524
525
  "claude:opus" // Claude Agent SDK (Claude Opus 5)
525
- "gemini" // Antigravity CLI (Gemini 3.1 Pro)
526
+ "gemini" // Antigravity CLI (Gemini 3.8 Flash)
526
527
  "copilot:gpt-5.6-terra" // GitHub Copilot SDK
527
528
  ```
528
529
 
package/docs/PROVIDERS.md CHANGED
@@ -24,6 +24,7 @@ This guide documents all supported AI providers in the Converse MCP Server and t
24
24
  - **Supported Models**:
25
25
  - `gemini-3.1-pro-preview` (aliases: `pro`, `gemini-pro`) - Most advanced reasoning with expanded thinking levels (1M context, 64K output)
26
26
  - `gemini-3.5-flash` (aliases: `gemini-3.5`, `flash-3.5`) - Frontier-level agentic and coding performance at Flash speed (1M context, 65K output)
27
+ - `gemini-3.8-flash` (aliases: `gemini-3.8`, `flash-3.8`) - Current-generation Flash with stronger long-horizon agentic performance (1M context, 65K output; thinking levels low/medium/high — no minimal)
27
28
  - `gemini-2.5-pro` (alias: `pro 2.5`) - Deep reasoning with thinking budget (1M context, 65K output)
28
29
  - `gemini-2.5-flash` (alias: `flash`) - Ultra-fast model with thinking budget (1M context, 65K output)
29
30
  - `gemini-2.5-flash-lite` (alias: `flash-lite`) - Lightweight fast model (1M context, 65K output)
@@ -129,8 +130,8 @@ This guide documents all supported AI providers in the Converse MCP Server and t
129
130
  2. Authenticate: run `agy` once interactively and complete the Google OAuth login. This also establishes workspace trust for your home directory (the provider spawns each call in a per-call subdirectory under `~/.converse/agy-runs`).
130
131
  - **Environment Variables**: None (the provider detects the `agy` binary on PATH or at the platform install location)
131
132
  - **Supported Models** (text-only — print mode has no image input channel):
132
- - `gemini` (= `gemini:pro`) - Gemini 3.1 Pro
133
- - `gemini:flash` - Gemini 3.5 Flash
133
+ - `gemini` (= `gemini:flash`) - Gemini 3.8 Flash (default)
134
+ - `gemini:pro` - Gemini 3.1 Pro
134
135
  - `reasoning_effort` selects the variant: `low` → (Low), `medium` → (Medium) for Flash / (High) for Pro, `high`/`max` → (High); unset defaults to (High)
135
136
 
136
137
  **Key Features:**
@@ -216,7 +217,7 @@ agy
216
217
  - `copilot` - Uses Copilot's default or env-configured model
217
218
  - OpenAI: `gpt-5.6-sol` (aliases: bare `gpt-5.6`, `gpt-5`), `gpt-5.6-terra` (recommended balanced tier), `gpt-5.6-luna`
218
219
  - Anthropic: `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-5` (aliases: `opus`, `claude`), `claude-opus-4.8`
219
- - Google: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.5-flash` (alias: `gemini-flash`)
220
+ - Google: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.8-flash` (aliases: `gemini-3.8`, `flash-3.8`), `gemini-3.5-flash` (alias: `gemini-flash`)
220
221
  - **Reasoning**: The `gpt-5.6-sol`/`terra`/`luna` tiers accept `reasoning_effort`.
221
222
  - **Explicit pass-through**: Any other `copilot:<id>` model string is forwarded to the Copilot backend verbatim, so IDs outside the curated list still work while the backend accepts them.
222
223
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "converse-mcp-server",
3
- "version": "3.2.4",
3
+ "version": "3.3.0",
4
4
  "description": "Converse MCP Server - Converse with other LLMs with chat and consensus tools",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -93,28 +93,28 @@
93
93
  ".env.example"
94
94
  ],
95
95
  "dependencies": {
96
- "@anthropic-ai/claude-agent-sdk": "^0.3.220",
97
- "@anthropic-ai/sdk": "^0.115.0",
98
- "@github/copilot-sdk": "^1.0.8",
99
- "@google/genai": "^2.13.0",
100
- "@lydell/node-pty": "1.2.0-beta.14",
101
- "@mistralai/mistralai": "^2.5.0",
102
- "@modelcontextprotocol/sdk": "^1.29.0",
103
- "@openai/codex-sdk": "^0.145.0",
96
+ "@anthropic-ai/claude-agent-sdk": "^0.3.258",
97
+ "@anthropic-ai/sdk": "^0.123.0",
98
+ "@github/copilot-sdk": "^1.0.11",
99
+ "@google/genai": "^2.20.0",
100
+ "@lydell/node-pty": "1.2.0-beta.15",
101
+ "@mistralai/mistralai": "^2.6.4",
102
+ "@modelcontextprotocol/sdk": "^1.30.0",
103
+ "@openai/codex-sdk": "^0.152.1",
104
104
  "cors": "^2.8.6",
105
105
  "dotenv": "^17.4.2",
106
106
  "express": "^5.2.1",
107
107
  "lru-cache": "^11.5.2",
108
- "nanoid": "^6.0.0",
109
- "openai": "^6.49.0",
110
- "p-limit": "^7.3.1",
111
- "vite": "^8.1.5"
108
+ "nanoid": "^6.0.1",
109
+ "openai": "^7.9.0",
110
+ "p-limit": "^7.3.2",
111
+ "vite": "^8.2.2"
112
112
  },
113
113
  "devDependencies": {
114
- "@vitest/coverage-v8": "^4.1.10",
114
+ "@vitest/coverage-v8": "^4.1.11",
115
115
  "cross-env": "^10.1.0",
116
- "eslint": "^10.8.0",
116
+ "eslint": "^10.9.1",
117
117
  "rimraf": "^6.1.3",
118
- "vitest": "^4.1.10"
118
+ "vitest": "^4.1.11"
119
119
  }
120
120
  }
@@ -20,7 +20,9 @@
20
20
  *
21
21
  * The provider registry key remains 'gemini-cli' and the user-facing alias
22
22
  * remains 'gemini' for routing/normalization stability. Only three user-facing
23
- * model names are exposed: gemini (= gemini:pro), gemini:pro, gemini:flash.
23
+ * model names are exposed: gemini (= gemini:flash), gemini:flash, gemini:pro.
24
+ * Flash is the default: Gemini 3.8 Flash is the current-generation model agy
25
+ * lists first, while 3.1 Pro remains the only Pro tier Antigravity offers.
24
26
  */
25
27
 
26
28
  import { existsSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
@@ -57,7 +59,7 @@ const PTY_COLS = 1000;
57
59
  const SUPPORTED_MODELS = {
58
60
  gemini: {
59
61
  modelName: 'gemini',
60
- friendlyName: 'Gemini 3.1 Pro (via Antigravity CLI)',
62
+ friendlyName: 'Gemini 3.8 Flash (via Antigravity CLI)',
61
63
  contextWindow: 1048576,
62
64
  maxOutputTokens: 65536,
63
65
  supportsStreaming: true,
@@ -66,14 +68,14 @@ const SUPPORTED_MODELS = {
66
68
  supportsThinking: true,
67
69
  timeout: DEFAULT_TIMEOUT_MS,
68
70
  description:
69
- 'Gemini 3.1 Pro via Antigravity CLI (agy) - requires Antigravity Google OAuth login',
71
+ 'Gemini 3.8 Flash via Antigravity CLI (agy) - requires Antigravity Google OAuth login',
70
72
  aliases: ['gemini-cli'],
71
73
  // agy display-name base; reasoning_effort selects the parenthesized variant
72
- agyModelBase: 'Gemini 3.1 Pro',
74
+ agyModelBase: 'Gemini 3.8 Flash',
73
75
  },
74
- 'gemini:pro': {
75
- modelName: 'gemini:pro',
76
- friendlyName: 'Gemini 3.1 Pro (via Antigravity CLI)',
76
+ 'gemini:flash': {
77
+ modelName: 'gemini:flash',
78
+ friendlyName: 'Gemini 3.8 Flash (via Antigravity CLI)',
77
79
  contextWindow: 1048576,
78
80
  maxOutputTokens: 65536,
79
81
  supportsStreaming: true,
@@ -82,13 +84,13 @@ const SUPPORTED_MODELS = {
82
84
  supportsThinking: true,
83
85
  timeout: DEFAULT_TIMEOUT_MS,
84
86
  description:
85
- 'Gemini 3.1 Pro via Antigravity CLI (agy) - explicit alias of `gemini`',
86
- aliases: [],
87
- agyModelBase: 'Gemini 3.1 Pro',
87
+ 'Gemini 3.8 Flash via Antigravity CLI (agy) - explicit alias of `gemini`',
88
+ aliases: ['flash'],
89
+ agyModelBase: 'Gemini 3.8 Flash',
88
90
  },
89
- 'gemini:flash': {
90
- modelName: 'gemini:flash',
91
- friendlyName: 'Gemini 3.5 Flash (via Antigravity CLI)',
91
+ 'gemini:pro': {
92
+ modelName: 'gemini:pro',
93
+ friendlyName: 'Gemini 3.1 Pro (via Antigravity CLI)',
92
94
  contextWindow: 1048576,
93
95
  maxOutputTokens: 65536,
94
96
  supportsStreaming: true,
@@ -97,9 +99,9 @@ const SUPPORTED_MODELS = {
97
99
  supportsThinking: true,
98
100
  timeout: DEFAULT_TIMEOUT_MS,
99
101
  description:
100
- 'Gemini 3.5 Flash via Antigravity CLI (agy) - requires Antigravity Google OAuth login',
101
- aliases: ['flash'],
102
- agyModelBase: 'Gemini 3.5 Flash',
102
+ 'Gemini 3.1 Pro via Antigravity CLI (agy) - requires Antigravity Google OAuth login',
103
+ aliases: ['pro'],
104
+ agyModelBase: 'Gemini 3.1 Pro',
103
105
  },
104
106
  };
105
107
 
@@ -175,7 +177,7 @@ export function findAgyBinary() {
175
177
  /**
176
178
  * Map a reasoning_effort value to the agy parenthesized variant suffix.
177
179
  * Flash supports Low/Medium/High; Pro supports Low/High (no Medium).
178
- * @param {string} base - agy model base ('Gemini 3.5 Flash' / 'Gemini 3.1 Pro')
180
+ * @param {string} base - agy model base ('Gemini 3.8 Flash' / 'Gemini 3.1 Pro')
179
181
  * @param {string} [reasoningEffort]
180
182
  * @returns {string} e.g. '(Low)', '(Medium)', '(High)'
181
183
  */
@@ -207,7 +209,7 @@ function effortSuffix(base, reasoningEffort) {
207
209
  * verbatim so power users aren't blocked.
208
210
  * @param {string} model - e.g. 'gemini', 'gemini:flash', or a full agy name
209
211
  * @param {string} [reasoningEffort]
210
- * @returns {string} agy --model value, e.g. 'Gemini 3.1 Pro (High)'
212
+ * @returns {string} agy --model value, e.g. 'Gemini 3.8 Flash (High)'
211
213
  */
212
214
  export function resolveAgyModel(model, reasoningEffort) {
213
215
  const raw = typeof model === 'string' ? model.trim() : '';
@@ -230,11 +232,11 @@ export function resolveAgyModel(model, reasoningEffort) {
230
232
  !nameLower ||
231
233
  nameLower === 'gemini' ||
232
234
  nameLower === 'gemini-cli' ||
233
- nameLower === 'pro'
235
+ nameLower === 'flash'
234
236
  ) {
235
237
  base = SUPPORTED_MODELS.gemini.agyModelBase;
236
- } else if (nameLower === 'flash') {
237
- base = SUPPORTED_MODELS['gemini:flash'].agyModelBase;
238
+ } else if (nameLower === 'pro') {
239
+ base = SUPPORTED_MODELS['gemini:pro'].agyModelBase;
238
240
  } else {
239
241
  // Unknown suffix: pass through verbatim (power-user agy display name)
240
242
  return raw;
@@ -762,19 +764,16 @@ export const geminiCliProvider = {
762
764
 
763
765
  const name = modelName.toLowerCase().trim();
764
766
 
765
- // Full agy display-name passthrough → matching base config.
766
- if (/gemini 3\.5 flash/i.test(modelName)) {
767
+ // Full agy display-name passthrough → matching tier config. Any 3.x Flash
768
+ // (agy also lists 3.6/3.7) shares the Flash config; any 3.x Pro the Pro one.
769
+ if (/gemini 3\.\d+ flash/i.test(modelName)) {
767
770
  return SUPPORTED_MODELS['gemini:flash'];
768
771
  }
769
- if (/gemini 3\.1 pro/i.test(modelName)) {
770
- return SUPPORTED_MODELS.gemini;
771
- }
772
-
773
- if (name === 'pro') {
772
+ if (/gemini 3\.\d+ pro/i.test(modelName)) {
774
773
  return SUPPORTED_MODELS['gemini:pro'];
775
774
  }
776
775
 
777
- // Exact key match (gemini, gemini:pro, gemini:flash)
776
+ // Exact key match (gemini, gemini:flash, gemini:pro)
778
777
  if (SUPPORTED_MODELS[name]) {
779
778
  return SUPPORTED_MODELS[name];
780
779
  }
@@ -127,6 +127,32 @@ const SUPPORTED_MODELS = {
127
127
  '3.5-flash',
128
128
  ],
129
129
  },
130
+ 'gemini-3.8-flash': {
131
+ modelName: 'gemini-3.8-flash',
132
+ friendlyName: 'Gemini (Flash 3.8)',
133
+ contextWindow: 1048576, // 1M tokens
134
+ maxOutputTokens: 65536,
135
+ supportsStreaming: true,
136
+ supportsImages: true,
137
+ supportsThinking: true,
138
+ supportsWebSearch: true,
139
+ thinkingMode: 'level',
140
+ // 3.8 Flash rejects thinkingLevel "minimal" outright (API error), unlike 3.5.
141
+ thinkingLevels: ['low', 'medium', 'high'],
142
+ timeout: 900000,
143
+ description:
144
+ 'Gemini 3.8 Flash - Current-generation Flash with stronger long-horizon agentic performance (1M context)',
145
+ aliases: [
146
+ 'gemini-3.8',
147
+ 'gemini3.8',
148
+ 'gemini-3.8-flash-latest',
149
+ 'flash-3.8',
150
+ 'flash3.8',
151
+ 'gemini-flash-3.8',
152
+ 'gemini flash 3.8',
153
+ '3.8-flash',
154
+ ],
155
+ },
130
156
  };
131
157
 
132
158
  // Thinking mode budget percentages
@@ -514,10 +540,17 @@ export const googleProvider = {
514
540
  };
515
541
  thinkingLevel = levelMap[reasoning_effort] || 'high';
516
542
  if (!modelConfig.thinkingLevels.includes(thinkingLevel)) {
543
+ // Clamp to the nearest supported level: a request below the
544
+ // model's floor (e.g. minimal on 3.8 Flash) takes the lowest
545
+ // level, anything else the highest.
546
+ const rank = ['minimal', 'low', 'medium', 'high'];
547
+ const [lowest] = modelConfig.thinkingLevels;
517
548
  thinkingLevel =
518
- modelConfig.thinkingLevels[
519
- modelConfig.thinkingLevels.length - 1
520
- ];
549
+ rank.indexOf(thinkingLevel) < rank.indexOf(lowest)
550
+ ? lowest
551
+ : modelConfig.thinkingLevels[
552
+ modelConfig.thinkingLevels.length - 1
553
+ ];
521
554
  }
522
555
  } else {
523
556
  // Binary levels only (Gemini 3.0 Pro: low/high)