# language_models: Fix beta_headers for Anthropic custom models \(\#37306\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/3c021d089041d5de0e38d18de514c2a4b304fd22)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 3c021d089041d5de0e38d18de514c2a4b304fd22

Requested commit: 3c021d089041d5de0e38d18de514c2a4b304fd22

Commit: 3c021d089041d5de0e38d18de514c2a4b304fd22

Tree: f28b8ccb30869df13b9fcdaff5319c1adadbd1bb

Author: Umesh Yadav

Committer: GitHub

## Message

```
language_models: Fix beta_headers for Anthropic custom models (#37306)

Closes #37289

The current implementation has a problem. The **`from_id` method** in
the Anthropic crate works well for predefined models, but not for custom
models that are defined in the settings. This is because it fallbacks to
using default beta headers, which are incorrect for custom models.

The issue is that the model instance for custom models lives within the
`language_models` provider, so I've updated the **`stream_completion`**
method to explicitly accept beta headers from its caller. Now, the beta
headers are passed from the `language_models` provider all the way to
`anthropic.stream_completion`, which resolves the issue.

Release Notes:

- Fixed a bug where extra_beta_headers defined in settings for Anthropic
custom models were being ignored.

---------

Signed-off-by: Umesh Yadav <git@umesh.dev>
```

## Parents

- [f36a545a86469e4bbd0726b363a742d4879de756](https://git.cafe/gitcafe/zed/commit/f36a545a86469e4bbd0726b363a742d4879de756?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/3c021d089041d5de0e38d18de514c2a4b304fd22?format=markdown)
