Skip to content

--model flag accepted but fails with "model not supported" on ChatGPT accounts #12295

@DylanOpet

Description

@DylanOpet

When using ChatGPT account authentication, the --model flag rejects provider-prefixed model names (e.g., openai-codex/gpt-5.1-codex) but accepts bare model names (e.g., gpt-5.1-codex).

The CLI accepts the provider-prefixed format at startup but fails during execution with:

ERROR: {"detail":"The 'openai-codex/gpt-5.1-codex' model is not supported when using Codex with a ChatGPT account."}

Steps to Reproduce

Environment: Codex CLI v0.104.0 with ChatGPT account authentication

# Fails: provider-prefixed format
codex exec --model openai-codex/gpt-5.1-codex "Say hello"

# Works: bare model name
codex exec --model gpt-5.1-codex "Say hello"

Expected Behavior

One of:

  1. Auto-strip prefix — Automatically strip openai-codex/ prefix when using ChatGPT account
  2. Validate upfront — Reject provider-prefixed format at parse time with helpful error
  3. Document — Clearly state that ChatGPT accounts must use bare model names (no provider prefix)

Actual Behavior

With provider prefix (openai-codex/gpt-5.1-codex):

  • ✅ CLI accepts flag
  • ✅ Session initializes
  • ⚠️ Warning: "Model metadata for openai-codex/gpt-5.1-codex not found"
  • ❌ Execution fails: "model is not supported when using Codex with a ChatGPT account"

Without prefix (gpt-5.1-codex):

  • ✅ Works perfectly

Output Comparison

FAILS:

$ codex exec --model openai-codex/gpt-5.1-codex "Say hello"
OpenAI Codex v0.104.0 (research preview)
--------
model: openai-codex/gpt-5.1-codex
provider: openai
--------
user
Say hello
mcp startup: no servers
warning: Model metadata for `openai-codex/gpt-5.1-codex` not found.
ERROR: {"detail":"The 'openai-codex/gpt-5.1-codex' model is not supported when using Codex with a ChatGPT account."}

WORKS:

$ codex exec --model gpt-5.1-codex "Say hello"
OpenAI Codex v0.104.0 (research preview)
--------
model: gpt-5.1-codex
provider: openai
--------
user
Say hello
mcp startup: no servers
thinking
**Preparing simple greeting response**
codex
Hi there!
tokens used 907

Impact

  • Confusing UX — Provider prefix accepted at parse time but rejected at execution
  • Unclear error — Error message doesn't mention the prefix issue
  • Undocumented limitation — No documentation about bare-name requirement for ChatGPT accounts
  • Breaks automation — Tools programmatically using provider-prefix format fail unexpectedly

Use Case

This affects agent orchestration tools (e.g., OpenClaw) that use provider-prefixed model names for clarity and consistency across multiple providers. The openai-codex/ prefix is a natural way to namespace models but silently fails on ChatGPT accounts.

Proposed Fix

Option 1 (Recommended): Auto-strip prefix for ChatGPT accounts:

if (authType === 'chatgpt' && args.model?.startsWith('openai-codex/')) {
  args.model = args.model.replace('openai-codex/', '');
  console.log(`Note: Stripped 'openai-codex/' prefix (ChatGPT accounts use bare model names)`);
}

Option 2: Validate upfront:

if (authType === 'chatgpt' && args.model?.includes('/')) {
  console.error('Error: ChatGPT accounts require bare model names (e.g., "gpt-5.1-codex")');
  console.error('Remove the provider prefix and try again');
  process.exit(1);
}

Option 3: Update documentation and help text to clarify this requirement.

Environment

  • Codex CLI: v0.104.0
  • Auth: ChatGPT account (confirmed via codex login status)
  • OS: macOS Darwin 25.2.0 (arm64)
  • Node: v25.5.0

Verification

Tested both formats with identical prompts:

  • openai-codex/gpt-5.1-codex → fails every time
  • gpt-5.1-codex → works every time

Same behavior across multiple OpenAI model names.


Root cause: ChatGPT account validation doesn't recognize provider-prefixed model names, but the CLI doesn't strip the prefix or reject it upfront.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingexecIssues related to the `codex exec` subcommand

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions