You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mirrored from upstream 1jehuang/jcode — Pull Request #94 by @namphamdev
Original state: open
Created: 2026-05-02T02:40:13Z · Updated: 2026-05-02T02:41:32Z
Diff: https://github.com/1jehuang/jcode/pull/94.diff
This issue is an auto-mirrored copy. Comments and edits here are local to quangdang46/jcode — do not expect them to propagate upstream.
Summary
Adds a new \NamedProviderType::AnthropicCompatible\ variant (TOML aliases anthropic-compatible\ / anthropic_compatible) so users can register named profiles that target Anthropic Messages-API gateways.
Adds a per-profile \headers\ map (\BTreeMap<String, String>) on \NamedProviderConfig\ and wires it through the OpenRouter/OpenAI-compatible runtime so the configured headers are attached to every chat-completion POST.
Extends \jcode provider add\ with two new flags:
--type <openai-compatible|anthropic-compatible>\
--header KEY=VALUE\ (repeatable, also accepts \KEY:VALUE)
Validates header names (ASCII letters/digits/-/_), rejects CR/LF in values, and refuses reserved hop-by-hop names at runtime.
Persists the chosen type and [providers..headers]\ table to \config.toml; --overwrite\ cleanup now also recognizes the headers subsection.
Files
\crates/jcode-config-types/src/lib.rs\ - new enum variant + \headers\ field
\cargo check\ and \cargo check --tests\ are clean for these changes (unrelated pre-existing
easoning_effort\ errors in \src/overnight.rs\ exist on master too).
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.