Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion request-logger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ of these happened:
5. **You are on an older Codex, or following an older guide.** Codex used to
read an OPENAI_BASE_URL variable. Version 0.133.0 does not. It ignores the
variable in silence, so the only sign is an empty logs folder. Use the
command this tool prints.
command this tool prints exactly, including its quote placement.

## How much this was tested

Expand Down
11 changes: 5 additions & 6 deletions request-logger/agents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,13 @@ describe("resolveChoice — commands", () => {
it("sets the base URL for Codex on an API key", () => {
// Codex 0.133.0 has no OPENAI_BASE_URL. The flag is the only door.
expect(target("codex", "openai").command).toBe(
`codex -c 'openai_base_url="http://localhost:8787/v1"'`
`codex -c openai_base_url='http://localhost:8787/v1'`
);
});

it("sets the base URL for Codex on a ChatGPT subscription", () => {
expect(target("codex", "chatgpt").command).toBe(
`codex -c 'openai_base_url="http://localhost:8787/backend-api/codex"'`
`codex -c openai_base_url='http://localhost:8787/backend-api/codex'`
);
});

Expand Down Expand Up @@ -565,11 +565,10 @@ describe("resolveChoice — commands on win32", () => {
});

it("leaves Codex's flag-based override unchanged", () => {
// Codex has no env var override — its whole command is a `-c` flag,
// single-quoted. PowerShell parses a single-quoted literal the same way
// bash does (no interpolation), so this needs no rewriting.
// Codex has no env var override — its whole command is a `-c` flag. This
// quote placement works in PowerShell, POSIX shells, and cmd.exe.
expect(winTarget("codex", "openai").command).toBe(
`codex -c 'openai_base_url="http://localhost:8787/v1"'`
`codex -c openai_base_url='http://localhost:8787/v1'`
);
});
});
Expand Down
7 changes: 3 additions & 4 deletions request-logger/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ interface AgentEntry {
const CODEX_OVERRIDE_NOTE =
"The -c flag sets this for one run only. Your ~/.codex/config.toml is not " +
"touched, so your normal Codex is unchanged the moment you stop using this " +
"command. Keep the quotes exactly as they are: Codex reads the value as TOML, " +
"and an unquoted URL does not parse.";
"command. Keep the quotes exactly as they are.";

const PI_NOTE =
"Pi has no base URL variable and no flag. A config file is the only way to " +
Expand Down Expand Up @@ -474,7 +473,7 @@ const AGENTS: AgentEntry[] = [
// which is https://chatgpt.com/backend-api/codex.
suffix: "/backend-api/codex",
bin: "codex",
args: ["-c", `'openai_base_url="{baseUrl}"'`],
args: ["-c", "openai_base_url='{baseUrl}'"],
notes: [CODEX_OVERRIDE_NOTE],
},
{
Expand All @@ -486,7 +485,7 @@ const AGENTS: AgentEntry[] = [
// appends `responses` to it, so the base URL keeps the /v1.
suffix: "/v1",
bin: "codex",
args: ["-c", `'openai_base_url="{baseUrl}"'`],
args: ["-c", "openai_base_url='{baseUrl}'"],
// The only usable template for a custom Codex target: Codex only
// ever speaks the OpenAI-compatible wire format, so it is the
// catch-all for every choice, including "anthropic" — a mismatch
Expand Down