CLI converts gpt-5-direct model name to gpt-5 in HTTP requests

Resolved 💬 1 comment Opened Sep 10, 2025 by DivyanshGolyan Closed Nov 9, 2025

What version of Codex is running?

codex-cli 0.31.0 (Node.js version via npm)

Which model were you using?

gpt-5-direct

What platform is your computer?

macOS (Darwin 24.5.0 arm64)

What steps can reproduce the bug?

  1. Install Codex CLI via npm: npm install -g @openai/codex
  2. Run with gpt-5-direct model: codex -m "gpt-5-direct" "test message"
  3. Observe debug logs with RUST_LOG=trace

What is the expected behavior?

When specifying -m "gpt-5-direct", the CLI should:

  • Parse CLI argument correctly: gpt-5-direct
  • Preserve model name through config resolution: gpt-5-direct
  • Send HTTP request with exact model name: {"model":"gpt-5-direct"}

What do you see instead?

The CLI incorrectly normalizes gpt-5-direct to gpt-5 somewhere in the processing pipeline:

Debug log evidence:

[2025-09-10T07:29:09] OpenAI Codex v0.31.0 (research preview)
--------
model: gpt-5    // ❌ Should be gpt-5-direct
--------
DEBUG codex_core::codex: Configuring session: model=gpt-5    // ❌ Should be gpt-5-direct
TRACE codex_core::client: POST to https://api.labs.dreamplug.net/v1/responses: {"model":"gpt-5"}    // ❌ Should be gpt-5-direct

Root cause analysis:

  • CLI argument parsing works correctly (can be verified with debug logging)
  • Model family mapping is correct: gpt-5-direct should map to family gpt-5 while preserving the original slug gpt-5-direct
  • Bug occurs during model name resolution, likely in config loading or session initialization

Additional information

Impact: Users cannot access gpt-5-direct model through the CLI, as requests are sent to gpt-5 instead.

Version comparison:

  • Node.js version (0.31.0): ❌ Has this bug
  • Rust development version (0.0.0): ✅ Works correctly (preserves gpt-5-direct)

Workaround: Use the Rust development build: ./target/debug/codex-exec -m "gpt-5-direct"

Similar issues: This might be related to #2840 (VS Code extension model name issues), but that's specific to the extension, not CLI.

Debug logs comparison:

Node.js version (buggy):

model: gpt-5
Configuring session: model=gpt-5
POST: {"model":"gpt-5"}

Rust version (correct):

model: gpt-5-direct
Configuring session: model=gpt-5-direct  
POST: {"model":"gpt-5-direct"}

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