GrepBoard/Manuals
605 manuals ·

Switch Codex CLI Model and Reasoning Effort with Profiles

·Tested on Codex CLI 0.163.0 · Ubuntu 24.04 · Node 24·Test scope ↓·7 steps

Create <name>.config.toml profile files in Codex CLI 0.163.0, switch between fast and deep setups with --profile, and see the legacy error and override order.

You have [profiles.fast] in config.toml, and --profile fast stops with this:

output
Error loading config.toml: --profile `fast` cannot be used while ~/.codex/config.toml contains legacy `profile = "fast"` or `[profiles.fast]` config; move those settings into ~/.codex/fast.config.toml and remove the legacy profile selector/table. See https://developers.openai.com/codex/config-advanced#profiles for more information.

Per the official docs, profiles have been separate files rather than tables in config.toml since 0.134.0 (docs). The steps below build a fast and a deep profile the new way and switch between them.

[1] Check the version. Below 0.134.0 the old table syntax still works and these steps don't apply.

console
$ codex --versioncodex-cli 0.163.0

[2] List the models and reasoning efforts in the installed catalog. The effort values differ per model.

console
$ codex debug models > models.json$ python3 -c 'import jsonfor m in json.load(open("models.json"))["models"]:    print(m["slug"], m["default_reasoning_level"], [x["effort"] for x in m["supported_reasoning_levels"]])' | grep -E "^(gpt-5.5|gpt-6-luna) "gpt-6-luna medium ['low', 'medium', 'high', 'xhigh', 'max']gpt-5.5 medium ['low', 'medium', 'high', 'xhigh']

[3] Keep the defaults in config.toml. A profile only needs the keys that differ.

~/.codex/config.toml
model = "gpt-5.5"model_reasoning_effort = "medium"

[4] Create one ~/.codex/<name>.config.toml per profile. Put keys at the top level; don't wrap them in [profiles.name].

~/.codex/fast.config.toml
model_reasoning_effort = "low"
~/.codex/deep.config.toml
model_reasoning_effort = "xhigh"

[5] Select one with --profile (short form -p). To see whether it applied, read the header exec prints at startup.

console
$ codex --profile deep exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-5.5reasoning effort: xhigh$ codex -p fast exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-5.5reasoning effort: low

Without a profile the same header shows reasoning effort: medium. The interactive codex --profile deep reads the profile the same way.

[6] To change something for one run only, override it on the command line: -m for the model, -c key=value for any other key. The docs say to prefer a dedicated flag when one exists.

console
$ codex --profile fast -c model_reasoning_effort=high exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-5.5reasoning effort: high$ codex --profile fast -m gpt-6-luna exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-6-lunareasoning effort: low

Layers apply in this order; a lower row is overridden by the rows above it.

RankLayerBasis
1Command line (-m, -c, …)tested
2Project .codex/config.tomldocs
3<name>.config.tomltested · docs
4~/.codex/config.tomltested · docs

[7] Watch for typos. A profile name that doesn't exist raises no error; Codex starts with the base settings.

console
$ codex --profile fats exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-5.5reasoning effort: medium

A mistyped effort value isn't rejected at startup either. model_reasoning_effort = "turbo" was printed as reasoning effort: turbo in the header, and what a later request does with it couldn't be checked without a login. Use only values from step 2, and read the step 5 header once after creating a profile.

A name containing path characters is refused.

console
$ codex --profile ../x exec "hi"error: invalid value '../x' for '--profile <CONFIG_PROFILE_V2>': invalid --profile value `../x`; pass a plain name such as `work`

Approval policy and sandbox mode can go in a profile file too. What those values control is covered in Fix Codex CLI approval policy and sandbox settings.

#codex#configuration#profiles