Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions open-sse/config/providerRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ const KIMI_CODING_SHARED = {
baseUrl: "https://api.kimi.com/coding/v1/messages",
authHeader: "x-api-key",
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
{ id: "kimi-k2.5", name: "Kimi K2.5" },
Expand Down Expand Up @@ -273,11 +273,11 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authHeader: "x-api-key",
defaultContextLength: 200000,
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_CLAUDE_OAUTH,
"Anthropic-Dangerous-Direct-Browser-Access": "true",
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_CLAUDE_OAUTH,
"anthropic-dangerous-direct-browser-access": "true",
"User-Agent": CLAUDE_CLI_USER_AGENT,
"X-App": "cli",
"x-app": "cli",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The normalization of x-app to lowercase is consistent with the Anthropic headers, but the X-Stainless-* headers (lines 281-289) and the User-Agent header (line 279) remain in PascalCase. Since JavaScript object keys are case-sensitive, any other code path setting these headers in lowercase will cause fetch() to send duplicate headers (concatenated values), which is the root cause of the issue described in this PR. Consider lowercasing all header keys in this block for consistency, especially since other providers like github already use lowercase keys (e.g., user-agent).

"X-Stainless-Helper-Method": "stream",
"X-Stainless-Retry-Count": "0",
"X-Stainless-Runtime-Version": CLAUDE_CLI_STAINLESS_RUNTIME_VERSION,
Expand Down Expand Up @@ -607,8 +607,8 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authHeader: "x-api-key",
defaultContextLength: 200000,
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
{ id: "claude-haiku-4.5", name: "Claude Haiku 4.5" },
Expand Down Expand Up @@ -721,8 +721,8 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authType: "apikey",
authHeader: "x-api-key",
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
{ id: "qwen3.5-plus", name: "Qwen3.5 Plus" },
Expand All @@ -746,8 +746,8 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authType: "apikey",
authHeader: "x-api-key",
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
{ id: "glm-5", name: "GLM 5" },
Expand Down Expand Up @@ -878,8 +878,8 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authType: "apikey",
authHeader: "bearer",
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
// T12/T28: MiniMax default upgraded from M2.5 to M2.7
Expand All @@ -902,8 +902,8 @@ export const REGISTRY: Record<string, RegistryEntry> = {
authType: "apikey",
authHeader: "bearer",
headers: {
"Anthropic-Version": ANTHROPIC_VERSION_HEADER,
"Anthropic-Beta": ANTHROPIC_BETA_API_KEY,
"anthropic-version": ANTHROPIC_VERSION_HEADER,
"anthropic-beta": ANTHROPIC_BETA_API_KEY,
},
models: [
// Keep parity with minimax to ensure model discovery works for minimax-cn connections.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/search-provider-validation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test("kimi-coding-apikey validation uses Kimi Coding messages endpoint", async (
assert.equal(calls[0].url, "https://api.kimi.com/coding/v1/messages");
assert.equal(calls[0].method, "POST");
assert.equal(calls[0].headers["x-api-key"], "sk-kimi-test");
assert.equal(calls[0].headers["Anthropic-Version"], "2023-06-01");
assert.equal(calls[0].headers["anthropic-version"], "2023-06-01");

for (const call of calls) {
assert.equal(call.url.includes("?beta=true/messages"), false);
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/t20-t22-provider-headers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ test("T20: antigravity config has updated User-Agent and sandbox fallback URL",

test("T25: anthropic API-key config includes the full Anthropic beta header set", () => {
const anthropic = REGISTRY.anthropic;
assert.equal(anthropic.headers["Anthropic-Version"], "2023-06-01");
assert.ok(anthropic.headers["Anthropic-Beta"]?.includes("advanced-tool-use-2025-11-20"));
assert.ok(anthropic.headers["Anthropic-Beta"]?.includes("structured-outputs-2025-12-15"));
assert.ok(anthropic.headers["Anthropic-Beta"]?.includes("token-efficient-tools-2026-03-28"));
assert.equal(anthropic.headers["anthropic-version"], "2023-06-01");
assert.ok(anthropic.headers["anthropic-beta"]?.includes("advanced-tool-use-2025-11-20"));
assert.ok(anthropic.headers["anthropic-beta"]?.includes("structured-outputs-2025-12-15"));
assert.ok(anthropic.headers["anthropic-beta"]?.includes("token-efficient-tools-2026-03-28"));
});

test("T22: github headers include updated editor/plugin versions and required fields", () => {
Expand Down