converse-mcp-server 2.29.2 → 3.0.1

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.
Files changed (42) hide show
  1. package/.env.example +6 -3
  2. package/README.md +96 -94
  3. package/docs/API.md +703 -1562
  4. package/docs/ARCHITECTURE.md +13 -11
  5. package/docs/EXAMPLES.md +241 -667
  6. package/docs/PROVIDERS.md +104 -79
  7. package/package.json +1 -1
  8. package/src/async/asyncJobStore.js +2 -2
  9. package/src/async/jobRunner.js +6 -1
  10. package/src/async/providerStreamNormalizer.js +59 -1
  11. package/src/config.js +4 -3
  12. package/src/prompts/helpPrompt.js +43 -61
  13. package/src/providers/anthropic.js +0 -31
  14. package/src/providers/claude.js +0 -14
  15. package/src/providers/codex.js +15 -21
  16. package/src/providers/copilot.js +36 -202
  17. package/src/providers/deepseek.js +73 -53
  18. package/src/providers/gemini-cli.js +0 -3
  19. package/src/providers/google.js +10 -27
  20. package/src/providers/interface.js +0 -3
  21. package/src/providers/mistral.js +169 -63
  22. package/src/providers/openai-compatible.js +113 -28
  23. package/src/providers/openai.js +14 -66
  24. package/src/providers/openrouter-discovery.js +308 -0
  25. package/src/providers/openrouter.js +452 -282
  26. package/src/providers/xai.js +298 -280
  27. package/src/services/summarizationService.js +4 -14
  28. package/src/systemPrompts.js +19 -2
  29. package/src/tools/cancelJob.js +7 -1
  30. package/src/tools/chat.js +957 -995
  31. package/src/tools/checkStatus.js +1 -0
  32. package/src/tools/index.js +2 -6
  33. package/src/tools/modes/parallel.js +488 -0
  34. package/src/tools/modes/roundtable.js +495 -0
  35. package/src/tools/modes/streamShared.js +31 -0
  36. package/src/utils/contextProcessor.js +1 -38
  37. package/src/utils/conversationExporter.js +6 -26
  38. package/src/utils/formatStatus.js +46 -19
  39. package/src/utils/modelRouting.js +207 -4
  40. package/src/providers/openrouter-endpoints-client.js +0 -220
  41. package/src/tools/consensus.js +0 -1813
  42. package/src/tools/conversation.js +0 -1233
