Skip to content

feat(providers): add custom headers support to Anthropic provider#6401

Closed
trjordan wants to merge 1 commit intoblock:mainfrom
trjordan:feat/anthropic-custom-headers
Closed

feat(providers): add custom headers support to Anthropic provider#6401
trjordan wants to merge 1 commit intoblock:mainfrom
trjordan:feat/anthropic-custom-headers

Conversation

@trjordan
Copy link
Contributor

@trjordan trjordan commented Jan 8, 2026

Summary

  • Adds custom headers support to AnthropicProvider::from_custom_config
  • Enables Anthropic-compatible proxies (like Portkey) that require custom headers for authentication
  • Mirrors the existing implementation in OpenAiProvider::from_custom_config

Test plan

  • cargo check passes
  • cargo test -p goose --lib anthropic - all 8 tests pass
  • cargo clippy - no new warnings
  • Manual testing with Portkey proxy

🤖 Generated with Claude Code

The Anthropic provider's `from_custom_config` method was not applying
custom headers from `DeclarativeProviderConfig`, unlike the OpenAI
provider which correctly applies them.

This enables use cases like Portkey proxy where custom headers
(e.g., `x-portkey-api-key`, `x-portkey-provider`) are required
for authentication and routing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: TR Jordan <tr@tern.sh>
@DOsinga
Copy link
Collaborator

DOsinga commented Jan 28, 2026

thanks for doing this. I noticed this is also missing from Ollama so added that here: #6774 - I'm going to continue there, so closing this one now.

@DOsinga DOsinga closed this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants