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
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 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>
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 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>
paterschris added a commit to paterschris/lathe that referenced this pull request Aug 23, 2026
Most of the 59 conflicts were not real divergence: earlier merges had
silently reverted upstream code, so the fork side was simply older. Those
files were taken from upstream wholesale after confirming they carried no
Lathe commits.

Restored upstream work that prior merges had dropped:

* Custom HTTP headers across every LLM provider (upstream zed-industries#55246), plus
  extra_beta_headers, the xhigh reasoning effort, Copilot token handling,
  and the cloud reconnect / model refresh task. 38 files under
  crates/{anthropic,open_ai,google_ai,copilot_chat,opencode,open_router,
  language_models,bedrock} had no fork commits and now match upstream.
* language::file_content, replacing an inlined copy in worktree.rs.
* The Project Panel doc page and its SUMMARY entry.
* threads_archive_view window controls and archived-thread fallback.
* worktree file_scan_depth support and its test suite.

Structural resolutions:

* worktree_service: the fork had split it into creation/opening/selection
  while upstream moved it into the new git_ui_core crate. The split now
  lives in git_ui_core, with upstream's askpass cancellation,
  find_or_create_workspace, and MultiWorkspace::add changes applied.
* File history: project_panel now goes through upstream's
  git_ui_core::open_file_history seam, and git_ui::init registers Lathe's
  FileHistoryView as the opener, so the feature is unchanged.
* zed.proto: upstream's BlameBufferAtRevision pair moved to 480/481
  because Lathe already occupies 478/479 with git_file_history. Renumbering
  upstream keeps released Lathe clients wire-compatible.
* git repository backend stays libgit2-backed, converted to upstream's
  byte-oriented load_index_text / load_committed_text / load_blob_content.
* build_gitignore_with_root ported: upstream's stricter repo-exclude guard
  in ignore.rs needs .git/info/exclude rooted at the work directory.

Lathe behavior preserved: LatheLogo, the show_branch_name gate and the
combined Branch & Stash picker, StashFile, UndoLogChanged, SkillsFeatureFlag,
the git panel Lathe module and its ANSI-aware error toast, telemetry removal,
synthetic-drag cancellation on window move, and ThreadTaskTimings.

Not ported, each needing an upstream refactor the fork lacks:

* The agent panel's create_thread / list_agents_and_models host, which
  depends on CreateThreadOptions and create_thread_with_options.
* reinitialize_local_backend on work directory moves, which depends on
  respawn_local_worker.
* cat-numbered code block rendering in thread_view.
* render_ref_chip in git_graph, whose context menu takes no ref argument.

CI: release_fork.yml and the Lathe Linux/Windows workflows updated for
upstream's new workflow checks (top level permissions, no GitHub input
interpolation inside run blocks).

Verified: cargo check --workspace --all-targets, ./script/clippy, and
cargo xtask workflows are clean. Remaining test failures in worktree, git,
language, project, dev_container, editor and project_panel all reproduce at
4c757b2, and the gpui spring animation flake reproduces on pristine
upstream under the same parallel load.
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