@@ -26,7 +26,6 @@ const SUPPORTED_MODELS = {
26
26
  maxOutputTokens: 16384,
27
27
  supportsStreaming: true,
28
28
  supportsImages: false,
29
- supportsTemperature: false,
30
29
  supportsWebSearch: false,
31
30
  timeout: 600000,
32
31
  description:
@@ -35,223 +34,72 @@ const SUPPORTED_MODELS = {
35
34
  },
36
35
 
37
36
  // OpenAI models
38
- 'gpt-4.1': {
39
- modelName: 'gpt-4.1',
40
- friendlyName: 'GPT-4.1 (via Copilot)',
37
+ // Bare `gpt-5.6` (and the legacy `gpt-5` shortcut) route to Sol, matching
38
+ // Copilot's own bare-alias behavior. Terra is the recommended balanced tier.
39
+ 'gpt-5.6-sol': {
40
+ modelName: 'gpt-5.6-sol',
41
+ friendlyName: 'GPT-5.6 Sol (via Copilot)',
41
42
  contextWindow: 1047576,
42
43
  maxOutputTokens: 32768,
43
44
  supportsStreaming: true,
44
45
  supportsImages: false,
45
- supportsTemperature: false,
46
- supportsWebSearch: false,
47
- timeout: 600000,
48
- description: 'OpenAI GPT-4.1 via Copilot subscription',
49
- aliases: [],
50
- },
51
- 'gpt-5-mini': {
52
- modelName: 'gpt-5-mini',
53
- friendlyName: 'GPT-5 Mini (via Copilot)',
54
- contextWindow: 1047576,
55
- maxOutputTokens: 16384,
56
- supportsStreaming: true,
57
- supportsImages: false,
58
- supportsTemperature: false,
59
46
  supportsWebSearch: false,
60
47
  supportsReasoningEffort: true,
61
48
  timeout: 600000,
62
- description: 'OpenAI GPT-5 Mini via Copilot subscription',
63
- aliases: [],
49
+ description: 'OpenAI GPT-5.6 Sol via Copilot subscription',
50
+ aliases: ['gpt-5.6', 'gpt-5'],
64
51
  },
65
- 'gpt-5.1': {
66
- modelName: 'gpt-5.1',
67
- friendlyName: 'GPT-5.1 (via Copilot)',
52
+ 'gpt-5.6-terra': {
53
+ modelName: 'gpt-5.6-terra',
54
+ friendlyName: 'GPT-5.6 Terra (via Copilot)',
68
55
  contextWindow: 1047576,
69
56
  maxOutputTokens: 32768,
70
57
  supportsStreaming: true,
71
58
  supportsImages: false,
72
- supportsTemperature: false,
73
59
  supportsWebSearch: false,
74
60
  supportsReasoningEffort: true,
75
61
  timeout: 600000,
76
- description: 'OpenAI GPT-5.1 via Copilot subscription',
62
+ description: 'OpenAI GPT-5.6 Terra via Copilot subscription',
77
63
  aliases: [],
78
64
  },
79
- 'gpt-5.1-codex': {
80
- modelName: 'gpt-5.1-codex',
81
- friendlyName: 'GPT-5.1 Codex (via Copilot)',
82
- contextWindow: 192000,
83
- maxOutputTokens: 16384,
84
- supportsStreaming: true,
85
- supportsImages: false,
86
- supportsTemperature: false,
87
- supportsWebSearch: false,
88
- supportsReasoningEffort: true,
89
- timeout: 600000,
90
- description: 'OpenAI GPT-5.1 Codex via Copilot subscription',
91
- aliases: [],
92
- },
93
- 'gpt-5.1-codex-mini': {
94
- modelName: 'gpt-5.1-codex-mini',
95
- friendlyName: 'GPT-5.1 Codex Mini (via Copilot)',
96
- contextWindow: 192000,
97
- maxOutputTokens: 16384,
98
- supportsStreaming: true,
99
- supportsImages: false,
100
- supportsTemperature: false,
101
- supportsWebSearch: false,
102
- supportsReasoningEffort: true,
103
- timeout: 600000,
104
- description: 'OpenAI GPT-5.1 Codex Mini via Copilot subscription',
105
- aliases: [],
106
- },
107
- 'gpt-5.1-codex-max': {
108
- modelName: 'gpt-5.1-codex-max',
109
- friendlyName: 'GPT-5.1 Codex Max (via Copilot)',
110
- contextWindow: 192000,
111
- maxOutputTokens: 16384,
112
- supportsStreaming: true,
113
- supportsImages: false,
114
- supportsTemperature: false,
115
- supportsWebSearch: false,
116
- supportsReasoningEffort: true,
117
- timeout: 600000,
118
- description: 'OpenAI GPT-5.1 Codex Max via Copilot subscription',
119
- aliases: [],
120
- },
121
- 'gpt-5.4': {
122
- modelName: 'gpt-5.4',
123
- friendlyName: 'GPT-5.4 (via Copilot)',
65
+ 'gpt-5.6-luna': {
66
+ modelName: 'gpt-5.6-luna',
67
+ friendlyName: 'GPT-5.6 Luna (via Copilot)',
124
68
  contextWindow: 1047576,
125
69
  maxOutputTokens: 32768,
126
70
  supportsStreaming: true,
127
71
  supportsImages: false,
128
- supportsTemperature: false,
129
- supportsWebSearch: false,
130
- supportsReasoningEffort: true,
131
- timeout: 600000,
132
- description: 'OpenAI GPT-5.4 via Copilot subscription',
133
- aliases: ['gpt-5', 'codex'],
134
- },
135
- 'gpt-5.2-codex': {
136
- modelName: 'gpt-5.2-codex',
137
- friendlyName: 'GPT-5.2 Codex (via Copilot)',
138
- contextWindow: 192000,
139
- maxOutputTokens: 16384,
140
- supportsStreaming: true,
141
- supportsImages: false,
142
- supportsTemperature: false,
143
72
  supportsWebSearch: false,
144
73
  supportsReasoningEffort: true,
145
74
  timeout: 600000,
146
- description: 'OpenAI GPT-5.2 Codex via Copilot subscription',
147
- aliases: [],
148
- },
149
- 'gpt-5.3-codex': {
150
- modelName: 'gpt-5.3-codex',
151
- friendlyName: 'GPT-5.3 Codex (via Copilot)',
152
- contextWindow: 192000,
153
- maxOutputTokens: 16384,
154
- supportsStreaming: true,
155
- supportsImages: false,
156
- supportsTemperature: false,
157
- supportsWebSearch: false,
158
- supportsReasoningEffort: true,
159
- timeout: 600000,
160
- description: 'OpenAI GPT-5.3 Codex via Copilot subscription',
75
+ description: 'OpenAI GPT-5.6 Luna via Copilot subscription',
161
76
  aliases: [],
162
77
  },
163
78
 
164
79
  // Anthropic models
165
- 'claude-haiku-4.5': {
166
- modelName: 'claude-haiku-4.5',
167
- friendlyName: 'Claude Haiku 4.5 (via Copilot)',
168
- contextWindow: 200000,
169
- maxOutputTokens: 8192,
170
- supportsStreaming: true,
171
- supportsImages: false,
172
- supportsTemperature: false,
173
- supportsWebSearch: false,
174
- timeout: 600000,
175
- description: 'Anthropic Claude Haiku 4.5 via Copilot subscription',
176
- aliases: ['haiku'],
177
- },
178
- 'claude-sonnet-4': {
179
- modelName: 'claude-sonnet-4',
180
- friendlyName: 'Claude Sonnet 4 (via Copilot)',
181
- contextWindow: 200000,
182
- maxOutputTokens: 16384,
183
- supportsStreaming: true,
184
- supportsImages: false,
185
- supportsTemperature: false,
186
- supportsWebSearch: false,
187
- timeout: 600000,
188
- description: 'Anthropic Claude Sonnet 4 via Copilot subscription',
189
- aliases: [],
190
- },
191
- 'claude-sonnet-4.5': {
192
- modelName: 'claude-sonnet-4.5',
193
- friendlyName: 'Claude Sonnet 4.5 (via Copilot)',
194
- contextWindow: 200000,
195
- maxOutputTokens: 16384,
196
- supportsStreaming: true,
197
- supportsImages: false,
198
- supportsTemperature: false,
199
- supportsWebSearch: false,
200
- timeout: 600000,
201
- description: 'Anthropic Claude Sonnet 4.5 via Copilot subscription',
202
- aliases: [],
203
- },
204
- 'claude-sonnet-4.6': {
205
- modelName: 'claude-sonnet-4.6',
206
- friendlyName: 'Claude Sonnet 4.6 (via Copilot)',
207
- contextWindow: 200000,
208
- maxOutputTokens: 16384,
209
- supportsStreaming: true,
210
- supportsImages: false,
211
- supportsTemperature: false,
212
- supportsWebSearch: false,
213
- timeout: 600000,
214
- description: 'Anthropic Claude Sonnet 4.6 via Copilot subscription',
215
- aliases: ['sonnet'],
216
- },
217
- 'claude-opus-4.5': {
218
- modelName: 'claude-opus-4.5',
219
- friendlyName: 'Claude Opus 4.5 (via Copilot)',
220
- contextWindow: 200000,
221
- maxOutputTokens: 32768,
222
- supportsStreaming: true,
223
- supportsImages: false,
224
- supportsTemperature: false,
225
- supportsWebSearch: false,
226
- timeout: 600000,
227
- description: 'Anthropic Claude Opus 4.5 via Copilot subscription',
228
- aliases: [],
229
- },
230
- 'claude-opus-4.6': {
231
- modelName: 'claude-opus-4.6',
232
- friendlyName: 'Claude Opus 4.6 (via Copilot)',
80
+ 'claude-fable-5': {
81
+ modelName: 'claude-fable-5',
82
+ friendlyName: 'Claude Fable 5 (via Copilot)',
233
83
  contextWindow: 200000,
234
84
  maxOutputTokens: 32768,
235
85
  supportsStreaming: true,
236
86
  supportsImages: false,
237
- supportsTemperature: false,
238
87
  supportsWebSearch: false,
239
88
  timeout: 600000,
240
- description: 'Anthropic Claude Opus 4.6 via Copilot subscription',
241
- aliases: [],
89
+ description: 'Anthropic Claude Fable 5 via Copilot subscription',
90
+ aliases: ['fable'],
242
91
  },
243
- 'claude-opus-4.7': {
244
- modelName: 'claude-opus-4.7',
245
- friendlyName: 'Claude Opus 4.7 (via Copilot)',
92
+ 'claude-sonnet-5': {
93
+ modelName: 'claude-sonnet-5',
94
+ friendlyName: 'Claude Sonnet 5 (via Copilot)',
246
95
  contextWindow: 200000,
247
96
  maxOutputTokens: 32768,
248
97
  supportsStreaming: true,
249
98
  supportsImages: false,
250
- supportsTemperature: false,
251
99
  supportsWebSearch: false,
252
100
  timeout: 600000,
253
- description: 'Anthropic Claude Opus 4.7 via Copilot subscription',
254
- aliases: [],
101
+ description: 'Anthropic Claude Sonnet 5 via Copilot subscription',
102
+ aliases: ['sonnet'],
255
103
  },
256
104
  'claude-opus-4.8': {
257
105
  modelName: 'claude-opus-4.8',
@@ -260,7 +108,6 @@ const SUPPORTED_MODELS = {
260
108
  maxOutputTokens: 32768,
261
109
  supportsStreaming: true,
262
110
  supportsImages: false,
263
- supportsTemperature: false,
264
111
  supportsWebSearch: false,
265
112
  timeout: 600000,
266
113
  description: 'Anthropic Claude Opus 4.8 via Copilot subscription',
@@ -268,31 +115,30 @@ const SUPPORTED_MODELS = {
268
115
  },
269
116
 
270
117
  // Google models
271
- 'gemini-3-pro-preview': {
272
- modelName: 'gemini-3-pro-preview',
273
- friendlyName: 'Gemini 3 Pro Preview (via Copilot)',
118
+ // GA `gemini-3.1-pro` does not exist upstream — keep the -preview suffix.
119
+ 'gemini-3.1-pro-preview': {
120
+ modelName: 'gemini-3.1-pro-preview',
121
+ friendlyName: 'Gemini 3.1 Pro Preview (via Copilot)',
274
122
  contextWindow: 1048576,
275
123
  maxOutputTokens: 65536,
276
124
  supportsStreaming: true,
277
125
  supportsImages: false,
278
- supportsTemperature: false,
279
126
  supportsWebSearch: false,
280
127
  timeout: 600000,
281
- description: 'Google Gemini 3 Pro Preview via Copilot subscription',
282
- aliases: ['gemini-3-pro'],
128
+ description: 'Google Gemini 3.1 Pro Preview via Copilot subscription',
129
+ aliases: ['gemini', 'gemini-3.1-pro'],
283
130
  },
284
- 'gemini-3.1-pro-preview': {
285
- modelName: 'gemini-3.1-pro-preview',
286
- friendlyName: 'Gemini 3.1 Pro Preview (via Copilot)',
131
+ 'gemini-3.5-flash': {
132
+ modelName: 'gemini-3.5-flash',
133
+ friendlyName: 'Gemini 3.5 Flash (via Copilot)',
287
134
  contextWindow: 1048576,
288
135
  maxOutputTokens: 65536,
289
136
  supportsStreaming: true,
290
137
  supportsImages: false,
291
- supportsTemperature: false,
292
138
  supportsWebSearch: false,
293
139
  timeout: 600000,
294
- description: 'Google Gemini 3.1 Pro Preview via Copilot subscription',
295
- aliases: ['gemini', 'gemini-3.1-pro'],
140
+ description: 'Google Gemini 3.5 Flash via Copilot subscription',
141
+ aliases: ['gemini-flash'],
296
142
  },
297
143
  };
298
144
 
@@ -892,8 +738,6 @@ export const copilotProvider = {
892
738
  stream = false,
893
739
  signal,
894
740
  reasoning_effort,
895
- temperature,
896
- use_websearch,
897
741
  } = options;
898
742
 
899
743
  if (!config) {
@@ -903,16 +747,6 @@ export const copilotProvider = {
903
747
  );
904
748
  }
905
749
 
906
- if (temperature !== undefined) {
907
- debugLog(
908
- '[Copilot SDK] Parameter "temperature" not supported by Copilot SDK (ignored)',
909
- );
910
- }
911
- if (use_websearch) {
912
- debugLog(
913
- '[Copilot SDK] Parameter "use_websearch" not supported by Copilot SDK (ignored)',
914
- );
915
- }
916
750
  try {
917
751
  const cwd = config.server?.client_cwd || process.cwd();
918
752
  const client = await getCopilotClient(cwd, config);
@@ -8,61 +8,48 @@
8
8
  import { createOpenAICompatibleProvider } from './openai-compatible.js';
9
9
  import { debugLog } from '../utils/console.js';
10
10
 
11
- // Define supported DeepSeek models with their capabilities
11
+ // Define supported DeepSeek models with their capabilities.
12
+ // V4 unified the catalog: both tiers share a 1M context window and a 384K output
13
+ // ceiling, are text-only (no vision), and expose thinking mode via the
14
+ // top-level `thinking` + `reasoning_effort` request fields (see transformRequest).
15
+ // The legacy `deepseek-chat` / `deepseek-reasoner` IDs hard-retire 2026-07-24
16
+ // 15:59 UTC upstream; they are intentionally absent here but keep working as
17
+ // explicit pass-through IDs (resolveModelName returns unknown IDs unchanged)
18
+ // until that date.
12
19
  const SUPPORTED_MODELS = {
13
- 'deepseek-chat': {
14
- modelName: 'deepseek-chat',
15
- friendlyName: 'DeepSeek Chat (V3-0324)',
16
- contextWindow: 128000, // API supports 128K context
17
- maxOutputTokens: 8000, // Maximum 8K output tokens
18
- defaultMaxTokens: 4000, // Default 4K tokens
20
+ 'deepseek-v4-pro': {
21
+ modelName: 'deepseek-v4-pro',
22
+ friendlyName: 'DeepSeek V4 Pro',
23
+ contextWindow: 1000000, // 1M context (V4 default across all official services)
24
+ maxOutputTokens: 384000, // 384K max output ceiling
25
+ defaultMaxTokens: 8000, // Conservative default despite the high ceiling
19
26
  supportsStreaming: true,
20
- supportsImages: false,
21
- supportsTemperature: true,
27
+ supportsImages: false, // Text-only; V4 has no vision input
22
28
  supportsWebSearch: false,
29
+ supportsReasoning: true,
23
30
  supportsJsonOutput: true,
24
31
  supportsFunctionCalling: true,
25
- supportsChatPrefixCompletion: true, // Beta
26
- supportsFIMCompletion: true, // Beta
27
- timeout: 300000,
32
+ timeout: 600000, // Longer timeout for reasoning
28
33
  description:
29
- 'DeepSeek-V3-0324 - Strong MoE model with 671B total/37B active parameters',
30
- aliases: [
31
- 'deepseek',
32
- 'chat',
33
- 'deepseek chat',
34
- 'deepseek-v3',
35
- 'deepseek-chat-v3',
36
- 'deepseek v3',
37
- ],
34
+ 'DeepSeek V4 Pro - flagship MoE model with 1M context and thinking mode',
35
+ aliases: ['deepseek', 'deepseek-pro'],
38
36
  },
39
- 'deepseek-reasoner': {
40
- modelName: 'deepseek-reasoner',
41
- friendlyName: 'DeepSeek Reasoner (R1-0528)',
42
- contextWindow: 128000, // API supports 128K context
43
- maxOutputTokens: 64000, // Maximum 64K output tokens (including CoT)
44
- defaultMaxTokens: 32000, // Default 32K tokens
37
+ 'deepseek-v4-flash': {
38
+ modelName: 'deepseek-v4-flash',
39
+ friendlyName: 'DeepSeek V4 Flash',
40
+ contextWindow: 1000000, // 1M context
41
+ maxOutputTokens: 384000, // 384K max output ceiling
42
+ defaultMaxTokens: 8000, // Conservative default despite the high ceiling
45
43
  supportsStreaming: true,
46
- supportsImages: false,
47
- supportsTemperature: true,
44
+ supportsImages: false, // Text-only; V4 has no vision input
48
45
  supportsWebSearch: false,
46
+ supportsReasoning: true,
49
47
  supportsJsonOutput: true,
50
48
  supportsFunctionCalling: true,
51
- supportsChatPrefixCompletion: true, // Beta
52
- supportsFIMCompletion: false, // Not supported
53
- supportsReasoning: true,
54
49
  timeout: 600000, // Longer timeout for reasoning
55
50
  description:
56
- 'DeepSeek-R1-0528 - Advanced reasoning model with CoT capabilities',
57
- aliases: [
58
- 'deepseek reasoner',
59
- 'reasoner',
60
- 'r1',
61
- 'deepseek r1',
62
- 'deepseek-r1',
63
- 'deepseek-reasoner-r1',
64
- 'deepseek-r1-0528',
65
- ],
51
+ 'DeepSeek V4 Flash - faster, lower-cost V4 tier with 1M context and thinking mode',
52
+ aliases: ['deepseek-flash'],
66
53
  },
67
54
  };
68
55
 
@@ -79,20 +66,51 @@ function validateApiKey(apiKey) {
79
66
  }
80
67
 
81
68
  /**
82
- * Transform request to handle DeepSeek-specific requirements
69
+ * Map a Converse reasoning_effort level to DeepSeek's thinking-mode request
70
+ * fields. DeepSeek exposes only two independent controls: a `thinking` toggle
71
+ * ({type:"enabled"|"disabled"}) and a `reasoning_effort` field that accepts
72
+ * ONLY "high" or "max". Every enabled level below max maps to "high" (there is
73
+ * no lower documented tier), preserving enabled-reasoning intent so the default
74
+ * `medium` runs thinking-on rather than silently disabling it.
75
+ */
76
+ function applyReasoning(requestPayload, reasoningEffort) {
77
+ if (reasoningEffort === 'none') {
78
+ // Disable thinking entirely; omit reasoning_effort.
79
+ requestPayload.thinking = { type: 'disabled' };
80
+ return;
81
+ }
82
+
83
+ requestPayload.thinking = { type: 'enabled' };
84
+ requestPayload.reasoning_effort = reasoningEffort === 'max' ? 'max' : 'high';
85
+ }
86
+
87
+ /**
88
+ * Transform request to handle DeepSeek-specific requirements.
89
+ *
90
+ * Reads the requested reasoning effort from the shared base's widened context
91
+ * and builds the thinking-mode fields. Reasoning is capability-gated: the fields
92
+ * are attached only when the resolved model supports reasoning, so an
93
+ * unknown/retired pass-through ID never receives them.
83
94
  */
84
- async function transformRequest(requestPayload) {
85
- // DeepSeek uses standard OpenAI format, no transformation needed
95
+ async function transformRequest(requestPayload, context = {}) {
96
+ const { modelConfig, reasoningEffort } = context;
97
+
98
+ if (modelConfig?.supportsReasoning && reasoningEffort) {
99
+ applyReasoning(requestPayload, reasoningEffort);
100
+ }
101
+
86
102
  debugLog('[DeepSeek] Request payload prepared');
87
103
  return requestPayload;
88
104
  }
89
105
 
90
106
  /**
91
- * Transform response to handle DeepSeek-specific fields
107
+ * Transform response to handle DeepSeek-specific fields.
108
+ *
109
+ * `reasoning_content` (the thinking-mode sibling of `content`) is surfaced to
110
+ * metadata by the shared OpenAI-compatible base when supportsReasoning is set,
111
+ * so no provider-specific reasoning extraction is needed here.
92
112
  */
93
113
  async function transformResponse(result, rawResponse) {
94
- // DeepSeek returns standard OpenAI-compatible responses
95
- // Add any DeepSeek-specific metadata if needed
96
114
  if (rawResponse.system_fingerprint) {
97
115
  result.metadata.system_fingerprint = rawResponse.system_fingerprint;
98
116
  }
@@ -101,19 +119,21 @@ async function transformResponse(result, rawResponse) {
101
119
  }
102
120
 
103
121
  /**
104
- * Create DeepSeek provider using OpenAI-compatible base
122
+ * Create DeepSeek provider using OpenAI-compatible base.
123
+ *
124
+ * baseURL is the bare host (no `/v1`) matching the current official docs and all
125
+ * OpenAI-SDK code samples. `frequency_penalty`/`presence_penalty` are omitted
126
+ * from defaultParams: the API now marks them deprecated no-ops, and thinking
127
+ * mode ignores them (along with temperature/top_p) regardless.
105
128
  */
106
129
  export const deepseekProvider = createOpenAICompatibleProvider({
107
- baseURL: 'https://api.deepseek.com/v1',
130
+ baseURL: 'https://api.deepseek.com',
108
131
  providerName: 'DeepSeek',
109
132
  supportedModels: SUPPORTED_MODELS,
110
133
  validateApiKey,
111
134
  transformRequest,
112
135
  transformResponse,
113
136
  defaultParams: {
114
- // DeepSeek default parameters
115
137
  top_p: 0.95,
116
- frequency_penalty: 0,
117
- presence_penalty: 0,
118
138
  },
119
139
  });
@@ -62,7 +62,6 @@ const SUPPORTED_MODELS = {
62
62
  maxOutputTokens: 65536,
63
63
  supportsStreaming: true,
64
64
  supportsImages: false,
65
- supportsTemperature: false,
66
65
  supportsWebSearch: false,
67
66
  supportsThinking: true,
68
67
  timeout: DEFAULT_TIMEOUT_MS,
@@ -79,7 +78,6 @@ const SUPPORTED_MODELS = {
79
78
  maxOutputTokens: 65536,
80
79
  supportsStreaming: true,
81
80
  supportsImages: false,
82
- supportsTemperature: false,
83
81
  supportsWebSearch: false,
84
82
  supportsThinking: true,
85
83
  timeout: DEFAULT_TIMEOUT_MS,
@@ -95,7 +93,6 @@ const SUPPORTED_MODELS = {
95
93
  maxOutputTokens: 65536,
96
94
  supportsStreaming: true,
97
95
  supportsImages: false,
98
- supportsTemperature: false,
99
96
  supportsWebSearch: false,
100
97
  supportsThinking: true,
101
98
  timeout: DEFAULT_TIMEOUT_MS,
@@ -17,7 +17,6 @@ const SUPPORTED_MODELS = {
17
17
  maxOutputTokens: 65536,
18
18
  supportsStreaming: true,
19
19
  supportsImages: true,
20
- supportsTemperature: true,
21
20
  supportsThinking: true,
22
21
  supportsWebSearch: true,
23
22
  maxThinkingTokens: 24576,
@@ -43,7 +42,6 @@ const SUPPORTED_MODELS = {
43
42
  maxOutputTokens: 65536,
44
43
  supportsStreaming: true,
45
44
  supportsImages: true,
46
- supportsTemperature: true,
47
45
  supportsThinking: true,
48
46
  supportsWebSearch: true,
49
47
  maxThinkingTokens: 24576,
@@ -68,7 +66,6 @@ const SUPPORTED_MODELS = {
68
66
  supportsStreaming: true,
69
67
  supportsWebSearch: true,
70
68
  supportsImages: true,
71
- supportsTemperature: true,
72
69
  supportsThinking: true,
73
70
  maxThinkingTokens: 32768,
74
71
  timeout: 300000,
@@ -83,7 +80,6 @@ const SUPPORTED_MODELS = {
83
80
  maxOutputTokens: 64000,
84
81
  supportsStreaming: true,
85
82
  supportsImages: true,
86
- supportsTemperature: true,
87
83
  supportsThinking: true,
88
84
  supportsWebSearch: true,
89
85
  thinkingMode: 'level',
@@ -113,7 +109,6 @@ const SUPPORTED_MODELS = {
113
109
  maxOutputTokens: 65536,
114
110
  supportsStreaming: true,
115
111
  supportsImages: true,
116
- supportsTemperature: true,
117
112
  supportsThinking: true,
118
113
  supportsWebSearch: true,
119
114
  thinkingMode: 'level',
@@ -417,11 +412,9 @@ export const googleProvider = {
417
412
  async invoke(messages, options = {}) {
418
413
  const {
419
414
  model = 'gemini-2.5-flash',
420
- temperature = 0.7,
421
415
  maxTokens = null,
422
416
  stream = false,
423
417
  reasoning_effort = 'medium',
424
- use_websearch = false,
425
418
  media_resolution = null,
426
419
  signal,
427
420
  config,
@@ -497,14 +490,6 @@ export const googleProvider = {
497
490
  // Build generation config
498
491
  const generationConfig = {};
499
492
 
500
- // Add temperature if model supports it
501
- if (
502
- modelConfig.supportsTemperature !== false &&
503
- temperature !== undefined
504
- ) {
505
- generationConfig.temperature = Math.max(0, Math.min(2, temperature));
506
- }
507
-
508
493
  // Add max tokens if specified
509
494
  if (maxTokens) {
510
495
  generationConfig.maxOutputTokens = Math.min(
@@ -579,8 +564,9 @@ export const googleProvider = {
579
564
  }
580
565
  }
581
566
 
582
- // Add web search grounding if requested and model supports it
583
- if (use_websearch && modelConfig.supportsWebSearch) {
567
+ // Attach web search grounding where the model supports it; the model
568
+ // decides per-request whether to actually search.
569
+ if (modelConfig.supportsWebSearch) {
584
570
  generationConfig.tools = [{ googleSearch: {} }];
585
571
  }
586
572
 
@@ -599,7 +585,6 @@ export const googleProvider = {
599
585
  generationConfig,
600
586
  modelConfig,
601
587
  reasoning_effort,
602
- use_websearch,
603
588
  signal,
604
589
  );
605
590
  }
@@ -607,7 +592,7 @@ export const googleProvider = {
607
592
 
608
593
  try {
609
594
  debugLog(
610
- `[Google] Calling ${resolvedModel} with ${messages.length} messages${use_websearch && modelConfig.supportsWebSearch ? ' (with grounding)' : ''}`,
595
+ `[Google] Calling ${resolvedModel} with ${messages.length} messages${modelConfig.supportsWebSearch ? ' (with grounding)' : ''}`,
611
596
  );
612
597
 
613
598
  // Check if already aborted before making request
@@ -666,7 +651,7 @@ export const googleProvider = {
666
651
  ? reasoning_effort
667
652
  : null,
668
653
  provider: 'google',
669
- web_search_used: use_websearch && modelConfig.supportsWebSearch,
654
+ web_search_used: !!modelConfig.supportsWebSearch,
670
655
  grounding_metadata: response.groundingMetadata || null,
671
656
  },
672
657
  };
@@ -735,7 +720,6 @@ export const googleProvider = {
735
720
  * @param {Object} generationConfig - Generation configuration
736
721
  * @param {Object} modelConfig - Model configuration
737
722
  * @param {string} reasoning_effort - Reasoning effort level
738
- * @param {boolean} use_websearch - Whether web search is enabled
739
723
  * @returns {AsyncGenerator} - Streaming generator yielding chunks
740
724
  */
741
725
  async *_createStreamingGenerator(
@@ -745,11 +729,10 @@ export const googleProvider = {
745
729
  generationConfig,
746
730
  modelConfig,
747
731
  reasoning_effort,
748
- use_websearch,
749
732
  signal,
750
733
  ) {
751
734
  debugLog(
752
- `[Google] Starting streaming for ${resolvedModel} with ${geminiContents.length} messages${use_websearch && modelConfig.supportsWebSearch ? ' (with grounding)' : ''}`,
735
+ `[Google] Starting streaming for ${resolvedModel} with ${geminiContents.length} messages${modelConfig.supportsWebSearch ? ' (with grounding)' : ''}`,
753
736
  );
754
737
 
755
738
  const startTime = Date.now();
@@ -771,7 +754,7 @@ export const googleProvider = {
771
754
  model: resolvedModel,
772
755
  provider: 'google',
773
756
  thinking_mode: modelConfig.supportsThinking && reasoning_effort,
774
- web_search: use_websearch && modelConfig.supportsWebSearch,
757
+ web_search: !!modelConfig.supportsWebSearch,
775
758
  };
776
759
 
777
760
  // Create streaming request with retry logic and abort signal support
@@ -838,8 +821,8 @@ export const googleProvider = {
838
821
  total_tokens: finalResponse.usageMetadata?.totalTokenCount || 0,
839
822
  };
840
823
 
841
- // Extract grounding metadata if web search was used
842
- if (use_websearch && modelConfig.supportsWebSearch) {
824
+ // Extract grounding metadata if the model supports web search
825
+ if (modelConfig.supportsWebSearch) {
843
826
  groundingMetadata = finalResponse.groundingMetadata || null;
844
827
  }
845
828
 
@@ -875,7 +858,7 @@ export const googleProvider = {
875
858
  ? reasoning_effort
876
859
  : null,
877
860
  provider: 'google',
878
- web_search_used: use_websearch && modelConfig.supportsWebSearch,
861
+ web_search_used: !!modelConfig.supportsWebSearch,
879
862
  grounding_metadata: groundingMetadata,
880
863
  thinking_mode_enabled: !!(
881
864
  modelConfig.supportsThinking && reasoning_effort