language_models: Support custom HTTP headers for provider requests#55246
Conversation
6d7d728 to
968e5d2
Compare
|
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. |
|
@SomeoneToIgnore Any reviews? |
7363a6e to
b0a8971
Compare
|
Thanks for this. Changes look reasonable, can you run |
|
@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>
|
Thank you! |
|
Wohoo! thank you for merging <3 |
…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>
…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>
Add a
custom_headerssetting 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:
Release Notes:
providers via
language_models.<provider>.custom_headers.