Skip to content

GPT-5.6 Codex OAuth uses 1.05M metadata instead of 500k total / 372k input limits #36247

Description

@nabilfreeman

Description

When OpenAI authentication uses Codex OAuth, GPT-5.6 inherits the direct API limits from models.dev:

context: 1,050,000
input:     922,000
output:    128,000

The Codex backend uses a lower input budget for gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna. Comparing the live catalog with OpenCode's existing GPT-5.5 override establishes the mapping:

                      codex debug    OpenCode input    OpenCode output    OpenCode context
GPT-5.5                    272,000           272,000            128,000             400,000
GPT-5.6 variants           372,000           372,000            128,000             500,000

Without an OAuth-specific GPT-5.6 override, OpenCode waits too long to compact. Once the real input budget is exceeded, the Codex endpoint does not provide a useful error that OpenCode can recover from, leaving the conversation unusable.

OpenCode already handles GPT-5.5 in packages/opencode/src/plugin/openai/codex.ts:

limit: model.id.includes("gpt-5.5")
  ? {
      context: 400_000,
      input: 272_000,
      output: 128_000,
    }
  : model.limit

That behavior was added in #24212 to fix #24171. GPT-5.6 is admitted by the generic model filter but does not receive the corresponding Codex limit override.

The Codex values can be independently verified with:

codex debug models 2>/dev/null |
  jq '.models[] | select(.slug == "gpt-5.5" or (.slug | startswith("gpt-5.6"))) |
      {slug, context_window, max_context_window, effective_context_window_percent}'

GPT-5.5 reports 272000; all three GPT-5.6 variants report 372000. Each uses effective_context_window_percent: 95.

Expected: extend the existing Codex-OAuth-specific handling to GPT-5.6 using context: 500000, input: 372000, and output: 128000. The direct OpenAI API metadata should remain unchanged.

Plugins

None required. This uses the built-in OpenAI Codex OAuth integration.

OpenCode version

1.17.18 / dev at 1c7f65f105 when reported

Steps to reproduce

  1. Authenticate OpenAI with ChatGPT/Codex OAuth rather than an API key.
  2. Select gpt-5.6-sol, gpt-5.6-terra, or gpt-5.6-luna.
  3. Let a session approach the 372,000-token Codex input budget.
  4. Observe that proactive compaction uses the inherited 922,000-token input metadata and does not run before the Codex backend rejects or terminates the request.
  5. Observe that the session cannot recover cleanly after exceeding the real input budget.

Screenshot and/or share link

Not applicable. The mismatch is reproducible from the live Codex model catalog and the OpenCode OAuth model transform above.

Operating System

macOS

Terminal

Any

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions