Skip to content

fix: preserve incoming Anthropic beta headers - #32

Open
mkazlauskas wants to merge 1 commit into
dotCipher:mainfrom
mkazlauskas:fix/preserve-anthropic-beta-headers
Open

mkazlauskas wants to merge 1 commit into
dotCipher:mainfrom
mkazlauskas:fix/preserve-anthropic-beta-headers

Conversation

@mkazlauskas

@mkazlauskas mkazlauskas commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

Preserve SDK-provided anthropic-beta flags when rewriting OAuth requests, alongside the bridge defaults and required Claude Code/OAuth flags.

Problem

buildBetaFlags(existing) currently ignores existing. This can leave beta-gated fields in the request body while removing the SDK header that enables them. The reported failure on OpenCode 1.18.31 with bridge 1.10.12 was:

thinking.adaptive.block_binding: Extra inputs are not permitted

The patched OpenCode Anthropic SDK adds a thinking-binding-controls beta for this field. Preserving incoming flags avoids losing that capability declaration. This does not establish that every model or deployment supports the field.

Changes

  • Merge incoming flags with configured bridge flags.
  • Keep the Claude Code and OAuth flags first.
  • Trim whitespace, remove empty entries, and deduplicate all flags.
  • Add three regression tests against the production helper, including a synthetic SDK feature flag.

The separate plugin startup failure (modelId.match is not a function) is already fixed on upstream main by the { id, server } default export, with existing regression coverage.

Validation

  • npm test: 125 tests passed.
  • npm run typecheck: passed.
  • git diff --check: passed.
  • Manual testing with Opus 5.5 passed

@olosegres

Copy link
Copy Markdown
Contributor

I also use rhis code locally in my fork, @dotCipher please consider to merge it

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