Cherry-pick: Fix 400 "thinking.type.enabled" with direct Anthropic API key (1.18.0) - #4484
Merged
sejas merged 1 commit intoAug 7, 2026
Merged
Conversation
…Anthropic API key (#4480) - Copies the thinking metadata (`compat`, `thinkingLevelMap`) from pi-ai's bundled Anthropic catalog into Studio's model definition, so requests use `thinking: { type: "adaptive" }`. The values stay in sync with pi-ai upgrades, and a new test fails if a future Studio model is missing from the catalog. - Passes `allowNetwork: false` when setting the runtime API key — the implicit default triggered an awaited, unguarded network fetch of remote model catalogs on every direct-key turn (which also hung the new tests on a CI agent with slow egress). Studio hand-builds its models, so the fetch was pure latency.
Collaborator
📊 Performance Test ResultsComparing e01bbe2 vs trunk app-size
site-editor
site-startup
Results are median values from multiple test runs. Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
release/1.18.0. Related to STU-2205.How AI was used in this PR
Cherry-pick of an already-reviewed trunk commit; tests re-run on the release branch.
Proposed Changes
Cherry-picks 97a5a94 from trunk: chatting with a direct Anthropic API key always failed with
400 "thinking.type.enabled" is not supported for this model. See #4480 for full details.compat,thinkingLevelMap) from pi-ai's bundled catalog so requests usethinking: { type: "adaptive" }.allowNetwork: falsewhen setting the runtime API key, removing an unguarded per-turn network fetch.Testing Instructions
Same as #4480:
npm run cli:build && node apps/cli/dist/cli/main.mjs ai/provider→ "Anthropic · API key", enter a valid key, send a prompt on Sonnet 5 — streams instead of the 400. Repeat on Opus 5.npm test -- apps/cli/ai/tests/pi-runtime.test.ts— 13 tests pass (verified on this branch).Pre-merge Checklist