AI 해결 노트 · 2026-09-17 · 실측 2026-09-17

설정 파일 안 건드리고 Codex CLI 모델 바꾸기 — codex exec -m, -c model= 윈도우 실측

한 줄로

한 번만 다른 모델로 돌리려면 codex exec -m <모델>을 씁니다. -c model="<모델>"도 같은 결과를 냈고, 둘을 함께 준 실행에서는 -m 값이 머리말에 찍혔습니다. 모델 이름은 codex debug models로 목록을 볼 수 있고, 없는 이름을 주면 머리말에는 그 이름이 그대로 찍힌 채 400 오류와 종료 코드 1로 끝났습니다.

이런 분께

실측 환경

항목
OSWindows 11 Home (10.0.26200)
Git Bash
codexcodex-cli 0.153.4
로그인ChatGPT 계정(5회차 오류 문구 기준)
질문Reply with the single word OK. (1~5회차 같음)
공통 옵션--skip-git-repo-check, 모든 실행에 < /dev/null(stdin이 바로 끝나게 함). 1~5회차는 --ephemeral -s read-only, 6회차 첫 실행은 -s read-only(이어 간 실행은 -s 없이, 머리말은 sandbox: read-only)

사용자 설정 파일 ~/.codex/config.toml은 열지도 고치지도 않았습니다. 기본 모델이 어디서 정해졌는지는 아래 「확인하지 않은 것」에 적었습니다.

도움말과 공식 문서

codex exec --help에 두 가지 방법이 모두 있습니다.

  -c, --config <key=value>
          Override a configuration value that would otherwise be loaded from `~/.codex/config.toml`.
          Use a dotted path (`foo.bar.baz`) to override nested values. The `value` portion is parsed
          as TOML. If it fails to parse as TOML, the raw string is used as a literal.
          
          Examples: - `-c model="o3"` - `-c 'sandbox_permissions=["disk-full-read-access"]'` - `-c
          shell_environment_policy.inherit=all`

  -m, --model <MODEL>
          Model the agent should use

공식 문서의 명령 설명입니다(learn.chatgpt.com/docs/developer-commands?surface=cli, 2026-09-17 확인).

설정 키 model의 설명은 "Model to use (e.g., gpt-5.6-sol )."입니다(learn.chatgpt.com/docs/config-file/config-reference, 2026-09-17 확인). 문서가 예로 든 이름은 아래 목록에도 있지만, 이번에 그 두 이름으로는 돌려 보지 않았습니다.

쓸 수 있는 모델 이름 보기

codex debug --helpmodels Render the raw model catalog as JSON이 있습니다. 출력이 354,958바이트 JSON이라, models 배열에서 slug, visibility 등 몇 필드만 찍는 짧은 Node 스크립트(models_summary.js)로 뽑았습니다.

codex debug models < /dev/null > models.json
node models_summary.js
models: 7
gpt-6-astra | visibility=list | supported_in_api=true | priority=1 | default_reasoning=medium | levels=low/medium/high/xhigh/max/ultra | context_window=272000
gpt-reserve | visibility=hide | supported_in_api=true | priority=3 | default_reasoning=medium | levels=low/medium/high/xhigh/max | context_window=272000
gpt-5.6-sol | visibility=list | supported_in_api=true | priority=4 | default_reasoning=low | levels=low/medium/high/xhigh/max/ultra | context_window=272000
gpt-5.6-terra | visibility=list | supported_in_api=true | priority=7 | default_reasoning=medium | levels=low/medium/high/xhigh/max/ultra | context_window=272000
gpt-5.6-luna | visibility=list | supported_in_api=true | priority=8 | default_reasoning=medium | levels=low/medium/high/xhigh/max | context_window=272000
gpt-5.5 | visibility=list | supported_in_api=true | priority=12 | default_reasoning=medium | levels=low/medium/high/xhigh | context_window=272000
codex-auto-review | visibility=hide | supported_in_api=true | priority=43 | default_reasoning=medium | levels=low/medium/high/xhigh/max | context_window=272000

목록에 있다고 이 계정에서 다 쓸 수 있다는 뜻은 아닙니다. 이 글에서 실제로 응답을 받은 모델은 gpt-6-astra, gpt-5.6-luna, gpt-5.5 셋입니다. 목록은 계정·버전·시점에 따라 달라질 수 있으니 직접 뽑아 보시길 권합니다.

1~4. 한 번만 모델 바꾸기

# 1) 아무것도 안 줌
codex exec --skip-git-repo-check --ephemeral -s read-only 'Reply with the single word OK.' < /dev/null
# 2) -m
codex exec --skip-git-repo-check --ephemeral -s read-only -m gpt-5.6-luna 'Reply with the single word OK.' < /dev/null
# 3) -c model=  (실행 기록에 남은 표기 그대로. 머리말이 gpt-5.5로 나와 값이 제대로 넘어간 것으로 봄)
codex exec --skip-git-repo-check --ephemeral -s read-only -c model=\"gpt-5.5\" 'Reply with the single word OK.' < /dev/null
# 4) 둘 다
codex exec --skip-git-repo-check --ephemeral -s read-only -m gpt-5.6-luna -c model=\"gpt-5.5\" 'Reply with the single word OK.' < /dev/null

