Skip to content

language_models: Support custom HTTP headers for provider requests#55246

Merged
bennetbo merged 1 commit into
zed-industries:mainfrom
aurabindo:main
Jun 2, 2026
Merged

language_models: Support custom HTTP headers for provider requests#55246
bennetbo merged 1 commit into
zed-industries:mainfrom
aurabindo:main

Conversation

@aurabindo

@aurabindo aurabindo commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Add a custom_headers setting to each HTTP-based language model provider
(Anthropic, Bedrock, DeepSeek, Google, LM Studio, Mistral, Ollama, OpenAI,
OpenAI-compatible, OpenCode, OpenRouter, Vercel AI Gateway, and xAI) so users
can attach extra headers to every outgoing request. Headers managed by Zed
(authentication, content-type, etc.) cannot be overridden and are skipped with
a warning.

Self-Review Checklist:

  • I've reviewed my own diff for quality, security, and reliability
  • Unsafe blocks (if any) have justifying comments
  • The content is consistent with the UI/UX checklist
  • [] Tests cover the new/changed behavior
  • Performance impact has been considered and is acceptable

Release Notes:

  • Added support for configuring custom HTTP headers on language model
    providers via language_models.<provider>.custom_headers.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 29, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Apr 29, 2026
@aurabindo aurabindo force-pushed the main branch 3 times, most recently from 6d7d728 to 968e5d2 Compare April 29, 2026 21:20
@SomeoneToIgnore SomeoneToIgnore added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label Apr 30, 2026
@aurabindo

aurabindo commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

This is an alternate solution to my previous attempt at adding custom header support for openAI compatible compatible providers. First #42817, then #45673. Each time I made the PR, it stayed there for a while without getting attention from maintainers, which would then cause merge conflict. The cycle continues through another PR another member from community created: #54712

This change does not have a UI, so I hope the smaller code change will help get it merged quicker than the previous attempts.

@aurabindo

Copy link
Copy Markdown
Contributor Author

@SomeoneToIgnore Any reviews?

@aurabindo aurabindo force-pushed the main branch 2 times, most recently from 7363a6e to b0a8971 Compare May 25, 2026 15:44
@aurabindo aurabindo changed the title anthropic: Add custom_headers setting for Anthropic provider language_models: Support custom HTTP headers for provider requests May 27, 2026
@bennetbo bennetbo self-assigned this May 29, 2026
@bennetbo

bennetbo commented Jun 1, 2026

Copy link
Copy Markdown
Member

Thanks for this. Changes look reasonable, can you run cargo format and push the changes? I can't push to your branch. Next time please check "Allow edits by maintainers" when submitting a PR, makes it a bit easier to manage on our side, e.g. to fix formatting issues 😄

@aurabindo

aurabindo commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@bennetbo thanks for taking a look at this! I've fixed the formatting issues. Looks like I'm unable to edit the "Allow edits by maintainers" setting now :-|

Add a `custom_headers` setting to each HTTP-based language model provider
(Anthropic, Bedrock, DeepSeek, Google, LM Studio, Mistral, Ollama, OpenAI,
OpenAI-compatible, OpenCode, OpenRouter, Vercel AI Gateway, and xAI) so users
can attach extra headers to every outgoing request. Headers managed by Zed
(authentication, content-type, etc.) cannot be overridden and are skipped with
a warning.

Release Notes:

- Added support for configuring custom HTTP headers on language model
  providers via `language_models.<provider>.custom_headers`.

Signed-off-by: Aurabindo Pillai <mail@aurabindo.in>
@bennetbo bennetbo added this pull request to the merge queue Jun 2, 2026
@bennetbo

bennetbo commented Jun 2, 2026

Copy link
Copy Markdown
Member

Thank you!

Merged via the queue into zed-industries:main with commit bb5951b Jun 2, 2026
32 checks passed
@aurabindo

Copy link
Copy Markdown
Contributor Author

Wohoo! thank you for merging <3

dandv pushed a commit to dandv/zed that referenced this pull request Jun 3, 2026
…ed-industries#55246)

Add a `custom_headers` setting to each HTTP-based language model
provider
(Anthropic, Bedrock, DeepSeek, Google, LM Studio, Mistral, Ollama,
OpenAI,
OpenAI-compatible, OpenCode, OpenRouter, Vercel AI Gateway, and xAI) so
users
can attach extra headers to every outgoing request. Headers managed by
Zed
(authentication, content-type, etc.) cannot be overridden and are
skipped with
a warning.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added support for configuring custom HTTP headers on language model
  providers via `language_models.<provider>.custom_headers`.

Signed-off-by: Aurabindo Pillai <mail@aurabindo.in>
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
…ed-industries#55246)

Add a `custom_headers` setting to each HTTP-based language model
provider
(Anthropic, Bedrock, DeepSeek, Google, LM Studio, Mistral, Ollama,
OpenAI,
OpenAI-compatible, OpenCode, OpenRouter, Vercel AI Gateway, and xAI) so
users
can attach extra headers to every outgoing request. Headers managed by
Zed
(authentication, content-type, etc.) cannot be overridden and are
skipped with
a warning.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Added support for configuring custom HTTP headers on language model
  providers via `language_models.<provider>.custom_headers`.

Signed-off-by: Aurabindo Pillai <mail@aurabindo.in>
This was referenced Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants