Add anthropic-compatible provider type and custom headers#94
Open
namphamdev wants to merge 2 commits into
Open
Add anthropic-compatible provider type and custom headers#94namphamdev wants to merge 2 commits into
namphamdev wants to merge 2 commits into
Conversation
Introduce NamedProviderType::AnthropicCompatible and a per-profile headers map so users can target Anthropic Messages-API gateways and attach arbitrary custom request headers (e.g. anthropic-beta, org IDs) to both openai-compatible and anthropic-compatible named providers. Wire headers into the streaming POST path and add jcode provider add --type/--header flags with validation.
This was referenced May 21, 2026
Closed
quangdang46
added a commit
to quangdang46/jcode
that referenced
this pull request
May 24, 2026
#299) Gap close: upstream PR 1jehuang#94 (open) added an AnthropicCompatible provider variant + custom headers field on NamedProviderConfig. Master had neither. This PR ports the schema-only minimal layer: [providers.my-bedrock] type = 'anthropic-compatible' base_url = 'https://corp-bedrock.example/v1/messages' headers = { 'X-Tenant' = 'team-foo', 'X-Project' = 'jcode' } Schema additions: - NamedProviderType::AnthropicCompatible - NamedProviderConfig.headers: BTreeMap<String, String> Out of scope (#83 follow-up): - CLI flag (additive) - CLI flag - Wire AnthropicCompatible into provider dispatcher (currently routes through OpenAI-compat path; new variant will need its own Messages API client similar to anthropic.rs) - Header injection in AnthropicProvider request builder Refs upstream PR 1jehuang#94, fork #83.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Files
Tests
easoning_effort\ errors in \src/overnight.rs\ exist on master too).
Example
\
$ jcode provider add my-claude-gw \
--type anthropic-compatible \
--base-url https://gateway.example.com/v1 \
--model claude-sonnet-4 \
--header anthropic-beta=beta1,beta2 \
--header X-Org=acme \
--api-key-stdin
\\
Need help on this PR? Tag
@codesmithwith what you need.