[CLI/TUI] Add a one-shot per-prompt model override without changing the session model

Open 💬 0 comments Opened Aug 2, 2026 by florian60430

What variant of Codex are you using?

CLI (interactive TUI)

What feature would you like to see?

Please add an explicit way to override the model for one prompt/turn only inside an already-running interactive Codex CLI session, without changing the session's selected model.

For example, if the active session model is gpt-5.6-sol, I would like to run one well-scoped prompt with gpt-5.6-luna (or gpt-5.6-terra) and have the following prompt automatically use gpt-5.6-sol again.

The exact syntax is flexible. Possible designs include:

/once --model gpt-5.6-luna Fix the typo in README.md
/model gpt-5.6-luna --once
Fix the typo in README.md

or a prompt-level flag/prefix with equivalent behavior.

Expected behavior

Given an interactive session whose active model is gpt-5.6-sol:

  1. The user explicitly selects gpt-5.6-luna for the next prompt only.
  2. Codex sends that prompt directly to Luna while preserving the current conversation and repository context.
  3. The TUI clearly shows that the turn is running on Luna.
  4. After the turn completes (or fails/is cancelled), the active session model remains Sol.
  5. An unavailable model produces a clear error instead of silently falling back.
  6. Ideally, the same one-shot mechanism can optionally override reasoning effort for that turn.

This should be a harness-level model override. It should not first send the prompt to Sol and ask Sol to spawn Luna as a subagent.

Why this is useful

Different turns within the same coding session have different cost, latency, and capability needs. A complex architecture or debugging task may justify Sol, while a tightly scoped edit, extraction, summary, or mechanical transformation may be better suited to Terra or Luna.

Codex already supports:

  • selecting a model when launching a non-interactive run, for example codex exec -m gpt-5.6-luna "...";
  • changing the active interactive-session model with /model.

However, the current interactive workflow requires switching the session model before the prompt and manually switching it back afterwards. That adds friction and makes it easy to leave the session on the wrong model.

A one-shot override would provide deterministic, user-controlled routing without opening a second Codex process, maintaining separate sessions, or paying the overhead of parent-model delegation.

Possible acceptance criteria
  • A documented CLI/TUI command or flag selects the model for exactly one submitted prompt.
  • The previous session model is restored automatically after success, failure, or cancellation.
  • The effective model is visible before/during the turn and in /status or the transcript.
  • Conversation context, working directory, sandbox, and approval settings are preserved.
  • The request is routed directly by the Codex harness, not through a subagent.
  • Optional: allow a one-shot reasoning-effort override alongside the model.
  • Add tests confirming that the next ordinary prompt uses the original session model.

Additional information

Related but distinct requests:

  • #32961 asks for skills or user commands to declare their own model. This request applies to any ad hoc prompt and does not require defining a skill or command first.
  • #23859 asks to allow model selection after composing a prompt. This request additionally requires the override to apply to one turn only and automatically restore the session model.

The documented model names used above are current Codex examples: gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna.

View original on GitHub ↗