converse-mcp-server 4.2.0 → 4.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
@@ -274,7 +274,8 @@ SUMMARIZATION_MODEL=gpt-5-nano # Default: gpt-5-nano
274
274
  - **claude-opus-5** (alias: `opus-5`): Previous Opus generation (1M context, 128K output)
275
275
  - **claude-opus-4-8** / **claude-opus-4-7** / **claude-opus-4-6**: Earlier Opus generations with adaptive thinking (200K context, 1M via beta, 128K output)
276
276
  - **claude-opus-4-5** / **claude-opus-4-1**: Legacy Opus models with extended thinking (64K / 32K output)
277
- - **claude-sonnet-4-6** (alias: `sonnet`): Best combination of speed and intelligence with adaptive thinking (64K output)
277
+ - **claude-sonnet-5-5** (aliases: `sonnet`, `sonnet-5.5`): Current Sonnet with adaptive thinking and effort (1M context, 128K output)
278
+ - **claude-sonnet-4-6** (alias: `sonnet-4.6`): Previous Sonnet generation with adaptive thinking (64K output)
278
279
  - **claude-haiku-4-5** (alias: `haiku`): Fast and intelligent for simple queries (64K output)
279
280
 
280
281
  ### Mistral Models
@@ -321,6 +322,7 @@ Claude via the Claude Agent SDK. `claude` uses its default model (Opus 5.5, or `
321
322
 
322
323
  - **claude-opus-5-5** (default; aliases: `opus`, `claude-opus`, `opus-5.5`), **claude-opus-5** (`opus-5`)
323
324
  - **claude-fable-5-1** (aliases: `fable`, `claude-fable`, `fable-5.1`), **claude-fable-5** (`fable-5`)
325
+ - **claude-sonnet-5-5** (aliases: `sonnet`, `claude-sonnet`, `sonnet-5.5`)
324
326
  - Uses Claude Code CLI authentication (`claude login`) - no API key needed
325
327
  - Direct filesystem access from working directory
326
328
 
@@ -329,7 +331,7 @@ Claude via the Claude Agent SDK. `claude` uses its default model (Opus 5.5, or `
329
331
  Reach these only with the `copilot:` namespace (e.g. `copilot:gpt-6-sol`) — Copilot never serves bare model names. `copilot` alone uses GPT-6 Sol, or `COPILOT_DEFAULT_MODEL`. Uses your GitHub Copilot subscription (`gh auth login`) - no API key needed:
330
332
 
331
333
  - **OpenAI**: `gpt-6-sol` (aliases: `gpt-6`, `gpt-5`, `sol`), `gpt-6-luna` (alias: `luna`), `gpt-5.6-sol` (alias: `gpt-5.6`), `gpt-5.6-terra`, `gpt-5.6-luna` (all support `reasoning_effort`)
332
- - **Anthropic**: `claude-opus-5.5` (aliases: `opus`, `claude`), `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-5`, `claude-opus-4.8`
334
+ - **Anthropic**: `claude-opus-5.5` (aliases: `opus`, `claude`), `claude-fable-5` (alias: `fable`), `claude-sonnet-5.5` (alias: `sonnet`), `claude-sonnet-5`, `claude-opus-5`, `claude-opus-4.8`
333
335
  - **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`)
334
336
 
335
337
  ## 📚 Help & Documentation
@@ -469,7 +471,7 @@ Every entry in `models` takes one of four forms:
469
471
  "openai:gpt-6-astra"; // -> OpenAI API, even when Codex is available
470
472
  "gemini:pro"; // -> Antigravity CLI (Gemini 3.1 Pro)
471
473
  "google:gemini-3.1-pro-preview"; // -> Google API
472
- "copilot:sonnet"; // -> GitHub Copilot (Claude Sonnet 5)
474
+ "copilot:sonnet"; // -> GitHub Copilot (Claude Sonnet 5.5)
473
475
  "openrouter:z-ai/glm-5.2:online"; // -> OpenRouter with web search opt-in
474
476
 
475
477
  // A bare model ID or alias — the first configured provider that offers it
package/docs/API.md CHANGED
@@ -524,10 +524,11 @@ Provide models as plain name strings in the `models` array. Each entry is `auto`
524
524
  | `claude-opus-5` | `opus-5` | 1M | 128K | Previous Opus, adaptive thinking + effort, compaction |
525
525
  | `claude-opus-4-8`, `claude-opus-4-7`, `claude-opus-4-6` | `opus-4.8`, `opus-4.7`, `opus-4.6` | 200K (1M beta) | 128K | Previous Opus generations |
526
526
  | `claude-opus-4-5-20251101`, `claude-opus-4-1-20250805` | `opus-4.5`, `opus-4.1` | 200K | 64K / 32K | Earlier Opus tiers |
527
- | `claude-sonnet-4-6` | `sonnet`, `sonnet-4.6` | 200K (1M beta) | 64K | Best speed/intelligence balance, adaptive thinking |
527
+ | `claude-sonnet-5-5` | `sonnet`, `sonnet-5.5`, `claude-sonnet` | 1M | 128K | Current Sonnet, adaptive thinking + effort, compaction |
528
+ | `claude-sonnet-4-6` | `sonnet-4.6` | 200K (1M beta) | 64K | Previous Sonnet, adaptive thinking |
528
529
  | `claude-haiku-4-5-20251001` | `haiku`, `haiku-4.5` | 200K | 64K | Fast and intelligent |
529
530
 
530
- Models with adaptive thinking control depth via `reasoning_effort`, which is passed by name to Anthropic's `effort` parameter and clamped to what each model accepts: Opus 5.5, Fable 5, Opus 5, Opus 4.8, and Opus 4.7 take `low`–`max`; Opus 4.6 and Sonnet 4.6 lack `xhigh` (it becomes `max`); Opus 4.5 tops out at `high`. `none` and `minimal` become `low` everywhere. System prompts are automatically cached for 1 hour; cache stats appear in response metadata as `cache_creation_input_tokens` / `cache_read_input_tokens`.
531
+ Models with adaptive thinking control depth via `reasoning_effort`, which is passed by name to Anthropic's `effort` parameter and clamped to what each model accepts: Opus 5.5, Sonnet 5.5, Fable 5, Opus 5, Opus 4.8, and Opus 4.7 take `low`–`max`; Opus 4.6 and Sonnet 4.6 lack `xhigh` (it becomes `max`); Opus 4.5 tops out at `high`. `none` and `minimal` become `low` everywhere. System prompts are automatically cached for 1 hour; cache stats appear in response metadata as `cache_creation_input_tokens` / `cache_read_input_tokens`.
531
532
 
532
533
  ### Mistral Models
533
534
 
@@ -580,7 +581,7 @@ Any other model works via its full `provider/model` slug (e.g. `anthropic/claude
580
581
  **Claude** is available through the Claude Agent SDK, using Claude Code CLI authentication instead of an API key:
581
582
 
582
583
  - **Model**: `claude` (namespaces: `claude`, `claude-code`, `claude-sdk`) — defaults to Claude Opus 5.5 (`claude-opus-5-5`), or `CLAUDE_DEFAULT_MODEL`
583
- - **Model selection**: `claude-opus-5-5` (`opus`, `claude-opus`, `opus-5.5`), `claude-opus-5` (`opus-5`), `claude-fable-5-1` (`fable`, `claude-fable`, `fable-5.1`), `claude-fable-5` (`fable-5`), e.g. `claude:opus`, `claude:fable`. Other names are rejected with suggestions.
584
+ - **Model selection**: `claude-opus-5-5` (`opus`, `claude-opus`, `opus-5.5`), `claude-opus-5` (`opus-5`), `claude-fable-5-1` (`fable`, `claude-fable`, `fable-5.1`), `claude-fable-5` (`fable-5`), `claude-sonnet-5-5` (`sonnet`, `claude-sonnet`, `sonnet-5.5`), e.g. `claude:opus`, `claude:fable`, `claude:sonnet`. Other names are rejected with suggestions.
584
585
  - **Authentication**: `claude login` — no `ANTHROPIC_API_KEY` needed
585
586
  - **Availability**: the Claude Agent SDK is installed and `~/.claude/.credentials.json` exists (`$CLAUDE_CONFIG_DIR` when set), or `CLAUDE_CODE_OAUTH_TOKEN`/`ANTHROPIC_API_KEY` is in the environment; on macOS the Keychain login is assumed. An expired login is caught at call time and bare-name/`auto` routing fails over.
586
587
  - **Permissions**: runs with `bypassPermissions`
@@ -621,7 +622,7 @@ agy
621
622
  Reach these only with the `copilot:` namespace (also `github-copilot:`, `copilot-sdk:`; e.g. `copilot:gpt-6-sol`) — Copilot never serves bare model names. `copilot` alone uses GPT-6 Sol, or `COPILOT_DEFAULT_MODEL`. Available when the Copilot SDK is installed; uses your GitHub Copilot subscription (`gh auth login`) — no API key needed:
622
623
 
623
624
  - **OpenAI**: `gpt-6-sol` (aliases: `gpt-6`, `gpt-5`, `sol`), `gpt-6-luna` (alias: `luna`), `gpt-5.6-sol` (alias: `gpt-5.6`), `gpt-5.6-terra`, `gpt-5.6-luna` (all accept `reasoning_effort`)
624
- - **Anthropic**: `claude-opus-5.5` (aliases: `opus`, `claude`), `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-5`, `claude-opus-4.8`
625
+ - **Anthropic**: `claude-opus-5.5` (aliases: `opus`, `claude`), `claude-fable-5` (alias: `fable`), `claude-sonnet-5.5` (alias: `sonnet`), `claude-sonnet-5`, `claude-opus-5`, `claude-opus-4.8`
625
626
  - **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`)
626
627
  - Any other `copilot:<id>` is rejected with suggestions
627
628
 
package/docs/PROVIDERS.md CHANGED
@@ -53,7 +53,8 @@ This guide documents all supported AI providers in the Converse MCP Server and t
53
53
  - `claude-opus-5` (alias `opus-5`) - Previous Opus generation (1M context, 128K output)
54
54
  - `claude-opus-4-8`, `claude-opus-4-7`, `claude-opus-4-6` - Earlier Opus generations with adaptive thinking (128K output)
55
55
  - `claude-opus-4-5-20251101`, `claude-opus-4-1-20250805` - Legacy Opus models (64K / 32K output)
56
- - `claude-sonnet-4-6` (alias `sonnet`) - Best combination of speed and intelligence with adaptive thinking (64K output)
56
+ - `claude-sonnet-5-5` (aliases `sonnet`, `sonnet-5.5`, `claude-sonnet`) - Current Sonnet: speed and capability for everyday coding and agentic work; adaptive thinking, effort `low`–`max` (1M context, 128K output)
57
+ - `claude-sonnet-4-6` (alias `sonnet-4.6`) - Previous Sonnet generation with adaptive thinking (64K output)
57
58
  - `claude-sonnet-4-5-20250929` - Legacy Sonnet (64K output)
58
59
  - `claude-haiku-4-5-20251001` (alias `haiku`) - Fast and intelligent with extended thinking (64K output)
59
60
 
@@ -215,7 +216,8 @@ agy
215
216
  - `claude-opus-5` (alias: `opus-5`) - Claude Opus 5
216
217
  - `claude-fable-5-1` (aliases: `fable`, `claude-fable`, `fable-5.1`) - Claude Fable 5.1 (`claude:fable`)
217
218
  - `claude-fable-5` (alias: `fable-5`) - Claude Fable 5.0
218
- - Names outside this catalog are rejected with suggestions (e.g. `claude:sonnet` suggests `copilot:sonnet` and `anthropic:sonnet`)
219
+ - `claude-sonnet-5-5` (aliases: `sonnet`, `claude-sonnet`, `sonnet-5.5`) - Claude Sonnet 5.5 (`claude:sonnet`)
220
+ - Names outside this catalog are rejected with suggestions (e.g. `claude:haiku` suggests `anthropic:haiku`)
219
221
 
220
222
  **Key Features:**
221
223
  - **Subscription Access**: Uses your Claude subscription instead of API credits
@@ -228,7 +230,7 @@ agy
228
230
  **Differences from Anthropic API Provider:**
229
231
  - **Authentication**: Claude Code login vs `ANTHROPIC_API_KEY`
230
232
  - **Billing**: Claude subscription vs pay-per-use API
231
- - **Model Routing**: `claude` and `claude:<model>` → SDK provider; `anthropic:<model>` → API provider; bare names both serve as the same model (`opus`, `claude-opus-5-5`, `claude-opus-5`, `claude-fable-5`) → SDK first, then the API on authentication/availability failure; bare names only the API serves (e.g., `sonnet`, `haiku`) → API provider. Bare `fable` is Fable 5.1 on the SDK but Fable 5 on the API, so it does not fail over between them.
233
+ - **Model Routing**: `claude` and `claude:<model>` → SDK provider; `anthropic:<model>` → API provider; bare names both serve as the same model (`opus`, `sonnet`, `claude-opus-5-5`, `claude-opus-5`, `claude-sonnet-5-5`, `claude-fable-5`) → SDK first, then the API on authentication/availability failure; bare names only the API serves (e.g., `haiku`, `sonnet-4.6`) → API provider. Bare `fable` is Fable 5.1 on the SDK but Fable 5 on the API, so it does not fail over between them.
232
234
  - **Permissions**: The SDK runs with `bypassPermissions`, and bare names and `auto` reach it whenever it is available. Use `anthropic:<model>` to keep a request on the plain API.
233
235
 
234
236
  ### GitHub Copilot SDK
@@ -240,7 +242,7 @@ agy
240
242
  - **Supported Models** (namespace-only: reach them with `copilot:`, `github-copilot:` or `copilot-sdk:`, e.g. `copilot:gpt-6-sol`; Copilot never serves bare model names):
241
243
  - `copilot` - GPT-6 Sol, or `COPILOT_DEFAULT_MODEL`
242
244
  - OpenAI: `gpt-6-sol` (aliases: `gpt-6`, `gpt-5`, `sol`), `gpt-6-luna` (alias: `luna`), `gpt-5.6-sol` (alias: `gpt-5.6`), `gpt-5.6-terra`, `gpt-5.6-luna`
243
- - Anthropic: `claude-opus-5.5` (aliases: `opus`, `claude`; Copilot Pro+/Max/Business/Enterprise), `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-5`, `claude-opus-4.8`
245
+ - Anthropic: `claude-opus-5.5` (aliases: `opus`, `claude`; Copilot Pro+/Max/Business/Enterprise), `claude-fable-5` (alias: `fable`), `claude-sonnet-5.5` (alias: `sonnet`), `claude-sonnet-5`, `claude-opus-5`, `claude-opus-4.8`
244
246
  - 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`)
