Commit 5d0d6e7
feat: add Claude Opus 4.8 support across Anthropic, Bedrock, and Vertex providers (#386)
* feat(bedrock): add anthropic.claude-opus-4-7 to native model registry
Adds Claude Opus 4.7 to the Bedrock native model registry with:
- Full ModelInfo (maxTokens, contextWindow, pricing, cache config)
- supportsReasoningBudget: true (enables thinking budget in UI)
- cachableFields for multi-point prompt caching
- 1M context tier pricing
- Global Inference support
Without this entry, custom model usage falls back to guessModelInfoFromId()
which lacks supportsReasoningBudget and cachableFields, causing "too many
tokens" errors during parallel file injection (no cache = tokens accumulate).
Note: Pricing estimated based on claude-opus-4-6-v1. To be verified against
Bedrock console pricing page before merge.
* feat(bedrock): support Claude 4.7+ adaptive thinking and remove temperature
Claude Opus/Sonnet 4.7 introduced breaking API changes:
- temperature/top_p/top_k removed (causes 400 error)
- thinking.type 'enabled' + budget_tokens removed (causes 400 error)
- New thinking.type 'adaptive' with output_config.effort levels
- New display: 'summarized' option to surface thinking content
Changes:
- Detect Gen 4.7+ models via baseModelId.includes('opus-4-7' | 'sonnet-4-7')
- Omit temperature from inferenceConfig for 4.7+ models
- Use thinking: { type: 'adaptive', display: 'summarized' } for 4.7+
- Set output_config.effort: 'xhigh' (highest level for coding/agentic tasks)
- Maintain full backward compatibility with 4.6 and earlier models
- Expanded BedrockAdditionalModelFields interface to support both formats
References:
- Claude 4.7 release notes (Apr 16, 2026)
- effort levels: low | medium | high | xhigh | max
* feat(types): add claude-opus-4-8 to Anthropic, Bedrock, and Vertex registries
- Register claude-opus-4-8 in anthropicModels with 1M context, 128k output,
supportsReasoningBudget, supportsReasoningBinary, supportsTemperature: false
(mirrors 4.7 - no breaking API changes per the official migration guide).
- Register anthropic.claude-opus-4-8 in bedrockModels with cache points,
cachableFields, and 1M context tier pricing.
- Register claude-opus-4-8 in vertexModels with the same shape.
- Add anthropic.claude-opus-4-8 to BEDROCK_1M_CONTEXT_MODEL_IDS and
BEDROCK_GLOBAL_INFERENCE_MODEL_IDS.
- Add claude-opus-4-8 to VERTEX_1M_CONTEXT_MODEL_IDS.
* feat(bedrock): support Claude Opus 4.8 (extends 4.7 adaptive thinking detection)
- Anthropic provider: add claude-opus-4-8 to both prompt-caching switch
statements so it gets the same handling as 4.7 (native 1M context, no beta
header required).
- Bedrock provider: rename isGen47Model -> isAdaptiveThinkingModel and expand
the pattern to match opus-4-7, opus-4-8, sonnet-4-7, sonnet-4-8. 4.8 inherits
the same adaptive-thinking + temperature-rejection contract from 4.7 with no
breaking API changes.
- OpenAI-compatible provider: update comment to mention 4.8 alongside 4.7; no
logic change (already honors the supportsTemperature: false flag).
The rename describes the capability (adaptive thinking) rather than a specific
generation, making future Claude versions easier to support.
* test: add unit coverage for Claude Opus 4.8 across providers
- anthropic.spec.ts: 5 cases mirroring 4.7 (1M-beta-header guard, adaptive
thinking ON/OFF, custom maxTokens, getModel info).
- anthropic-vertex.spec.ts: 1M context tier pricing for Vertex Opus 4.8.
- shared/api.spec.ts: getModelMaxOutputTokens hybrid-token handling on 4.8.
- bedrock.spec.ts: new 'Claude 4.7+ adaptive thinking' block with 5 cases
covering 4.7 + 4.8 adaptive thinking, reasoning-off behaviour, a 4.6
regression guard (budget_tokens + temperature), and cross-region prefix
detection (us.anthropic.claude-opus-4-8).
235 unit tests pass, 0 type errors. Validated live end-to-end via Bedrock
Global Inference (global.anthropic.claude-opus-4-8).
* fix(bedrock): omit temperature in completePrompt for adaptive-thinking models
Addresses CodeRabbit review on #386. completePrompt was unconditionally
sending temperature in its inferenceConfig, which causes a 400 error for
Claude Opus/Sonnet 4.7 and 4.8 (sampling parameters were removed by
Anthropic for these models). createMessage already guarded this, but the
non-stream path did not.
- Extract the adaptive-thinking detection into a private
isAdaptiveThinkingModel(modelId) method (parseBaseModelId-aware, so
cross-region/global prefixes are handled).
- Reuse it in both createMessage and completePrompt so the two request
paths stay consistent.
- Add two regression tests: completePrompt omits temperature for opus-4-8
and still sends it for opus-4-6.
64 bedrock tests pass, check-types clean.
* test(e2e): add Bedrock smoke test for Claude Opus 4.8
Addresses @edelauna's review request on #386 to cover 4.8 in the new
Bedrock e2e harness.
Mirrors the existing user-agent smoke test but re-points the provider at
us.anthropic.claude-opus-4-8. Since 4.8 is an adaptive-thinking model, this
exercises the request path that omits temperature (and sends thinking.type
"adaptive" when reasoning is enabled), proving a Bedrock round-trip
completes without a 400. Runs against the binary-event-stream mock server in
CI and against real AWS when BEDROCK_LIVE_E2E=true. The original 4.7-era
test is left untouched; model id is overridable via BEDROCK_OPUS_48_MODEL_ID.
check-types clean (tsconfig.esm.json).
* test(bedrock): cover sonnet-4-7/4-8 branches in isAdaptiveThinkingModel
Codecov flagged the sonnet-4-7 and sonnet-4-8 branches of
isAdaptiveThinkingModel as uncovered — they have no Bedrock registry entry
yet (future-proof guards), so no existing test reached them.
Add a focused unit test that calls the private method directly (same pattern
the suite already uses for parseBaseModelId / getPrefixForRegion), covering:
- all four positive patterns: opus-4-7, opus-4-8, sonnet-4-7, sonnet-4-8
- cross-region / global prefixes (us./eu./global.) via parseBaseModelId
- negative cases: opus-4-6, sonnet-4-6, claude-3-5, nova
Brings patch coverage to 100%. 68 bedrock tests pass, check-types clean.
* fix(vertex): use adaptive thinking for Opus 4.8
---------
Co-authored-by: Vandre Sales <vandre.sales@gmail.com>
Co-authored-by: Elliott de Launay <edelauna@gmail.com>1 parent db07a23 commit 5d0d6e7
12 files changed
Lines changed: 640 additions & 20 deletions
File tree
- apps/vscode-e2e/src/suite/providers
- packages/types/src/providers
- src
- api/providers
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
94 | 147 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
111 | 129 | | |
112 | 130 | | |
113 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
170 | 220 | | |
171 | 221 | | |
172 | 222 | | |
| |||
525 | 575 | | |
526 | 576 | | |
527 | 577 | | |
| 578 | + | |
| 579 | + | |
528 | 580 | | |
529 | 581 | | |
530 | 582 | | |
| |||
535 | 587 | | |
536 | 588 | | |
537 | 589 | | |
| 590 | + | |
538 | 591 | | |
539 | 592 | | |
540 | 593 | | |
541 | 594 | | |
542 | 595 | | |
543 | 596 | | |
544 | 597 | | |
| 598 | + | |
| 599 | + | |
545 | 600 | | |
546 | 601 | | |
547 | 602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
384 | 384 | | |
385 | 385 | | |
386 | 386 | | |
| 387 | + | |
387 | 388 | | |
388 | 389 | | |
389 | 390 | | |
| |||
396 | 397 | | |
397 | 398 | | |
398 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
399 | 424 | | |
400 | 425 | | |
401 | 426 | | |
| |||
595 | 620 | | |
596 | 621 | | |
597 | 622 | | |
| 623 | + | |
598 | 624 | | |
599 | 625 | | |
600 | 626 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
929 | 929 | | |
930 | 930 | | |
931 | 931 | | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
932 | 948 | | |
933 | 949 | | |
934 | 950 | | |
| |||
1145 | 1161 | | |
1146 | 1162 | | |
1147 | 1163 | | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1148 | 1195 | | |
1149 | 1196 | | |
1150 | 1197 | | |
| |||
0 commit comments