fix(coding-agent): remove Vercel AI Gateway attribution
This commit is contained in:
@@ -17,6 +17,10 @@
|
|||||||
- Fixed custom session entries appended during assistant streaming to render before the live assistant message, matching persisted session order.
|
- 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)).
|
- 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
|
## [0.80.3] - 2026-06-30
|
||||||
|
|
||||||
### New Features
|
### New Features
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ const NVIDIA_NIM_HOST = "integrate.api.nvidia.com";
|
|||||||
const CLOUDFLARE_API_HOST = "api.cloudflare.com";
|
const CLOUDFLARE_API_HOST = "api.cloudflare.com";
|
||||||
const CLOUDFLARE_AI_GATEWAY_HOST = "gateway.ai.cloudflare.com";
|
const CLOUDFLARE_AI_GATEWAY_HOST = "gateway.ai.cloudflare.com";
|
||||||
const OPENCODE_HOST = "opencode.ai";
|
const OPENCODE_HOST = "opencode.ai";
|
||||||
const VERCEL_GATEWAY_HOST = "ai-gateway.vercel.sh";
|
|
||||||
|
|
||||||
function matchesHost(baseUrl: string, expectedHost: string): boolean {
|
function matchesHost(baseUrl: string, expectedHost: string): boolean {
|
||||||
try {
|
try {
|
||||||
@@ -34,10 +33,6 @@ function isCloudflareModel(model: Model<Api>): boolean {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isVercelGatewayModel(model: Model<Api>): boolean {
|
|
||||||
return model.provider === "vercel-ai-gateway" || matchesHost(model.baseUrl, VERCEL_GATEWAY_HOST);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultAttributionHeaders(
|
function getDefaultAttributionHeaders(
|
||||||
model: Model<Api>,
|
model: Model<Api>,
|
||||||
settingsManager: SettingsManager,
|
settingsManager: SettingsManager,
|
||||||
@@ -66,13 +61,6 @@ function getDefaultAttributionHeaders(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isVercelGatewayModel(model)) {
|
|
||||||
return {
|
|
||||||
"http-referer": "https://pi.dev",
|
|
||||||
"x-title": "pi",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,13 +197,6 @@ describe("createAgentSession provider attribution headers", () => {
|
|||||||
expect(headers?.["X-OpenRouter-Categories"]).toBe("provider-category");
|
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 () => {
|
it("adds default attribution headers for direct NVIDIA NIM endpoints", async () => {
|
||||||
const headers = await captureHeaders(createModel("custom-nim", "https://integrate.api.nvidia.com/v1"));
|
const headers = await captureHeaders(createModel("custom-nim", "https://integrate.api.nvidia.com/v1"));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user