245
247
  - **Reasoning**: The GPT-6 and GPT-5.6 tiers accept `reasoning_effort` (clamped onto Copilot's `low`–`xhigh`).
246
248
  - **Unknown IDs**: Any other `copilot:<id>` is rejected with suggestions; only the IDs and aliases above are accepted.
@@ -333,7 +335,7 @@ All providers support streaming responses for real-time output.
333
335
  - **Google**:
334
336
  - Gemini 3.0 Pro: Thinking levels (low/high) via `reasoning_effort` - always enabled
335
337
  - Gemini 2.5 Pro/Flash: Thinking budget (token-based) via `reasoning_effort`
336
- - **Anthropic**: Claude Fable 5, Opus 4.6+, and Sonnet 4.6 use adaptive thinking (depth controlled by `reasoning_effort` via Anthropic's `effort` parameter); older Claude 4 models use budget-based extended thinking
338
+ - **Anthropic**: Claude Fable 5, Opus 4.6+, and Sonnet 4.6+ use adaptive thinking (depth controlled by `reasoning_effort` via Anthropic's `effort` parameter); older Claude 4 models use budget-based extended thinking
337
339
  - **X.AI**: Grok 4.5 maps `reasoning_effort` to `low`/`medium`/`high` and always reasons (cannot be disabled)
338
340
  - **Mistral**: `mistral-medium-3-5` and `mistral-small-2603` map `reasoning_effort` to `high` (enabled) or `none` (disabled); `mistral-large-2512` has no adjustable reasoning
339
341
  - **DeepSeek**: V4 models use thinking mode via `reasoning_effort` (`none` disables; enabled levels use `high`, `max` uses `max`)
@@ -384,7 +386,7 @@ Examples:
384
386
  "fable" // Claude Agent SDK (claude-fable-5-1) when set up, otherwise Anthropic API (claude-fable-5)
385
387
  "opus" // Claude Agent SDK (claude-opus-5-5), else Anthropic API
386
388
  "anthropic:opus" // Anthropic API only
387
- "sonnet" // Anthropic API (claude-sonnet-4-6)
389
+ "sonnet" // Claude Agent SDK (claude-sonnet-5-5), else Anthropic API
388
390
  "claude" // Claude Agent SDK (defaults to Claude Opus 5.5)
389
391
  "claude:fable" // Claude Agent SDK (Claude Fable 5.1)
390
392
  "pro" // Antigravity CLI (gemini-3.1-pro-preview), else Google API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "converse-mcp-server",
3
- "version": "4.2.0",
3
+ "version": "4.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.280",
97
- "@anthropic-ai/sdk": "^0.128.0",
96
+ "@anthropic-ai/claude-agent-sdk": "^0.3.284",
97
+ "@anthropic-ai/sdk": "^0.129.0",
98
98
  "@github/copilot-sdk": "^1.0.14",
99
99
  "@google/genai": "^2.24.0",
100
100
  "@lydell/node-pty": "1.2.0-beta.15",
101
101
  "@mistralai/mistralai": "^2.7.0",
102
- "@modelcontextprotocol/sdk": "^1.30.0",
103
- "@openai/codex-sdk": "^0.156.1",
102
+ "@modelcontextprotocol/sdk": "^1.31.0",
103
+ "@openai/codex-sdk": "^0.158.0",
104
104
  "cors": "^2.8.6",
105
- "dotenv": "^18.0.3",
105
+ "dotenv": "^18.0.4",
106
106
  "express": "^5.2.1",
107
107
  "lru-cache": "^11.5.3",
108
108
  "nanoid": "^6.0.1",
109
109
  "openai": "^7.23.0",
110
110
  "p-limit": "^7.3.3",
111
- "vite": "^8.3.0"
111
+ "vite": "^8.3.1"
112
112
  },
113
113
  "devDependencies": {
114
- "@vitest/coverage-v8": "^5.0.1",
114
+ "@vitest/coverage-v8": "^5.0.2",
115
115
  "cross-env": "^10.1.0",
116
116
  "eslint": "^10.11.0",
117
117
  "rimraf": "^6.1.3",
118
- "vitest": "^5.0.1"
118
+ "vitest": "^5.0.2"
119
119
  }
120
120
  }
@@ -37,6 +37,7 @@ const SUPPORTED_MODELS = {
37
37
  effortTiers: EFFORT_TIERS_FULL,
38
38
  // Absent from Anthropic's compaction compatibility list, unlike Opus 5
39
39
  supportsCompaction: false,
40
+ supportsDefaultFallback: true,
40
41
  description:
41
42
  'Claude Opus 5.5 - Flagship Opus for complex agentic coding and deep reasoning; matches Fable 5.1 on most work at Opus pricing',
42
43
  aliases: [
@@ -93,6 +94,7 @@ const SUPPORTED_MODELS = {
93
94
  effortGA: true,
94
95
  effortTiers: EFFORT_TIERS_FULL,
95
96
  supportsCompaction: true,
97
+ supportsDefaultFallback: true,
96
98
  description:
97
99
  'Claude Opus 5 - Previous Opus generation for complex agentic coding and deep reasoning',
98
100
  aliases: [
@@ -103,6 +105,37 @@ const SUPPORTED_MODELS = {
103
105
  'claude-opus-5.0',
104
106
  ],
105
107
  },
108
+ 'claude-sonnet-5-5': {
109
+ modelName: 'claude-sonnet-5-5',
110
+ friendlyName: 'Claude Sonnet 5.5',
111
+ contextWindow: 1000000, // 1M context by default - no beta header required
112
+ maxOutputTokens: 128000,
113
+ supportsStreaming: true,
114
+ supportsImages: true,
115
+ supportsWebSearch: false,
116
+ supportsThinking: true,
117
+ supportsAdaptiveThinking: true, // {type: "disabled"} is rejected; adaptive is the only on-mode
118
+ timeout: 1800000,
119
+ supportsEffort: true,
120
+ effortGA: true,
121
+ effortTiers: EFFORT_TIERS_FULL,
122
+ supportsCompaction: true,
123
+ supportsDefaultFallback: true,
124
+ description:
125
+ 'Claude Sonnet 5.5 - Current Sonnet: speed and capability for everyday coding and agentic work',
126
+ aliases: [
127
+ 'claude-sonnet-5-5',
128
+ 'claude-sonnet-5.5',
129
+ 'claude-5.5-sonnet',
130
+ 'claude-5-5-sonnet',
131
+ 'sonnet-5.5',
132
+ 'sonnet-5-5',
133
+ 'sonnet5.5',
134
+ 'sonnet5-5',
135
+ 'sonnet',
136
+ 'claude-sonnet',
137
+ ],
138
+ },
106
139
  'claude-opus-4-8': {
107
140
  modelName: 'claude-opus-4-8',
108
141
  friendlyName: 'Claude Opus 4.8',
@@ -270,7 +303,7 @@ const SUPPORTED_MODELS = {
270
303
  supports1MContext: true, // Beta 1M context support
271
304
  supportsCompaction: true, // Beta server-side context compaction
272
305
  description:
273
- 'Claude Sonnet 4.6 - Best combination of speed and intelligence with adaptive thinking',
306
+ 'Claude Sonnet 4.6 - Previous Sonnet generation with adaptive thinking',
274
307
  aliases: [
275
308
  'claude-sonnet-4-6',
276
309
  'claude-4.6-sonnet',
@@ -280,8 +313,6 @@ const SUPPORTED_MODELS = {
280
313
  'sonnet4.6',
281
314
  'sonnet4-6',
282
315
  'claude-sonnet-4.6',
283
- 'sonnet',
284
- 'claude-sonnet',
285
316
  ],
286
317
  },
287
318
  'claude-sonnet-4-5-20250929': {
@@ -369,6 +400,24 @@ class AnthropicProviderError extends ProviderError {
369
400
  }
370
401
  }
371
402
 
403
+ /**
404
+ * A refusal arrives as a successful response whose text is empty or cut off
405
+ * mid-answer, so it must not be passed on as a (partial) answer. The category
406
+ * tells the caller whether rephrasing or another model is the way forward.
407
+ */
408
+ function refusalError(stopDetails) {
409
+ const category = stopDetails?.category
410
+ ? ` (category: ${stopDetails.category})`
411
+ : '';
412
+ const explanation = stopDetails?.explanation
413
+ ? `: ${stopDetails.explanation}`
414
+ : '';
415
+ return new AnthropicProviderError(
416
+ `Anthropic declined the request${category}${explanation}`,
417
+ ErrorCodes.REFUSED,
418
+ );
419
+ }
420
+
372
421
  /**
373
422
  * Resolve model name to canonical form, including aliases
374
423
  */
@@ -661,6 +710,13 @@ export const anthropicProvider = {
661
710
  );
662
711
  }
663
712
 
713
+ // A safety-classifier decline is retried server-side on the model Anthropic
714
+ // recommends for that refusal category; only a decline by the whole chain
715
+ // comes back as a refusal.
716
+ if (modelConfig.supportsDefaultFallback) {
717
+ betas.push('server-side-fallback-2026-07-01');
718
+ }
719
+
664
720
  // Add effort beta feature for models that need it (not GA yet)
665
721
  if (modelConfig.supportsEffort && reasoning_effort && !modelConfig.effortGA) {
666
722
  betas.push('effort-2025-11-24');
@@ -690,6 +746,10 @@ export const anthropicProvider = {
690
746
  requestPayload.system = systemPrompt;
691
747
  }
692
748
 
749
+ if (modelConfig.supportsDefaultFallback) {
750
+ requestPayload.fallbacks = 'default';
751
+ }
752
+
693
753
  // Set max tokens - API requires this field
694
754
  if (maxTokens) {
695
755
  requestPayload.max_tokens = Math.min(
@@ -823,6 +883,10 @@ export const anthropicProvider = {
823
883
  const responseTime = Date.now() - startTime;
824
884
  debugLog(`[Anthropic] Response received in ${responseTime}ms`);
825
885
 
886
+ if (response.stop_reason === 'refusal') {
887
+ throw refusalError(response.stop_details);
888
+ }
889
+
826
890
  // Extract response content
827
891
  let content = '';
828
892
 
@@ -965,6 +1029,7 @@ export const anthropicProvider = {
965
1029
  let thinkingContent = '';
966
1030
  let lastUsage = null;
967
1031
  let finishReason = null;
1032
+ let stopDetails = null;
968
1033
 
969
1034
  try {
970
1035
  // Yield start event
@@ -1040,6 +1105,7 @@ export const anthropicProvider = {
1040
1105
  // Message-level updates (usage, stop_reason)
1041
1106
  if (event.delta?.stop_reason) {
1042
1107
  finishReason = event.delta.stop_reason;
1108
+ stopDetails = event.delta.stop_details ?? null;
1043
1109
  }
1044
1110
  if (event.usage) {
1045
1111
  lastUsage = event.usage;
@@ -1083,6 +1149,10 @@ export const anthropicProvider = {
1083
1149
  }
1084
1150
  }
1085
1151
 
1152
+ if (finishReason === 'refusal') {
1153
+ throw refusalError(stopDetails);
1154
+ }
1155
+
1086
1156
  const responseTime = Date.now() - startTime;
1087
1157
  debugLog(`[Anthropic] Streaming completed in ${responseTime}ms`);
1088
1158
 
@@ -93,6 +93,25 @@ const SUPPORTED_MODELS = {
93
93
  'Claude Fable 5 via Agent SDK - requires claude login authentication',
94
94
  aliases: ['fable-5', 'fable5'],
95
95
  },
96
+ 'claude-sonnet-5-5': {
97
+ modelName: 'claude-sonnet-5-5',
98
+ friendlyName: 'Claude Sonnet 5.5 (via Agent SDK)',
99
+ contextWindow: 1000000,
100
+ maxOutputTokens: 128000,
101
+ supportsStreaming: true,
102
+ supportsImages: true,
103
+ supportsWebSearch: false,
104
+ timeout: 1800000,
105
+ description:
106
+ 'Claude Sonnet 5.5 via Agent SDK - requires claude login authentication',
107
+ aliases: [
108
+ 'sonnet',
109
+ 'claude-sonnet',
110
+ 'claude-sonnet-5.5',
111
+ 'sonnet-5-5',
112
+ 'sonnet-5.5',
113
+ ],
114
+ },
96
115
  };
97
116
 
98
117
  /**
@@ -123,6 +123,18 @@ const SUPPORTED_MODELS = {
123
123
  description: 'Anthropic Claude Fable 5 via Copilot subscription',
124
124
  aliases: ['fable'],
125
125
  },
126
+ 'claude-sonnet-5.5': {
127
+ modelName: 'claude-sonnet-5.5',
128
+ friendlyName: 'Claude Sonnet 5.5 (via Copilot)',
129
+ contextWindow: 200000,
130
+ maxOutputTokens: 32768,
131
+ supportsStreaming: true,
132
+ supportsImages: false,
133
+ supportsWebSearch: false,
134
+ timeout: 1800000,
135
+ description: 'Anthropic Claude Sonnet 5.5 via Copilot subscription',
136
+ aliases: ['sonnet', 'claude-sonnet-5-5'],
137
+ },
126
138
  'claude-sonnet-5': {
127
139
  modelName: 'claude-sonnet-5',
128
140
  friendlyName: 'Claude Sonnet 5 (via Copilot)',
@@ -133,7 +145,7 @@ const SUPPORTED_MODELS = {
133
145
  supportsWebSearch: false,
134
146
  timeout: 1800000,
135
147
  description: 'Anthropic Claude Sonnet 5 via Copilot subscription',
136
- aliases: ['sonnet'],
148
+ aliases: [],
137
149
  },
138
150
  'claude-opus-5': {
139
151
  modelName: 'claude-opus-5',
@@ -168,6 +168,7 @@ export const ErrorCodes = {
168
168
  // Response errors
169
169
  NO_RESPONSE_CONTENT: 'NO_RESPONSE_CONTENT',
170
170
  NO_RESPONSE_CHOICE: 'NO_RESPONSE_CHOICE',
171
+ REFUSED: 'REFUSED',
171
172
 
172
173
  // Rate limiting and quota
173
174
  RATE_LIMIT_EXCEEDED: 'RATE_LIMIT_EXCEEDED',