Switch Codex CLI Model and Reasoning Effort with Profiles
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:
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.
$ codex --versioncodex-cli 0.163.0[2] List the models and reasoning efforts in the installed catalog. The effort values differ per model.
$ 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.
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].
model_reasoning_effort = "low"model_reasoning_effort = "xhigh"[5] Select one with --profile (short form -p). To see whether it applied, read the header exec prints at startup.
$ 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: lowWithout 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.
$ 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: lowLayers apply in this order; a lower row is overridden by the rows above it.
| Rank | Layer | Basis |
|---|---|---|
| 1 | Command line (-m, -c, …) | tested |
| 2 | Project .codex/config.toml | docs |
| 3 | <name>.config.toml | tested · docs |
| 4 | ~/.codex/config.toml | tested · docs |
[7] Watch for typos. A profile name that doesn't exist raises no error; Codex starts with the base settings.
$ codex --profile fats exec "hi" 2>&1 | grep -aE '^(model|reasoning effort):'model: gpt-5.5reasoning effort: mediumA 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.
$ 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.