Azure OpenAI deployment supports 1M, but Codex gpt-5.4 effective context_window is capped at 272k from models_cache.json

Open 💬 2 comments Opened Jun 12, 2026 by jgador

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.002261900Z
  • client_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.toml override found
  • No model_catalog_json override 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:

  1. honor the configured model_context_window = 1050000, or
  2. refresh/use provider-appropriate catalog metadata so the effective context_window is close to the provider capability instead of 272000.

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?

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