From 83cbfc6521761a2a071f1bf335c4ed709580ab57 Mon Sep 17 00:00:00 2001 From: Vegard Stikbakke Date: Fri, 3 Jul 2026 15:14:01 +0200 Subject: [PATCH] fix(coding-agent): remove Vercel AI Gateway attribution --- packages/coding-agent/CHANGELOG.md | 4 ++++ .../coding-agent/src/core/provider-attribution.ts | 12 ------------ .../test/sdk-openrouter-attribution.test.ts | 7 ------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index cb6073a8..681bfc3a 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -17,6 +17,10 @@ - Fixed custom session entries appended during assistant streaming to render before the live assistant message, matching persisted session order. - Fixed oversized bash tool timeouts to fail with a clear validation error instead of being clamped to an immediate timeout ([#6181](https://github.com/earendil-works/pi/issues/6181)). +### Removed + +- Removed default attribution headers from Vercel AI Gateway requests. + ## [0.80.3] - 2026-06-30 ### New Features diff --git a/packages/coding-agent/src/core/provider-attribution.ts b/packages/coding-agent/src/core/provider-attribution.ts index d3c6652d..3a541f52 100644 --- a/packages/coding-agent/src/core/provider-attribution.ts +++ b/packages/coding-agent/src/core/provider-attribution.ts @@ -7,7 +7,6 @@ const NVIDIA_NIM_HOST = "integrate.api.nvidia.com"; const CLOUDFLARE_API_HOST = "api.cloudflare.com"; const CLOUDFLARE_AI_GATEWAY_HOST = "gateway.ai.cloudflare.com"; const OPENCODE_HOST = "opencode.ai"; -const VERCEL_GATEWAY_HOST = "ai-gateway.vercel.sh"; function matchesHost(baseUrl: string, expectedHost: string): boolean { try { @@ -34,10 +33,6 @@ function isCloudflareModel(model: Model): boolean { ); } -function isVercelGatewayModel(model: Model): boolean { - return model.provider === "vercel-ai-gateway" || matchesHost(model.baseUrl, VERCEL_GATEWAY_HOST); -} - function getDefaultAttributionHeaders( model: Model, settingsManager: SettingsManager, @@ -66,13 +61,6 @@ function getDefaultAttributionHeaders( }; } - if (isVercelGatewayModel(model)) { - return { - "http-referer": "https://pi.dev", - "x-title": "pi", - }; - } - return undefined; } diff --git a/packages/coding-agent/test/sdk-openrouter-attribution.test.ts b/packages/coding-agent/test/sdk-openrouter-attribution.test.ts index bae02aa4..baaa5746 100644 --- a/packages/coding-agent/test/sdk-openrouter-attribution.test.ts +++ b/packages/coding-agent/test/sdk-openrouter-attribution.test.ts @@ -197,13 +197,6 @@ describe("createAgentSession provider attribution headers", () => { expect(headers?.["X-OpenRouter-Categories"]).toBe("provider-category"); }); - it("adds default attribution headers for Vercel AI Gateway models", async () => { - const headers = await captureHeaders(createModel("vercel-ai-gateway", "https://ai-gateway.vercel.sh/v1")); - - expect(headers?.["http-referer"]).toBe("https://pi.dev"); - expect(headers?.["x-title"]).toBe("pi"); - }); - it("adds default attribution headers for direct NVIDIA NIM endpoints", async () => { const headers = await captureHeaders(createModel("custom-nim", "https://integrate.api.nvidia.com/v1"));