Skip to content

Force adaptive thinking for Pi Anthropic routes - #175

Merged
ShivainVij merged 1 commit into
mainfrom
shivain/pi-anthropic-thinking-contract
Oct 21, 2026
Merged

ShivainVij merged 1 commit into
mainfrom
shivain/pi-anthropic-thinking-contract

Conversation

@ShivainVij

Copy link
Copy Markdown
Contributor

Anthropic Messages routes now always set compat.forceAdaptiveThinking: true in Pi’s generated model config. This prevents Pi from sending the legacy thinking.type.enabled request shape to Anthropic models such as Claude Opus 5.5, which require adaptive thinking.

Tested with a fresh Pi teardown/setup and a successful Opus 5.5 request.

Context: https://platform.claude.com/docs/en/build-with-claude/extended-thinking#migrating-to-adaptive-thinking

Validation:

  • go test ./internal/harness

Copilot AI balanced review requested due to automatic review settings October 21, 2026 00:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The unconditional override breaks thinking-enabled requests to older Anthropic models that require token-budget thinking.

1 open issue
What changed in this PR

Updates Pi’s generated configuration to use adaptive thinking for Anthropic Messages routes, addressing newer models’ request requirements.

Changes:

  • Adds compat.forceAdaptiveThinking: true to Anthropic model configs.
  • Updates the native-API test to expect the flag.
File Description
internal/​harness/​pi.go Forces adaptive thinking for Anthropic routes.
internal/​harness/​harness_test.go Verifies the generated compatibility flag.

Review effort: Balanced

Comment thread internal/harness/pi.go
// Pi's Anthropic client appends /v1/messages itself.
model["api"], model["baseUrl"] = "anthropic-messages", baseURL
// Anthropic Messages models use adaptive thinking, not a token budget.
model["compat"] = map[string]any{"forceAdaptiveThinking": true}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't verified this claim, but @ShivainVij I wonder if this is true? It's up to us whether we want to have some hardcoded list in the CLI, but it does seem like we would break any old model usage

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, old models would break. Is support for 4.5 models needed still?

@nnarayen nnarayen Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is true, old models would break. Is support for 4.5 models needed still?

Nobody has explicitly told us that they need older models + Pi, but I doubt that's something that would organically come up. Though it's unlikely, would be a bummer if this broke for somebody. It seems relatively easy to fix with low risk, but I'll defer to you

@cretz cretz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can have e2e tests that will catch this break, that would be ideal

@ShivainVij
ShivainVij merged commit ace9c27 into main Oct 21, 2026
5 checks passed
@ShivainVij
ShivainVij deleted the shivain/pi-anthropic-thinking-contract branch October 21, 2026 21:45
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.

4 participants