Skip to content

feat(cx): add reasoning effort variants for GPT-5.5 and GPT-5.4 - #865

Open
mugnimaestra wants to merge 2 commits into
decolua:masterfrom
mugnimaestra:feat/gpt55-gpt54-effort-variants
Open

mugnimaestra wants to merge 2 commits into
decolua:masterfrom
mugnimaestra:feat/gpt55-gpt54-effort-variants

Conversation

@mugnimaestra

Copy link
Copy Markdown
Contributor

Summary

  • Adds a withCodexEffortVariants() helper function (analogous to withCodexReviewModels()) that auto-generates -xhigh, -high, -low, -none model entries for specified Codex models
  • Applies it to gpt-5.5 and gpt-5.4 in the cx provider, generating 8 new model entries (4 effort levels × 2 models)
  • No changes to codex.js — the executor already handles suffix stripping generically (line 184-192)

Motivation

Consumer tools like opencode use @ai-sdk/openai-compatible (Vercel AI SDK), which validates reasoningEffort against z.enum(["low", "medium", "high"]). This means none and xhigh are rejected by the SDK before the request even reaches 9router.

The model name suffix approach (e.g. gpt-5.5-xhigh) bypasses SDK validation entirely because reasoningEffort never appears in the request body — the effort level is encoded in the model name, which codex.js already parses and strips generically at lines 184-192:

const effortLevels = ['none', 'low', 'medium', 'high', 'xhigh'];
for (const level of effortLevels) {
  if (body.model.endsWith(`-${level}`)) {
    modelEffort = level;
    body.model = body.model.replace(`-${level}`, '');
    break;
  }
}

Without server-side model entries for gpt-5.5-xhigh, gpt-5.5-none, etc., consumers using the Vercel AI SDK cannot access none or xhigh reasoning effort for GPT-5.5 and GPT-5.4.

This is an oversight — gpt-5.3-codex already has all effort variants manually enumerated, but gpt-5.5 and gpt-5.4 were added as quick 1-line entries without them.

What Changed

open-sse/config/providerModels.js

  1. Added CODEX_EFFORT_LEVELS constant and withCodexEffortVariants(modelIds) helper function — a higher-order function (like withCodexReviewModels) that expands targeted model entries into effort level variants
  2. Composed it with the existing withCodexReviewModels() in the cx provider:
    cx: withCodexReviewModels(withCodexEffortVariants(["gpt-5.5", "gpt-5.4"])([
      { id: "gpt-5.5", name: "GPT 5.5" },
      { id: "gpt-5.4", name: "GPT 5.4" },
      // ... rest unchanged
    ])),

New models generated

Model ID Display Name
gpt-5.5-xhigh GPT 5.5 (xHigh)
gpt-5.5-high GPT 5.5 (High)
gpt-5.5-low GPT 5.5 (Low)
gpt-5.5-none GPT 5.5 (None)
gpt-5.4-xhigh GPT 5.4 (xHigh)
gpt-5.4-high GPT 5.4 (High)
gpt-5.4-low GPT 5.4 (Low)
gpt-5.4-none GPT 5.4 (None)

Each of these also gets a -review variant via withCodexReviewModels() (e.g. gpt-5.5-xhigh-review).

Why a helper function instead of manual entries?

  • DRY: Future Codex models just need to be added to the target array (e.g. ["gpt-5.5", "gpt-5.4", "gpt-6.0"])
  • Consistent naming: The helper ensures uniform (xHigh), (High), (Low), (None) suffixes
  • Composable: Works with withCodexReviewModels() — effort variants also get -review variants automatically
  • Non-breaking: Existing manually-defined gpt-5.3-codex-* variants are unaffected (they're not in the target set)

Related Issues

Testing

The executor's suffix parsing (codex.js lines 184-192) is model-name-agnostic — it works on any model name ending with -xhigh, -high, -low, -medium, or -none. No executor changes needed.

Add withCodexEffortVariants() helper and generate -xhigh, -high, -low,
-none model entries for gpt-5.5 and gpt-5.4 in the Codex provider.

Consumer tools using @ai-sdk/openai-compatible (e.g. opencode) cannot
pass 'none' or 'xhigh' reasoning effort because the SDK's zod schema
only validates ['low', 'medium', 'high']. The model name suffix approach
(gpt-5.5-xhigh) bypasses SDK validation entirely since reasoningEffort
never appears in the request body — the effort level is encoded in the
model name, which codex.js already parses and strips generically.
@mugnimaestra

Copy link
Copy Markdown
Contributor Author

Updated this branch after review.

Current scope:

  • Adds Codex model aliases for GPT-5.5/GPT-5.4 effort levels: xhigh, high, medium, low, matching the current upstream OpenAI Codex catalog.
  • This lets clients that validate reasoningEffort still select xhigh via a model alias such as cx/gpt-5.5-xhigh; 9router already strips the suffix into Codex reasoning effort before dispatch.
  • none was intentionally removed from the generated aliases because the upstream Codex catalog for these slugs currently advertises low/medium/high/xhigh, not none.
  • Added focused tests for generated aliases, absence of none, review variant composition, upstream ID resolution, and quota family metadata.

Related but not exact duplicates: #748 / #668 are model-catalog cleanup requests; #718 / #717 / #812 cover Codex OAuth/request-contract/account availability; #836 covers review-model quota handling.

@mugnimaestra

Copy link
Copy Markdown
Contributor Author

Hi @decolua, when you have a chance, could you please take a look? I updated the PR with upstream Codex-aligned effort aliases and focused tests. Thanks!

@vivekrp

vivekrp commented May 18, 2026

Copy link
Copy Markdown

Any update on this?

@joseph-lewis

Copy link
Copy Markdown

Any update? I am doing this manually myself, everytime I update 9Router I add patches fixes that adds this. But it would be great if it was native in 9Router...

golamrabbi696 added a commit to golamrabbi696/EzRouter that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants