Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix anthropic byok connection test (#6325)

Ezra Ellette75ad41ea417f
diff --git a/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.test.ts b/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.test.ts
index 60d4f3a22..d17ee48e2 100644
--- a/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.test.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.test.ts
@@ -111,6 +111,16 @@ describe("testAiPresetConnection", () => {
),
).resolves.toMatchObject({ reply: "hi" });
+ expect(request).toHaveBeenCalledWith(
+ "https://api.anthropic.com/v1/messages",
+ expect.objectContaining({
+ headers: expect.objectContaining({
+ "x-api-key": "k",
+ "anthropic-version": "2023-06-01",
+ "anthropic-dangerous-direct-browser-access": "true",
+ }),
+ }),
+ );
expect(JSON.parse(request.mock.calls[0][1]!.body as string).stream).toBe(false);
});
diff --git a/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.ts b/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.ts
index 4dbc97bea..b6f8e1426 100644
--- a/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.ts
+++ b/apps/screenpipe-app-tauri/lib/utils/ai-preset-connection.ts
@@ -52,6 +52,7 @@ const headersForPreset = (
if (preset.provider === "anthropic") {
if (preset.apiKey) headers["x-api-key"] = preset.apiKey;
headers["anthropic-version"] = "2023-06-01";
+ headers["anthropic-dangerous-direct-browser-access"] = "true";
} else if (preset.apiKey) {
headers.Authorization = `Bearer ${preset.apiKey}`;
}