Skip to content

🍃 fix: Apply the Claude Haiku 5.5 Thinking Contract - #17062

Open
mforman wants to merge 1 commit into
LibreChat-AI:devfrom
mforman:fix/haiku-5-5-thinking-config
Open

mforman wants to merge 1 commit into
LibreChat-AI:devfrom
mforman:fix/haiku-5-5-thinking-config

Conversation

@mforman

@mforman mforman commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Summary

Claude Haiku 5.5 is not recognized by any of the model-name gates in packages/data-provider/src/bedrock.ts, which only parse Opus and Sonnet versions (plus Mythos-class). Because the Anthropic, Bedrock and custom provider: anthropic endpoints all share these helpers, Haiku 5.5 is treated as a legacy Claude 4 model everywhere.

That produces several failures. With thinking on, the request sends { type: "enabled", budget_tokens }, which Haiku 5.5 rejects with a 400. With thinking off, the field is omitted, so Haiku 5.5 still thinks, because it runs adaptive thinking by default. Thinking blocks are bound to the conversation prefix on Haiku 5.5, but the request carries neither block_binding: { prefix_mismatch_behavior: "drop_block" } nor the thinking-binding-controls-2026-08-01 beta. Any conversation whose earlier turns LibreChat has edited or compacted therefore fails with Invalid signature in thinking block. The block is bound to a different conversation. Sampling parameters are sent although Haiku 5.5 rejects non-default values, thinking text comes back empty because display is never set to summarized, and the context window falls back to the 100K claude- default instead of 1M.

This PR adds a Haiku version parser and treats Haiku 5.5+ like the other current models in supportsAdaptiveThinking, bindsThinkingBlocks, omitsThinkingByDefault, omitsSamplingParameters, requiresExplicitThinkingDisabled, capsEffortWhenThinkingDisabled, supportsContext1m and supportsOutput128k. Haiku 4.5 and earlier are unchanged.

Fixes #16911

How it works

Haiku 5.5 sits between Sonnet 5 and Sonnet 5.5 in the thinking contract. Omitting thinking runs adaptive thinking, and { type: "disabled" } is accepted only at effort high or below, as on Opus 5. Like Sonnet 5.5, it binds thinking blocks to the conversation. It does not accept between_tools. Because of that, hasAlwaysOnThinking and hasBetweenToolsThinkingFloor are left alone, and Haiku goes through the same explicit-disabled path as Opus 5 and Sonnet 5. Thinking off sends { type: "disabled" } without block_binding, which Haiku 5.5 rejects alongside disabled. That ordering already exists in configureReasoning.

Type of change

  • Bug fix

Testing

Reproduced against claude-haiku-5-5 on Microsoft Foundry through a custom provider: anthropic endpoint. A follow-up turn in a conversation whose history had changed failed with the binding 400 above. With this change deployed, the same follow-up turn on Haiku 5.5 succeeds in production.

Tested environments/configuration:

  • Provider/model: Microsoft Foundry, claude-haiku-5-5 (custom endpoint, provider: anthropic)

Automated tests:

  • Added Haiku 5.5 cases in packages/data-provider/specs/bedrock.spec.ts and packages/api/src/utils/tokens.spec.ts, and confirmed that Haiku 4.5 keeps manual thinking.
  • One existing spec used a hypothetical anthropic.claude-haiku-6 to assert manual budget thinking. It now uses anthropic.claude-haiku-4-5, which keeps the test's intent (no context-1m beta), because Haiku 6 would fall under the 5.5+ contract.
  • packages/data-provider full suite and packages/api src/utils/tokens.spec.ts + src/endpoints/anthropic pass.

Screenshots / recordings

No user-facing change

Risk / compatibility

The gate is open-ended (Haiku ≥ 5.5), matching the Opus/Sonnet gates, so future Haiku versions inherit the modern contract.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors
  • User-facing or complex behavior is documented where necessary
  • Required dependency changes have been merged/published
  • Required documentation PR: N/A

🤖 Generated with Claude Code

Haiku 5.5+ runs adaptive thinking by default, binds thinking blocks to the
conversation prefix, rejects non-default sampling parameters, and supports a
1M context window and 128K output. None of the model-name gates recognized
Haiku, so it received budget thinking (400), no explicit disabled config,
no block_binding (400 on edited history), sampling params, and a 100K
context fallback.

Fixes LibreChat-AI#16911

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions
github-actions Bot changed the base branch from main to dev October 13, 2026 10:21
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for the contribution! LibreChat merges all changes into dev first — main only moves at release time — so this pull request's base branch was switched from main to dev automatically.

Nothing is needed from you; your commits, reviews and discussion are unchanged. If the diff now shows files you did not touch, rebase onto dev:

git remote add upstream https://github.com/LibreChat-AI/LibreChat.git
git fetch upstream dev
git rebase upstream/dev
git push --force-with-lease

Maintainers: apply the target: main label and restore the base branch if this one genuinely belongs on main.

This branch has not been deployed

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

Labels

🗺️ Backend Infra codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Support Claude Haiku 5.x thinking config (adaptive / disabled)

1 participant