🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
feat(ai-gateway): simplify Codex setup to an exported key and config.toml (#19655)
Tobias Wochingeraed89a3225a5
diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/AGENTS.md b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/AGENTS.mdindex c3ff57aff6..f8d94e2dfd 100644--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/AGENTS.md+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/AGENTS.md@@ -18,7 +18,7 @@ Do not add steps, paths or env vars that the docs do not describe.## Rules- Builders never receive the secret key; they emit `GATEWAY_KEY_PLACEHOLDER`. Right after creation, `StepCodeSection` swaps it for the key at render time (masked until revealed, copied in full). Without a key, `AgentSetupSteps` adds a replace-the-placeholder hint, so step descriptions must not mention the placeholder themselves. "Copy for agent" keeps the placeholder.-- Prefix shell lines that set or write the key (`export`, the Codex heredoc) with a space so shells with `ignorespace` / `HIST_IGNORE_SPACE` skip them in history. Also prefix the first line of every key-bearing snippet: a bracketed multi-line paste is saved as one history entry, and only its first character counts.+- Prefix shell lines that set the key (`export`) with a space so shells with `ignorespace` / `HIST_IGNORE_SPACE` skip them in history. Also prefix the first line of every key-bearing snippet: a bracketed multi-line paste is saved as one history entry, and only its first character counts.- Paths differ per tool (`/anthropic` vs `/anthropic/v1`); keep them as each integration page lists them.- Builders are pure: `(context: AgentSetupContext) => AgentSetupInstructions`.`formatAgentSetupMarkdown` renders the same data for "Copy for agent".diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.tsindex 9363dec97d..48aa8daffe 100644--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/__tests__/agentSetupInstructions.clienttest.ts@@ -62,9 +62,7 @@ describe("agent setup instructions", () => {const firstLine = step.code.includes(GATEWAY_KEY_PLACEHOLDER)? [lines[0]]: [];- const keyLines = lines.filter(- (line) => line.includes("export ") || line.includes("cat >>"),- );+ const keyLines = lines.filter((line) => line.includes("export "));for (const line of [...firstLine, ...keyLines]) {expect(line).toMatch(/^ \S/);diff --git a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/buildCodexInstructions.ts b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/buildCodexInstructions.tsindex 18ce0abf0b..9ecadd9116 100644--- a/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/buildCodexInstructions.ts+++ b/web/src/features/ai-gateway/components/GatewayApiKeysPage/components/SetupInstructions/fns/agentSetupInstructions/buildCodexInstructions.ts@@ -22,22 +22,16 @@ export function buildCodexInstructions(: "Codex needs an OpenAI provider credential, and none is enabled yet.",steps: [{- title: "Store the key in Codex's .env",- description: "Codex loads this file every time it starts.",+ title: "Export the gateway key",+ description:+ "Codex reads the key from this variable on every start. Add the line to your shell profile, for example ~/.zshrc, so new terminals have it too.",language: "sh",- code: [- ' CODEX_DIR="${CODEX_HOME:-$HOME/.codex}"',- 'mkdir -p -m 700 "$CODEX_DIR"',- 'touch "$CODEX_DIR/.env" && chmod 600 "$CODEX_DIR/.env"',- ` cat >> "$CODEX_DIR/.env" <<'EOF'`,- `LANGFUSE_GATEWAY_KEY=${GATEWAY_KEY_PLACEHOLDER}`,- "EOF",- ].join("\n"),+ code: ` export LANGFUSE_GATEWAY_KEY="${GATEWAY_KEY_PLACEHOLDER}"`,},{title: "Add the gateway provider",description:- "Add this to the top of config.toml in the same directory ($CODEX_HOME, or ~/.codex by default), before any [table] section, so model_provider stays a top-level key.",+ "Add this to the top of ~/.codex/config.toml ($CODEX_HOME/config.toml if you set CODEX_HOME), before any [table] section, so model_provider stays a top-level key.",language: "toml",code: ['model_provider = "langfuse"',