Skip to content

Default Codex context length not matching Pro plan #7705

Closed

Description

@sam-ulrich1

Description

In the code, the context length for GPT 5.2 codex shows 400,000 tokens, which is technically correct for the API, but on the pro plan for ChatGPT, I believe you only get like 250 to 260, something like that. So, if the average user signs up with ChatGPT and uses it, they are likely to hit a context error, which forces compaction. So, it would make sense to maybe detect if it's a ChatGPT versus an API integration, and then automatically configure the defaults, maybe?

Plugins

No response

OpenCode version

1.1.111

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Activity

  1. github-actions commented on Jan 10, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if this doesn't address your specific case.

  2. sam-ulrich1 commented on Jan 10, 2026

    @sam-ulrich1
    Author

    To be clear, you have to compact whether you run out of context space abruptly or not. It's just that if you have plugins like OhMyOpencode, then compaction could happen earlier at a more optimal point than the last second when you fully run out of tokens. So having a correct representation of the context by default would be nice for a lot of users.

    PS love the hook system, custom hooks on compaction are a god send

  3. rekram1-node commented on Jan 10, 2026

    @rekram1-node
    Contributor

    ah okay ill look into it

  4. sam-ulrich1 commented on Jan 10, 2026

    @sam-ulrich1
    Author

    @rekram1-node Is there some way that I can modify my open code JSON to fix this without having to redefine all of the models and variants that come default with the new official codex integration? Just as a temporary workaround.

  5. rekram1-node commented on Jan 11, 2026

    @rekram1-node
    Contributor

    ig show me ur config but u can do partial model overrides u dont need complete redefinitions

  6. PSU3D0 commented on Jan 11, 2026

    @PSU3D0

    Are there docs on partial model overrides?

  7. sam-ulrich1 commented on Jan 11, 2026

    @sam-ulrich1
    Author

    Updated config with and it worked. did not know that it was config merging

      "provider": {
        "openai": {
          "models": {
            "gpt-5.2": {
              "limit": { "context": 272000, "output": 128000 }
            },
            "gpt-5.2-codex": {
              "limit": { "context": 272000, "output": 128000 }
            },
            "gpt-5.1-codex-max": {
              "limit": { "context": 272000, "output": 128000 }
            },
            "gpt-5.1-codex-mini": {
              "limit": { "context": 272000, "output": 128000 }
            }
          }
        }
      }
    
  8. sam-ulrich1 commented on Jan 11, 2026

    @sam-ulrich1
    Author

    nvm it did not merge. it overwrote the defaults

  9. FBakkensen commented on Jan 12, 2026

    @FBakkensen

    I have the excact same issue, always when used just short of 270K tokens, which match the available token count when using the pro / plus sub in codex.

  10. 3 remaining items

  11. mykola-dev commented on Jan 13, 2026

    @mykola-dev

    i use github copilot subscription and my context window is always 100k doesnt matter which model i use (even opus/gemini pro)

  12. kostrse commented on Jan 14, 2026

    @kostrse

    GPT 5.2 via OpenAI API should have 400K, right?

  13. FBakkensen commented on Jan 14, 2026

    @FBakkensen

    i use github copilot subscription and my context window is always 100k doesnt matter which model i use (even opus/gemini pro)

    Yes, all models has an artificial low context window using github copilot, this is the same whether you use github copilot, or use their subscription in opencode or any other tool

  14. rchybicki commented on Jan 16, 2026

    @rchybicki

    I just hit the context length window error on gpt-5.2 using an API key at 275k tokens, so I believe it's not API vs Sub. AFAIK OpenAI's 400k is input 270k + output 130k, which is a bit misleading.

  15. rekram1-node commented on Jan 16, 2026

    @rekram1-node
    Contributor

    Yeah having people report this still exists, looking into it

  16. bndnsmth commented on Jan 16, 2026

    @bndnsmth
    Contributor

    @rchybicki 5.2 or 5.2 codex? I believe the input limit was only set for codex models.

    @rekram1-node I did hit it again today when a tool-call boiled over the limit when it tried to add a large git diff. But, believe that's the second opportunity described in the PR where you'd need a retry post compaction since you don't know tokens in advance.

  17. rchybicki commented on Jan 16, 2026

    @rchybicki

    @brandon93s this was 5.2 non-codex

  18. rekram1-node commented on Jan 16, 2026

    @rekram1-node
    Contributor

    @brandon93s I think the input thing applies to all gpt-5 models

  19. rekram1-node commented on Jan 16, 2026

    @rekram1-node
    Contributor

    Ill double check w/ their docs and update

  20. HyunggyuJang commented on Feb 6, 2026

    @HyunggyuJang

    Update from my side: I think my earlier interpretation was wrong.

    I traced this to model metadata in pi-mono:
    https://github.com/badlogic/pi-mono/blob/f9161c4d4e0d001ebfbd3ba98f0b89adb253260a/packages/ai/src/models.generated.ts#L5099

    From that data, ChatGPT subscription-backed Codex models appear constrained (roughly 272k input / 128k output) regardless of selected variant. So the default-vs-variant limit difference I reported was likely a mistaken read.

    Sorry about the confusion.

  21. github-actions commented on Apr 9, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions