Skip to content

Cherry-pick: Fix 400 "thinking.type.enabled" with direct Anthropic API key (1.18.0) - #4484

Merged
sejas merged 1 commit into
release/1.18.0from
cherry-pick-anthropic-adaptive-thinking-1-18-0
Aug 7, 2026
Merged

Cherry-pick: Fix 400 "thinking.type.enabled" with direct Anthropic API key (1.18.0)#4484
sejas merged 1 commit into
release/1.18.0from
cherry-pick-anthropic-adaptive-thinking-1-18-0

Conversation

@sejas

@sejas sejas commented Aug 7, 2026

Copy link
Copy Markdown
Member

Related issues

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.

  • Copies thinking metadata (compat, thinkingLevelMap) from pi-ai's bundled catalog so requests use thinking: { type: "adaptive" }.
  • Passes allowNetwork: false when setting the runtime API key, removing an unguarded per-turn network fetch.

Testing Instructions

Same as #4480:

  1. npm run cli:build && node apps/cli/dist/cli/main.mjs ai
  2. /provider → "Anthropic · API key", enter a valid key, send a prompt on Sonnet 5 — streams instead of the 400. Repeat on Opus 5.
  3. npm test -- apps/cli/ai/tests/pi-runtime.test.ts — 13 tests pass (verified on this branch).

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

…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.
@sejas sejas self-assigned this Aug 7, 2026
@sejas
sejas merged commit 6e9e7e6 into release/1.18.0 Aug 7, 2026
9 of 14 checks passed
@sejas
sejas deleted the cherry-pick-anthropic-adaptive-thinking-1-18-0 branch August 7, 2026 16:08
@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing e01bbe2 vs trunk

app-size

Metric trunk e01bbe2 Diff Change
App Size (Mac) 1405.26 MB 1405.50 MB +0.23 MB ⚪ 0.0%

site-editor

Metric trunk e01bbe2 Diff Change
load 1063 ms 1039 ms 24 ms ⚪ 0.0%

site-startup

Metric trunk e01bbe2 Diff Change
siteCreation 7544 ms 7517 ms 27 ms ⚪ 0.0%
siteStartup 2871 ms 2930 ms +59 ms 🔴 2.1%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants