Skip to content

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

Description

@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
Image

Step 2
Image

What is the expected behavior?

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingcontextIssues related to context management (including compaction)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions