Skip to content

[Feature]: opt-in 900k extended context aliases for eligible native OpenAI/Codex OAuth models #3958

Description

@rrmlima

Problem to solve

When using native Codex OAuth models (gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-6-astra) through OpenCodex, the catalog advertises default conservative context windows (e.g., 372k or 272k in NATIVE_OPENAI_CONTEXT_OVERRIDES).

However, the underlying OpenAI ChatGPT/Codex OAuth infrastructure supports extended context windows of ~900,000 tokens for eligible accounts before hitting backend limit barriers (~915k–920k).

Because OpenCodex enforces or advertises the smaller context window in opencodex-catalog.json and /v1/models, downstream clients (such as Codex CLI, Codex Desktop, Antigravity, and Command Code) trigger premature compaction tasks or refuse to load large repository contexts into active turns, unnecessarily constraining heavy developer workflows.

Proposed solution

Implement an opt-in extended context window mechanism for eligible native OpenAI/Codex OAuth models using synthetic aliases (e.g. -900k suffix) and request normalization:

  1. Catalog Exposure (src/codex/catalog.ts):

    • Provide an option or explicit model configuration to expose extended variants for eligible models:
      • gpt-5.6-sol-900k, gpt-5.6-terra-900k, gpt-5.6-luna-900k, gpt-6-astra-900k (or account-prefixed equivalents such as main/gpt-5.6-sol-900k).
    • Advertise context_window: 900_000 and max_context_window: 900_000 for these variants.
    • Keep a safe headroom ceiling at 900,000 tokens (well below the backend hard cutoff of ~915k).
  2. Wire Stripping / Model Normalization (src/server/ dispatch):

    • Intercept requests specifying the -900k variant before dispatching upstream to OpenAI.
    • Strip the -900k suffix, restoring the canonical upstream slug (e.g. gpt-5.6-sol) so the OpenAI backend receives its standard model identifier while honoring the extended conversation payload.
  3. Strict Model Allowlist:

    • Restrict extended context aliases strictly to confirmed eligible models (gpt-5.6-*, gpt-6-*).
    • Disallow legacy/compact models (gpt-5.5, gpt-5.4-mini, gpt-5.3-codex-spark) which genuinely fail with HTTP 400 when exceeding standard limits.

Alternatives considered

  • In-place override of the base model: Replacing the standard 372k window directly with 900k. (Rejected: users often want to preserve standard context sizes to prevent excessive quota consumption and maintain faster response times unless explicitly opting into massive context).
  • Client-side compaction hacks: Forcing client clients to bypass compaction. (Rejected: breaks multi-client interoperability; handling it cleanly in the OpenCodex catalog and router provides seamless support for Codex CLI, Desktop, and external harnesses).

Additional context

  • This architecture has already been implemented and validated in production by Hermes Agent, where it is now a native capability. In Hermes Agent, exposing these eligible models with the -900k extended context alias and stripping the suffix on the wire before hitting the OpenAI backend enables stable, high-capacity multi-turn sessions against Codex OAuth subscriptions without upstream errors or premature compacts.
  • Bringing this directly into OpenCodex creates a single source of truth across all connected clients (Codex CLI, Codex Desktop, Antigravity, Command Code, and Hermes) without requiring client-side workarounds.
  • Relevant code locations in OpenCodex:
    • src/codex/catalog.ts (NATIVE_OPENAI_CONTEXT_OVERRIDES, SUPPORTED_NATIVE_OPENAI_SLUGS)
    • Request ingress router / normalization dispatch in src/server/ before upstream dispatch.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolOAuth, credentials, Codex pool, quota, failover, plansenhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions