Skip to content

fix(routing): strip unsupported params when routing to Haiku#8

Open
vadymc wants to merge 1 commit intoRelayPlane:mainfrom
vadymc:fix/strip-unsupported-haiku-params
Open

fix(routing): strip unsupported params when routing to Haiku#8
vadymc wants to merge 1 commit intoRelayPlane:mainfrom
vadymc:fix/strip-unsupported-haiku-params

Conversation

@vadymc
Copy link
Copy Markdown

@vadymc vadymc commented Apr 5, 2026

Summary

  • Fix context-1m beta header: was only stripped for Sonnet; now stripped for all non-Opus models. Haiku rejects it with The long context beta is not yet available for this subscription.
  • Fix output_config.effort: Claude Code sends {"effort":"high"} inside output_config which Haiku does not support, causing This model does not support the effort parameter. Stripped in both native and cascade handlers.
  • Fix cascade handler passing raw ctx: was forwarding the unstripped context (with context-1m beta) to forwardNativeAnthropicRequest. Now constructs a per-attempt cascadeCtx with the beta stripped.
  • Fix cascade mutation bug: output_config is a shared nested object across cascade attempts. Uses copy-on-write (destructuring) instead of delete so cascade escalation from Haiku → Sonnet/Opus retains the effort param.

Test plan

  • 5 new test cases in strip-unsupported-params.test.ts (17 total, all passing)
  • Verified via debug logging that output_config.effort was the actual field causing the 400 error
  • Tested live with Claude Code session routing Opus → Haiku
  • Existing 12 tests still pass

🤖 Generated with Claude Code

Requests originating from Opus (with 1M context, effort, thinking)
were failing with 400 errors when the proxy routed them to Haiku.

Three issues fixed:
- context-1m beta header: only stripped for Sonnet, now stripped for
  all non-Opus models (Haiku rejects it too)
- output_config.effort: Claude Code sends {"effort":"high"} inside
  output_config which Haiku does not support. Strip it in both native
  and cascade handlers.
- cascade handler: was passing raw ctx (with context-1m) instead of
  stripped ctx to forwardNativeAnthropicRequest. Also uses copy-on-write
  for output_config so cascade escalation to Sonnet/Opus retains effort.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant