Skip to content

agent: Add Anthropic-compatible provider - #55351

Closed
Scott-Nx wants to merge 12 commits into
zed-industries:mainfrom
Scott-Nx:feat-anthropic-compatible-provider
Closed

agent: Add Anthropic-compatible provider#55351
Scott-Nx wants to merge 12 commits into
zed-industries:mainfrom
Scott-Nx:feat-anthropic-compatible-provider

Conversation

@Scott-Nx

Copy link
Copy Markdown

Summary

  • New AnthropicCompatibleProvider type with Bearer/XApiKey auth dispatch
  • UI toggle to select auth style when adding provider
  • Thread title generation fixed via default_fast_model delegation
  • Error response body capture for Bearer auth path
  • SSE parse failure logging added
  • 8 new tests covering Anthropic path

Test plan

  • Build passes: cargo check -p language_models -p agent_ui
  • Tests cover validation, auth style selection, duplicate detection
  • Manual: Built debug, added provider, tested tool calls and MCP

Release Notes:

  • Added support for Anthropic-compatible API endpoints

Self-Review Checklist:

  • Reviewed diff for quality, security, and reliability
  • No unsafe blocks
  • UI follows existing patterns (Filled/Subtle ButtonStyle)
  • Tests cover new/changed behavior
  • Performance impact: minimal (one extra model lookup on title generation)

Closes #52899

Scott-Nx and others added 12 commits April 30, 2026 18:40
Extends the Add Provider modal to support adding Anthropic-compatible
API
endpoints alongside the existing OpenAI-compatible option. Uses native
Anthropic /v1/messages endpoint format with support for:
- Extended thinking (budget_tokens mode)
- Custom beta headers
- Cache configuration

Release Notes:

- Added support for Anthropic-compatible endpoints in Add Provider UI

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
provider

The native Anthropic /v1/messages API only uses max_tokens (output
tokens), not max_completion_tokens like OpenAI. This removes the unused
field from the Anthropic-compatible provider settings and UI.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
The parallel_tool_calls, prompt_cache_key, and chat_completions
capability
checkboxes are now conditionally rendered only when the provider is
OpenAI,
as these are OpenAI-specific features.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
- Add tool_override field to AnthropicCompatibleAvailableModel
  to match other model types (AnthropicAvailableModel, ZedDotDevAvailableModel)
- Fix test_save_provider_invalid_inputs which incorrectly tested
  duplicate model detection with a single model

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Allows users to select X-Api-Key or Bearer auth when adding
an Anthropic-compatible provider via the UI.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
wrapper

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
Bearer auth path now reads response body on non-success status
for logging. Previously returned empty message string.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
Enables thread title generation when using Anthropic-compatible
provider with default model configuration.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
Covers validation, XApiKey/Bearer auth selection, and duplicate model
detection.

Signed-off-by: Scott-Nx <158021536+Scott-Nx@users.noreply.github.com>
@cla-bot

cla-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @Scott-Nx on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@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 30, 2026
@Scott-Nx

This comment was marked as off-topic.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Apr 30, 2026
@cla-bot

cla-bot Bot commented Apr 30, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@Scott-Nx

Scott-Nx commented May 1, 2026

Copy link
Copy Markdown
Author

This can solve one of issue on #41897

<thinking> block seems not recognized by Zed, so it's just printed as usual text

screenshot_2569-05-01_10-27-09

@maxdeviant maxdeviant changed the title feat(agent): add Anthropic-compatible provider agent: Add Anthropic-compatible provider May 1, 2026
@SomeoneToIgnore SomeoneToIgnore added the area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features label May 1, 2026
@anantdgoel

Copy link
Copy Markdown
Contributor

Hi @Scott-Nx thanks for this contribution! I think this PR addresses the anthropic-compatible API concern of your PR: #50381. Are there other features you still feel are missing after this change?

@Scott-Nx

Copy link
Copy Markdown
Author

Hi @Scott-Nx thanks for this contribution! I think this PR addresses the anthropic-compatible API concern of your PR: #50381. Are there other features you still feel are missing after this change?

Yes, this PR covers the Anthropic-compatible API provider use case from #50381 from my side.

I don’t have any remaining feature requirements after this change. The selectable auth style and Anthropic-compatible provider path address the main gap I was trying to solve there.

I’m fine with closing #50381 as superseded by this PR.

@Scott-Nx Scott-Nx closed this Jun 13, 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