Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

chore(ai-gateway): drop user-id header from gateway setup instructions (#19445)

Tobias Wochinger6527062d066d
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/SetupInstructionsTabs/SetupInstructionsTabs.stories.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/SetupInstructionsTabs/SetupInstructionsTabs.stories.tsx
index b0df5fcb2a..28da61a574 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/SetupInstructionsTabs/SetupInstructionsTabs.stories.tsx
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/SetupInstructionsTabs/SetupInstructionsTabs.stories.tsx
@@ -6,7 +6,6 @@ import { SetupInstructionsTabs } from "./SetupInstructionsTabs";
const context = {
gatewayOrigin: "https://cloud.langfuse.com",
- userId: "[email protected]",
};
const meta = preview.meta({ component: SetupInstructionsTabs });
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/AGENTS.md b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/AGENTS.md
index 7063347d9f..66f23ebf65 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/AGENTS.md
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/AGENTS.md
@@ -18,7 +18,6 @@ Do not add steps, paths or env vars that the docs do not describe.
- Never put the secret key into a snippet. Use `GATEWAY_KEY_PLACEHOLDER`; the
key is shown and copied only by the key field above the tabs.
-- Snippets set only `langfuse-user-id` from the recommended headers.
- Paths differ per tool (`/anthropic` vs `/anthropic/v1`); keep them as the
docs list them under "Base URLs at a glance".
- Builders are pure: `(context: AgentSetupContext) => AgentSetupInstructions`.
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts
index 1cd4062c3a..6fc48b4257 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts
@@ -6,7 +6,6 @@ import { formatAgentSetupMarkdown } from "../formatAgentSetupMarkdown";
const context = {
gatewayOrigin: "https://gateway.example.com",
- userId: "[email protected]",
providers: ["ANTHROPIC" as const],
};
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeCodeInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeCodeInstructions.ts
index 0ada90520a..c70b37a1df 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeCodeInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeCodeInstructions.ts
@@ -35,7 +35,6 @@ export function buildClaudeCodeInstructions(
`export ANTHROPIC_BASE_URL="${context.gatewayOrigin}/anthropic"`,
`export ANTHROPIC_AUTH_TOKEN="${GATEWAY_KEY_PLACEHOLDER}"`,
"unset ANTHROPIC_API_KEY",
- `export ANTHROPIC_CUSTOM_HEADERS="langfuse-user-id: ${context.userId}"`,
].join("\n"),
},
{
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeDesktopInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeDesktopInstructions.ts
index 934ffea8e3..a79b662785 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeDesktopInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildClaudeDesktopInstructions.ts
@@ -43,18 +43,6 @@ export function buildClaudeDesktopInstructions(
description:
"Set Credential kind to Static API key, paste your gateway key as Gateway API key, and select Bearer as the auth scheme.",
},
- {
- title: "Add the user header",
- description: "Under Custom headers, add a header with this name.",
- language: "text",
- code: "langfuse-user-id",
- },
- {
- title: "Set the header value",
- description: "Enter your email or handle as its value.",
- language: "text",
- code: context.userId,
- },
{
title: "Allow egress hosts",
description:
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildCodexInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildCodexInstructions.ts
index 0f71d462c3..d0b4efe4f2 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildCodexInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildCodexInstructions.ts
@@ -32,7 +32,6 @@ export function buildCodexInstructions(
'touch "$CODEX_DIR/.env" && chmod 600 "$CODEX_DIR/.env"',
`cat >> "$CODEX_DIR/.env" <<'EOF'`,
`LANGFUSE_GATEWAY_KEY=${GATEWAY_KEY_PLACEHOLDER}`,
- `LF_USER_ID=${context.userId}`,
"EOF",
].join("\n"),
},
@@ -49,7 +48,6 @@ export function buildCodexInstructions(
`base_url = "${context.gatewayOrigin}/openai/v1"`,
'env_key = "LANGFUSE_GATEWAY_KEY"',
'wire_api = "responses"',
- 'env_http_headers = { "langfuse-user-id" = "LF_USER_ID" }',
].join("\n"),
},
{
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildOpenCodeInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildOpenCodeInstructions.ts
index 85f746cc95..101c6bfdb6 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildOpenCodeInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildOpenCodeInstructions.ts
@@ -32,7 +32,6 @@ export function buildOpenCodeInstructions(
baseURL: `${context.gatewayOrigin}${OPENCODE_PROVIDERS[provider].path}`,
apiKey: "{env:LANGFUSE_GATEWAY_KEY}",
},
- headers: { "langfuse-user-id": context.userId },
},
]),
),
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/hooks/useAgentSetupInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/hooks/useAgentSetupInstructions.ts
index 14c22c347a..d99198f3b1 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/hooks/useAgentSetupInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/hooks/useAgentSetupInstructions.ts
@@ -1,29 +1,15 @@
-import { useSession } from "next-auth/react";
-
-import { GATEWAY_USER_ID_PLACEHOLDER } from "@/src/features/ai-gateway/constants/agentSetupInstructions";
import { buildAgentSetupInstructions } from "@/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildAgentSetupInstructions";
import { api } from "@/src/utils/api";
-/** Characters that would need escaping in a shell, TOML or JSON string. */
-const UNSAFE_SNIPPET_CHARACTERS = /["'`$\\\s]/;
-
export function useAgentSetupInstructions(organizationId: string) {
- const { data: session } = useSession();
const clientSetup = api.aiGateway.getClientSetup.useQuery({
orgId: organizationId,
});
- const email = session?.user?.email;
- const userId =
- email && !UNSAFE_SNIPPET_CHARACTERS.test(email)
- ? email
- : GATEWAY_USER_ID_PLACEHOLDER;
-
return {
instructions: clientSetup.data
? buildAgentSetupInstructions({
gatewayOrigin: new URL(clientSetup.data.gatewayBaseUrl).origin,
- userId,
providers: clientSetup.data.providers,
})
: undefined,
diff --git a/web/src/features/ai-gateway/constants/agentSetupInstructions.ts b/web/src/features/ai-gateway/constants/agentSetupInstructions.ts
index 832bdeae69..e368d2d19d 100644
--- a/web/src/features/ai-gateway/constants/agentSetupInstructions.ts
+++ b/web/src/features/ai-gateway/constants/agentSetupInstructions.ts
@@ -1,7 +1,6 @@
import { GATEWAY_DOCS_URL } from "./gatewayDocsUrls";
export const GATEWAY_KEY_PLACEHOLDER = "<your-gateway-key>";
-export const GATEWAY_USER_ID_PLACEHOLDER = "<you>@example.com";
export const AGENT_SETUP_DOCS_URLS = {
api: `${GATEWAY_DOCS_URL}/get-started`,
diff --git a/web/src/features/ai-gateway/types/agentSetupInstructions.ts b/web/src/features/ai-gateway/types/agentSetupInstructions.ts
index 8b40a0b585..43bcf06235 100644
--- a/web/src/features/ai-gateway/types/agentSetupInstructions.ts
+++ b/web/src/features/ai-gateway/types/agentSetupInstructions.ts
@@ -4,8 +4,6 @@ import type { GatewayProvider } from "@/src/features/ai-gateway/types/gatewayPro
export type AgentSetupContext = {
/** Gateway origin without a path, e.g. `https://staging.langfuse.com`. */
gatewayOrigin: string;
- /** Sent as `langfuse-user-id`; already safe to embed in shell, TOML and JSON strings. */
- userId: string;
/** Providers with an enabled connection in the organization. */
providers: GatewayProvider[];
};