anthropic: Pass beta header for speed in BYOK#57707
Merged
Merged
Conversation
We were sending the `speed` field set to `"standard"` for BYOK Anthropic but without the corresponding beta header. leading the requests to fail with "invalid request format to Anthropic's API: speed: Extra inputs are not permitted". This makes sure to attach the beta header whenever the `speed` parameter is used. Release Notes: - Fixed "speed: Extra inputs are not permitted" errors for Opus 4.6 and 4.7 in the Anthropic API provider. Until now, BYOK Anthropic requests with `Speed::Fast` were sending the `speed` field on the body without the `fast-mode-2026-02-01` beta header, so Anthropic would not honor it. Attach the header from `Model::beta_headers` whenever the request opts into fast mode, mirroring how `llm_api` already does it for Zed-hosted requests. > > Note: cloud also attaches the header for `Speed::Standard`; this change does not, on the assumption that Standard is the default and needs no opt-in. Revisit if Anthropic starts rejecting `speed: "standard"` without the beta.
tomhoule
commented
May 26, 2026
| let mut extra_beta_headers = Vec::new(); | ||
| if supports_speed { | ||
| extra_beta_headers.push(FAST_MODE_BETA_HEADER.to_string()); | ||
| } |
Contributor
Author
There was a problem hiding this comment.
This is mediated through supported_speed, which works in practice, but we could have the speed as an extra parameter on beta_headers instead, which is a bit uglier, but closer to where we actually build the request. I went back and forth between these two options. LMK it the other one sounds better.
bennetbo
approved these changes
May 26, 2026
bennetbo
left a comment
Member
There was a problem hiding this comment.
Thank you, i'm fine with the way you implemented it here
Contributor
Author
|
/cherry-pick preview |
zed-zippy Bot
added a commit
that referenced
this pull request
May 26, 2026
…o preview) (#57711) Cherry-pick of #57707 to preview ---- We were sending the `speed` field set to `"standard"` for BYOK Anthropic but without the corresponding beta header. leading the requests to fail with "invalid request format to Anthropic's API: speed: Extra inputs are not permitted". This makes sure to attach the beta header whenever the `speed` parameter is used. Release Notes: - Fixed "speed: Extra inputs are not permitted" errors for Opus 4.6 and 4.7 in the Anthropic API provider. Co-authored-by: Tom Houlé <13155277+tomhoule@users.noreply.github.com>
This was referenced May 27, 2026
TomPlanche
pushed a commit
to TomPlanche/zed
that referenced
this pull request
Jun 2, 2026
We were sending the `speed` field set to `"standard"` for BYOK Anthropic but without the corresponding beta header. leading the requests to fail with "invalid request format to Anthropic's API: speed: Extra inputs are not permitted". This makes sure to attach the beta header whenever the `speed` parameter is used. Release Notes: - Fixed "speed: Extra inputs are not permitted" errors for Opus 4.6 and 4.7 in the Anthropic API provider.
This was referenced Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were sending the
speedfield set to"standard"for BYOK Anthropic but without the corresponding beta header. leading the requests to fail with "invalid request format to Anthropic's API: speed: Extra inputs are not permitted".This makes sure to attach the beta header whenever the
speedparameter is used.Release Notes: