Context Window Resets from 1M to ~258k When Using API Provider

Open 💬 3 comments Opened Jun 11, 2026 by wfge

What version of Codex CLI is running?

codex-cli 0.139.0

What subscription do you have?

API Provider

Which model were you using?

gpt-5.5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

iTerm2

Codex doctor report

What issue are you seeing?

I'm using Codex with an API Provider configuration. I have explicitly set the context window size to 1M tokens through environment variables, and the configuration appears to be loaded correctly at startup.

However, after I send any prompt, the context window immediately drops back to approximately 258k tokens. This happens consistently across sessions.

What steps can reproduce the bug?

Step 1
<img width="2050" height="716" alt="Image" src="https://github.com/user-attachments/assets/0faec269-2708-44c2-8054-2359218b278c" />

Step 2
<img width="2152" height="1312" alt="Image" src="https://github.com/user-attachments/assets/38042379-9974-4d7a-8952-0685aa196f88" />

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

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