Azure OpenAI deployment supports 1M, but Codex gpt-5.4 effective context_window is capped at 272k from models_cache.json
Summary
When using Codex with an Azure OpenAI deployment for gpt-5.4, Azure documents/support indicate a 1M context window, and my local Codex config also requests ~1M. However, Codex is effectively using a much smaller window (272000), apparently from its local model catalog/cache.
This looks similar to the other API-provider context window issues, but this case is specifically for Azure OpenAI.
Environment
- Codex CLI version:
0.139.0 - OS: Windows
- Provider:
azure - Model:
gpt-5.4
Local config
My ~/.codex/config.toml contains:
model = "gpt-5.4"
model_provider = "azure"
model_context_window = 1050000
There is no model_catalog_json override in my config.
What Codex reports
codex debug models shows:
slug: gpt-5.4
display_name: gpt-5.4
context_window: 272000
max_context_window: 1000000
effective_context_window_percent: 95
Local cache evidence
~/.codex/models_cache.json contains the same values for gpt-5.4:
{
"slug": "gpt-5.4",
...
"context_window": 272000,
"max_context_window": 1000000,
"effective_context_window_percent": 95
}
Cache metadata:
fetched_at:2026-05-24T06:02:39.002261900Zclient_version:0.133.0
My installed CLI is newer (0.139.0), so this may be stale or conservative catalog metadata.
Additional checks
- No profile override files found under
~/.codex - No repo-local
.codex/config.tomloverride found - No
model_catalog_jsonoverride found - A fresh ephemeral run did not refresh
~/.codex/models_cache.json
Command used:
codex exec --ephemeral --skip-git-repo-check --color never "Reply with exactly OK."
The cache file timestamp and hash remained unchanged after that run.
Expected behavior
If the Azure OpenAI deployment supports 1M for this model, I would expect Codex to either:
- honor the configured
model_context_window = 1050000, or - refresh/use provider-appropriate catalog metadata so the effective
context_windowis close to the provider capability instead of272000.
Actual behavior
Codex appears to know max_context_window = 1000000, but still uses context_window = 272000 as the effective working window for gpt-5.4 on Azure.
Question
Is Codex intentionally capping Azure gpt-5.4 to 272000 for agent/runtime reasons, or is this a stale/incorrect model catalog issue in models_cache.json / the effective model catalog path?
2 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Additional finding after more testing:
I think I found why Codex defaults to
272000instead of the full ~1M window.In the local Codex model catalog/cache,
gpt-5.4has two separate values:So Codex does appear to know that the model can go up to around 1M tokens, but its default effective working window is set to
272000.That
272Knumber seems significant. OpenAI's GPT-5.4 model docs say that for GPT-5.4 / GPT-5.4 Pro, prompts with more than272Kinput tokens are priced at2xinput and1.5xoutput for the full session:https://developers.openai.com/api/docs/models/gpt-5.4
So my current guess is that Codex may intentionally use
272000as the default context window to avoid crossing the higher-pricing threshold, while still keepingmax_context_window = 1000000available as an upper bound.I also confirmed that
model_context_window = 1050000in~/.codex/config.tomldid not reflect in the normal launch path. However, this one-off CLI override did work:So the runtime can accept a 1M context window when explicitly passed through
-c. The unclear part is why the same setting is not being applied fromconfig.toml, or whether Codex intentionally requires an explicit override to exceed the default272000window.At this point, I think the issue is less about Azure not supporting the 1M context window and more about Codex choosing
272000as the default effective context window, likely because it matches the GPT-5.4 pricing threshold documented by OpenAI.