Skip to content

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

feat(ai-gateway): update Claude Desktop setup steps and merge Claude tabs (#19298)

Tobias Wochingerb1f9381e7847
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/GeneratedKeyContent.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/GeneratedKeyContent.tsx
index fd3012cfd0..aa5d475026 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/GeneratedKeyContent.tsx
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/GeneratedKeyContent.tsx
@@ -5,24 +5,27 @@ import { SiClaude, SiOpenai } from "@langfuse/icons/si";
import { Alert } from "@/src/components/design-system/Alert/Alert";
import { Button } from "@/src/components/design-system/Button/Button";
import { Dialog } from "@/src/components/design-system/Dialog/Dialog";
-import { ExpandableContentPeek } from "@/src/components/design-system/ExpandableContentPeek/ExpandableContentPeek";
import { Tabs } from "@/src/components/design-system/Tabs/Tabs";
import { Skeleton } from "@/src/components/ui/skeleton";
import type { AgentSetupInstructions } from "@/src/features/ai-gateway/types/agentSetupInstructions";
-import { AgentSetupSteps } from "./components/AgentSetupSteps";
-import { CopyForAgentButton } from "./components/CopyForAgentButton";
+import { AgentInstructionsPanel } from "@/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentInstructionsPanel";
+import {
+ ClaudeSetupTabs,
+ type ClaudeAgentId,
+} from "@/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/ClaudeSetupTabs";
import { MaskedGatewayKey } from "./components/MaskedGatewayKey";
import { useAgentSetupInstructions } from "./hooks/useAgentSetupInstructions";
-const DEFAULT_TAB: AgentSetupInstructions["id"] = "api";
+type TabId = Exclude<AgentSetupInstructions["id"], ClaudeAgentId> | "claude";
-const TAB_ICONS: Record<AgentSetupInstructions["id"], IconComponent> = {
- api: Braces,
- "claude-desktop": SiClaude,
- "claude-code": SiClaude,
- codex: SiOpenai,
- opencode: SquareTerminal,
-};
+const DEFAULT_TAB: TabId = "api";
+
+const TABS: { id: TabId; label: string; icon: IconComponent }[] = [
+ { id: "api", label: "API", icon: Braces },
+ { id: "claude", label: "Claude", icon: SiClaude },
+ { id: "codex", label: "Codex", icon: SiOpenai },
+ { id: "opencode", label: "OpenCode", icon: SquareTerminal },
+];
type SetupInstructionsProps = {
organizationId: string;
@@ -32,6 +35,8 @@ function SetupInstructions({ organizationId }: SetupInstructionsProps) {
const { instructions, isPending, isError } =
useAgentSetupInstructions(organizationId);
const [activeTab, setActiveTab] = useState<string>(DEFAULT_TAB);
+ const [claudeVariant, setClaudeVariant] =
+ useState<ClaudeAgentId>("claude-code");
if (isPending) {
return <Skeleton className="h-48 w-full" />;
@@ -47,8 +52,11 @@ function SetupInstructions({ organizationId }: SetupInstructionsProps) {
);
}
+ const findEntry = (id: string) =>
+ instructions.find((entry) => entry.id === id);
const activeEntry =
- instructions.find((entry) => entry.id === activeTab) ?? instructions[0];
+ findEntry(activeTab === "claude" ? claudeVariant : activeTab) ??
+ instructions[0];
return (
<div className="flex flex-col gap-2">
@@ -77,29 +85,39 @@ function SetupInstructions({ organizationId }: SetupInstructionsProps) {
overflow="menu"
aria-label="Setup instructions"
>
- {instructions.map((entry) => (
+ {TABS.map((tab) => (
<Tabs.Trigger
- key={entry.id}
- value={entry.id}
- label={entry.label}
- icon={TAB_ICONS[entry.id]}
+ key={tab.id}
+ value={tab.id}
+ label={tab.label}
+ icon={tab.icon}
/>
))}
</Tabs.List>
</div>
- {instructions.map((entry) => (
- <Tabs.Content key={entry.id} value={entry.id}>
- <div className="flex flex-col items-start gap-3 pt-4">
- <CopyForAgentButton instructions={entry} />
- {/* Inactive tabs unmount, so switching tabs collapses the peek again. */}
- <div className="w-full">
- <ExpandableContentPeek expandLabel="Show all steps">
- <AgentSetupSteps instructions={entry} />
- </ExpandableContentPeek>
+ {TABS.map((tab) => {
+ if (tab.id === "claude") {
+ return (
+ <Tabs.Content key={tab.id} value={tab.id}>
+ <div className="pt-4">
+ <ClaudeSetupTabs
+ instructions={instructions}
+ value={claudeVariant}
+ onValueChange={setClaudeVariant}
+ />
+ </div>
+ </Tabs.Content>
+ );
+ }
+ const entry = findEntry(tab.id);
+ return entry ? (
+ <Tabs.Content key={tab.id} value={tab.id}>
+ <div className="pt-4">
+ <AgentInstructionsPanel instructions={entry} />
</div>
- </div>
- </Tabs.Content>
- ))}
+ </Tabs.Content>
+ ) : null;
+ })}
</Tabs>
</div>
);
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentInstructionsPanel.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentInstructionsPanel.tsx
new file mode 100644
index 0000000000..6ba445620e
--- /dev/null
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentInstructionsPanel.tsx
@@ -0,0 +1,24 @@
+import { ExpandableContentPeek } from "@/src/components/design-system/ExpandableContentPeek/ExpandableContentPeek";
+import type { AgentSetupInstructions } from "@/src/features/ai-gateway/types/agentSetupInstructions";
+import { AgentSetupSteps } from "./AgentSetupSteps";
+import { CopyForAgentButton } from "./CopyForAgentButton";
+
+type AgentInstructionsPanelProps = {
+ instructions: AgentSetupInstructions;
+};
+
+export function AgentInstructionsPanel({
+ instructions,
+}: AgentInstructionsPanelProps) {
+ return (
+ <div className="flex flex-col items-start gap-3">
+ <CopyForAgentButton instructions={instructions} />
+ {/* Inactive tabs unmount, so switching tabs collapses the peek again. */}
+ <div className="w-full">
+ <ExpandableContentPeek expandLabel="Show all steps">
+ <AgentSetupSteps instructions={instructions} />
+ </ExpandableContentPeek>
+ </div>
+ </div>
+ );
+}
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentSetupSteps.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentSetupSteps.tsx
index 80a5f7824c..481bfabe64 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentSetupSteps.tsx
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/AgentSetupSteps.tsx
@@ -1,4 +1,5 @@
import { Alert } from "@/src/components/design-system/Alert/Alert";
+import { Button } from "@/src/components/design-system/Button/Button";
import { CodeSection } from "@/src/components/design-system/CodeSection/CodeSection";
import { Stepper } from "@/src/components/design-system/Stepper/Stepper";
import type { AgentSetupInstructions } from "@/src/features/ai-gateway/types/agentSetupInstructions";
@@ -21,7 +22,20 @@ export function AgentSetupSteps({ instructions }: AgentSetupStepsProps) {
key={step.title}
number={index + 1}
title={step.title}
- description={step.description}
+ description={
+ step.link ? (
+ <>
+ {step.description}{" "}
+ <Button
+ variant="text"
+ text={step.link.label}
+ href={step.link.href}
+ />
+ </>
+ ) : (
+ step.description
+ )
+ }
variant="outline"
size="sm"
isCollapsible={false}
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/ClaudeSetupTabs.tsx b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/ClaudeSetupTabs.tsx
new file mode 100644
index 0000000000..0efa16ce42
--- /dev/null
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/components/ClaudeSetupTabs.tsx
@@ -0,0 +1,58 @@
+import { Tabs } from "@/src/components/design-system/Tabs/Tabs";
+import type { AgentSetupInstructions } from "@/src/features/ai-gateway/types/agentSetupInstructions";
+import { AgentInstructionsPanel } from "./AgentInstructionsPanel";
+
+const CLAUDE_VARIANTS: { id: ClaudeAgentId; label: string }[] = [
+ { id: "claude-code", label: "Code" },
+ { id: "claude-desktop", label: "Desktop" },
+];
+
+function isClaudeAgentId(value: string): value is ClaudeAgentId {
+ return CLAUDE_VARIANTS.some((variant) => variant.id === value);
+}
+
+type ClaudeSetupTabsProps = {
+ instructions: AgentSetupInstructions[];
+ value: ClaudeAgentId;
+ onValueChange: (value: ClaudeAgentId) => void;
+};
+
+/** Claude Code and Claude Desktop share one tab, with a switch between them. */
+export function ClaudeSetupTabs({
+ instructions,
+ value,
+ onValueChange,
+}: ClaudeSetupTabsProps) {
+ const handleValueChange = (next: string) => {
+ if (isClaudeAgentId(next)) onValueChange(next);
+ };
+
+ return (
+ <Tabs value={value} onValueChange={handleValueChange}>
+ <Tabs.List variant="inset" size="sm" aria-label="Claude app">
+ {CLAUDE_VARIANTS.map((variant) => (
+ <Tabs.Trigger
+ key={variant.id}
+ value={variant.id}
+ label={variant.label}
+ />
+ ))}
+ </Tabs.List>
+ {CLAUDE_VARIANTS.map((variant) => {
+ const entry = instructions.find((e) => e.id === variant.id);
+ return entry ? (
+ <Tabs.Content key={variant.id} value={variant.id}>
+ <div className="pt-3">
+ <AgentInstructionsPanel instructions={entry} />
+ </div>
+ </Tabs.Content>
+ ) : null;
+ })}
+ </Tabs>
+ );
+}
+
+export type ClaudeAgentId = Extract<
+ AgentSetupInstructions["id"],
+ "claude-code" | "claude-desktop"
+>;
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildAgentSetupInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildAgentSetupInstructions.ts
index e3246dfbe3..cd031d5644 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildAgentSetupInstructions.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/buildAgentSetupInstructions.ts
@@ -5,12 +5,12 @@ import { buildClaudeDesktopInstructions } from "./buildClaudeDesktopInstructions
import { buildCodexInstructions } from "./buildCodexInstructions";
import { buildOpenCodeInstructions } from "./buildOpenCodeInstructions";
-/** Tab order of the "Gateway key created" dialog. */
+/** One entry per tool in the "Gateway key created" dialog. */
export function buildAgentSetupInstructions(context: AgentSetupContext) {
return [
buildApiInstructions(context),
- buildClaudeDesktopInstructions(context),
buildClaudeCodeInstructions(context),
+ buildClaudeDesktopInstructions(context),
buildCodexInstructions(context),
buildOpenCodeInstructions(context),
];
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 a2b84e48e4..0ada90520a 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
@@ -29,8 +29,7 @@ export function buildClaudeCodeInstructions(
},
{
title: "Point Claude Code at the gateway",
- description:
- "No /v1 in the base URL. Claude Code appends it. Leave ANTHROPIC_API_KEY unset.",
+ description: "Leave ANTHROPIC_API_KEY unset.",
language: "sh",
code: [
`export ANTHROPIC_BASE_URL="${context.gatewayOrigin}/anthropic"`,
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 814c475163..934ffea8e3 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
@@ -23,9 +23,18 @@ export function buildClaudeDesktopInstructions(
description:
"Open Developer → Configure Third-Party Inference and set Inference provider to Gateway. If the Developer menu is missing, enable Developer Mode under Help → Troubleshooting.",
},
+ {
+ title: "Optional: keep your claude.ai chats",
+ description:
+ "Gateway mode uses a separate profile. To keep your existing chats and sessions, turn on Claude.ai data import under Capabilities. After restarting, use Settings → Import & export.",
+ link: {
+ label: "Import and export docs",
+ href: "https://claude.com/docs/third-party/claude-desktop/import",
+ },
+ },
{
title: "Set the gateway base URL",
- description: "No /v1 in the base URL. Claude Desktop appends it.",
+ description: "Paste this URL exactly as shown.",
language: "text",
code: `${context.gatewayOrigin}/anthropic`,
},
@@ -36,14 +45,25 @@ export function buildClaudeDesktopInstructions(
},
{
title: "Add the user header",
- description: "Under Custom headers, add this header.",
+ description: "Under Custom headers, add a header with this name.",
language: "text",
- code: `langfuse-user-id: ${context.userId}`,
+ 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:
+ "Under Capabilities → General restrictions, we recommend adding \"*\" to Allowed egress hosts. Otherwise, Claude can't reach websites or services outside the gateway, such as GitHub, and won't ask for permission.",
},
{
title: "Apply and restart",
description:
- "Test the connection, select Apply Changes, then Save & Restart.",
+ "Test the connection, select Apply Changes, then Save & Restart. Start a new session so the egress settings apply.",
},
],
};
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/formatAgentSetupMarkdown.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/formatAgentSetupMarkdown.ts
index 0f20b5a711..bb9233e413 100644
--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/formatAgentSetupMarkdown.ts
+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/GeneratedKeyContent/fns/agentSetupInstructions/formatAgentSetupMarkdown.ts
@@ -7,6 +7,7 @@ export function formatAgentSetupMarkdown(instructions: AgentSetupInstructions) {
[
`## ${index + 1}. ${step.title}`,
step.description,
+ step.link ? `[${step.link.label}](${step.link.href})` : undefined,
step.code === undefined
? undefined
: `\`\`\`${step.language}\n${step.code}\n\`\`\``,
diff --git a/web/src/features/ai-gateway/types/agentSetupInstructions.ts b/web/src/features/ai-gateway/types/agentSetupInstructions.ts
index 4d6f6622d5..8b40a0b585 100644
--- a/web/src/features/ai-gateway/types/agentSetupInstructions.ts
+++ b/web/src/features/ai-gateway/types/agentSetupInstructions.ts
@@ -13,6 +13,8 @@ export type AgentSetupContext = {
export type AgentSetupStep = {
title: string;
description?: string;
+ /** External docs link shown after the description. */
+ link?: { label: string; href: string };
} & (
| { language: "sh" | "toml" | "json" | "text"; code: string }
/** A step done in a settings UI, with nothing to paste. */