어느 모델로 돌았는지는 표준오류의 실행 머리말 model: 줄에서 봤습니다. 3회차의 머리말입니다.

OpenAI Codex v0.153.4
--------
workdir: C:\Users\User\AppData\Local\Temp\longtail_A2\model
model: gpt-5.5
provider: openai
approval: never
sandbox: read-only
reasoning effort: none

--json으로는 모델을 확인할 수 없었습니다. -m gpt-5.6-luna --json으로 한 번 더 돌리자(종료 코드 0) 이벤트 4줄이 나왔고, 머리말은 찍히지 않았습니다. 파일에서 model(대소문자 무시)과 luna를 찾아도 둘 다 0줄이었습니다.

{"type":"thread.started","thread_id":"01a0aeab-b12d-7573-b677-1f5c7e5266ed"}
{"type":"turn.started"}
{"type":"item.completed","item":{"id":"item_0","type":"agent_message","text":"OK"}}
{"type":"turn.completed","usage":{"input_tokens":15463,"cached_input_tokens":15104,"cache_write_input_tokens":0,"output_tokens":5,"reasoning_output_tokens":0}}

그래서 이 글의 모델 확인은 --json 없이 돌린 회차의 머리말로 했습니다. --json 출력 모양은 codex exec 결과를 파일로 받기에 자세히 적었습니다.

5. 없는 모델 이름

codex exec --skip-git-repo-check --ephemeral -s read-only -m gpt-no-such-model 'Reply with the single word OK.' < /dev/null

머리말에는 model: gpt-no-such-model이 그대로 찍혔고, 이어서 경고와 오류가 나왔습니다. ERROR 줄은 같은 내용으로 두 번 찍혔습니다.

warning: Model metadata for `gpt-no-such-model` not found. Defaulting to fallback metadata; this can degrade performance and cause issues.
ERROR: {"type":"error","status":400,"error":{"type":"invalid_request_error","message":"The 'gpt-no-such-model' model is not supported when using Codex with a ChatGPT account."}}

codex exit=1, 5.5초. 머리말의 model: 줄은 요청한 이름을 보여 줄 뿐이라, 그 줄만 보고 모델이 제대로 붙었다고 판단하면 안 됩니다. 오류 문구에 「ChatGPT account」가 들어 있으니, API 키로 로그인한 경우의 문구는 다를 수 있습니다(확인하지 않음).

6. 저장된 세션을 다른 모델로 이어 가기

codex exec resume --help에도 -m이 있습니다. 이번에는 --ephemeral 없이 기본 모델로 세션을 하나 남기고, 그 세션 ID로 -m을 줘 이어 갔습니다.

codex exec --skip-git-repo-check -s read-only 'Remember the word BLUE. Reply with the single word OK.' < /dev/null 2> first.err
SID=$(sed -n 's/^session id: //p' first.err)
codex exec resume --skip-git-repo-check -m gpt-5.6-luna "$SID" 'What word did I ask you to remember? Reply with that word only.' < /dev/null

첫 실행은 model: gpt-6-astra, 답 OK. 이어 간 실행은 머리말이 model: gpt-5.6-luna, session id는 첫 실행과 같은 01a0aea6-fffe-7a21-9100-2fecfb2b3572였고, 답은 BLUE, 종료 코드 0이었습니다. 중간에 이런 경고가 찍혔습니다.

warning: This session was recorded with model `gpt-6-astra` but is resuming with `gpt-5.6-luna`. Consider switching back to `gpt-6-astra` as it may affect Codex performance.

앞 대화 내용(BLUE)은 모델이 바뀐 뒤에도 이어졌습니다. 경고는 나오지만 막히지는 않았습니다.

결과

회차지정 방법머리말 model:종료 코드걸린 시간tokens used
1없음gpt-6-astra08.5초6,118
2-m gpt-5.6-lunagpt-5.6-luna08.7초6,508
3-c model="gpt-5.5"gpt-5.506.8초14,995
4-m gpt-5.6-luna + -c model="gpt-5.5"gpt-5.6-luna012.6초7,173
5-m gpt-no-such-modelgpt-no-such-model15.5초없음
6resume ... -m gpt-5.6-lunagpt-5.6-luna013.1초(첫 실행 포함)6,049 / 15,683

4회차에서 -m이 이긴 것은 이번 한 번의 관찰입니다. 둘 사이의 우선순위를 밝힌 문서 문장은 이번에 찾지 못했습니다.

실패한 것

5회차는 일부러 만든 실패입니다. gpt-no-such-model을 지정한 이 실행에서는 status 400과 해당 모델을 지원하지 않는다는 오류가 나왔습니다. 없는 이름은 이 하나만 시험했습니다. 오류 전에 나온 Model metadata ... not found 경고가 먼저 알려 주는 신호였습니다.

6회차는 --ephemeral 없이 돌려 이 PC의 codex 세션 기록에 세션이 하나 남았습니다. 이어 가기를 시험하려면 필요한 일이었지만, 기록을 남기기 싫으면 이 시험은 건너뛰셔도 됩니다.

확인하지 않은 것

함께 보기