Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Codex CLI Model Selection

Codex CLI Model Selection

Codex supports many AI models, each with its own characteristics in speed, capability, and cost. This section explains in detail how to choose the right model.


Available models

Recommended model

Model Feature Applicable scenarios
gpt-5.4 The latest flagship model with the strongest coding ability Complex software engineering and professional work
gpt-5.4-mini A fast, efficient lightweight model Responsive coding tasks and subagents
gpt-5.3-codex An industry-leading coding model Complex software engineering tasks

For most Codex tasks, it's recommended to start with gpt-5.4. It combines powerful coding, reasoning, native computer use, and a broader range of professional workflows in a single model.

Alternative models

Model Feature Applicable scenarios
gpt-5.2 A general-purpose model previously used for coding and agent tasks Complex debugging tasks that require deep thinking

Selection recommendations

Everyday coding tasks

Use gpt-5.4 Use it as the default. It performs excellently across a wide range of coding tasks.

Simple/quick tasks

Use gpt-5.4-mini When you want a faster, lower-cost option for lightweight coding tasks or subagents.

Complex reasoning tasks

When facing difficult debugging tasks that require deep thought, you can try gpt-5.2。


Configure the default model

You can set the default model in the configuration file:

Configure the default model

~/.codex/config.toml

Set the default model

model = "gpt-5.4"

If no model is specified, the Codex app, CLI, or IDE extension uses the recommended model by default.


Temporarily change the model

Use command-line arguments

Specify the model on the command line

Launch with a specific model

codex

-m

gpt-

5.4

Use the exec command

codex

exec

-m

gpt-

5.4

"fix this bug"

Switch within a session

Switch models within a session

Type in Codex

/

model gpt-

5.4

-mini

Or use the /model command

/

model gpt-

5.2

Switch in the IDE extension

In the IDE extension, use the model selector below the input box to switch models.


Reasoning configuration

Codex supports adjusting the reasoning effort:

Configuration values Description
minimal Minimal reasoning
low Low reasoning
medium Medium reasoning (default)
high High reasoning
xhigh Very high reasoning (depends on the model)

Configure reasoning effort

Configure the default reasoning effort

model_reasoning_effort = "medium"

Set a specific reasoning effort for plan mode

plan_mode_reasoning_effort = "high"

A higher reasoning effort produces more thoughtful responses but may be slower and consume more resources.


Reasoning summaries

You can control the level of detail in reasoning summaries:

Configuration values Description
auto Automatic
concise Concise summary
detailed Detailed summary
none Disable summaries

Configure reasoning summaries

Select the reasoning summary detail level

model_reasoning_summary = "auto"


Custom model providers

In addition to OpenAI models, you can configure other model providers:

Configure a custom provider

[model_providers.custom]

Provider display name

name = "My Custom Provider"

API base URL

base_url = "https://api.example.com/v1"

API key environment variable

env_key = "CUSTOM_PROVIDER_API_KEY"

Other configuration

http_headers = {

    "X-Custom-Header": "value"

}

Any model or provider that supports the Chat Completions or Responses API is supported.


Service tiers

Codex supports different service tiers:

Service tiers Description
flex Flex tier, optimized for cost
fast Fast tier, prioritizing speed

Configure the service tier

Set the preferred service tier

service_tier = "fast"


Model selection best practices

Starting a new project

Use gpt-5.4 for the best overall experience.

Simple tasks

Use gpt-5.4-mini to save costs.

Complex debugging

Consider using gpt-5.2 for in-depth debugging.

subagent

Subagent usage gpt-5.4-mini to improve efficiency.

Check for updates regularly, as new models and improvements are continuously released.


Common questions

Q: Which model is best for everyday coding?

gpt-5.4 is the best choice for everyday coding tasks, offering a balance of strong capability and reasonable speed.

Q: Why is a mini model recommended for subagents?

Subagents perform simpler tasks, which a mini model can complete faster while saving costs.

Q: Can I use my own model?

Yes, you can configure model_providers to use any model that supports the Responses API.

Q: Does model selection affect cost?

Yes, different models have different pricing. Check the pricing page for details.