Skip to content

Models: add native GPT-5.4 mini and nano support - #49289

Merged
vincentkoc merged 2 commits into
mainfrom
vincentkoc-code/openai-gpt-5-4-mini-nano
Mar 17, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
vincentkoc-code/openai-gpt-5-4-mini-nano

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • Problem: OpenClaw already forward-compat maps new OpenAI frontier ids like gpt-5.4, but it did not natively surface the newly announced gpt-5.4-mini and gpt-5.4-nano ids.
  • Why it matters: users cannot cleanly select the new small GPT-5.4 models through the same native OpenAI catalog/runtime path, and /thinking xhigh capability messaging would lag the model launch.
  • What changed: added provider-owned forward-compat resolution, bundled catalog augmentation, and coverage updates for openai/gpt-5.4-mini and openai/gpt-5.4-nano, plus an unreleased changelog entry.
  • What did NOT change (scope boundary): no auth flow changes, no Codex OAuth model additions beyond existing behavior, and no default-model changes.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-visible / Behavior Changes

Users can now select openai/gpt-5.4-mini and openai/gpt-5.4-nano through the native OpenAI provider path, and xhigh thinking support messaging now includes both ids.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node 22 / pnpm worktree
  • Model/provider: OpenAI
  • Integration/channel (if any): N/A
  • Relevant config (redacted): none

Steps

  1. Add the new OpenAI small-model ids to the provider-owned forward-compat path.
  2. Surface the same ids through bundled catalog augmentation and capability checks.
  3. Verify the touched code paths and repo hook checks.

Expected

  • openai/gpt-5.4-mini and openai/gpt-5.4-nano resolve through the native OpenAI provider path.
  • Bundled catalog augmentation exposes both ids when gpt-5-mini / gpt-5-nano templates exist.
  • /thinking xhigh support messaging includes both ids.

Actual

  • Implemented as expected in provider and bundled-catalog code paths.
  • git diff --check passes.
  • Repo commit helper completed and ran pre-commit oxlint --type-aware --fix successfully.
  • Targeted Vitest invocations in this worktree hung after startup in this environment, so I could not get a trustworthy local test completion signal yet.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: provider hook logic, bundled catalog augmentation, changelog entry placement, and clean diff formatting.
  • Edge cases checked: gpt-5.4-mini and gpt-5.4-nano inherit native OpenAI transport and appear in xhigh capability gating.
  • What you did not verify: a full passing Vitest run in this worktree; targeted runs stalled after RUN v4.1.0 and timed out locally.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: revert commit 5e15fd3f6a.
  • Files/config to restore: OpenAI provider catalog/runtime files and matching tests.
  • Known bad symptoms reviewers should watch for: the new ids missing from model lists or xhigh capability text, or resolving with the wrong provider transport.

Risks and Mitigations

  • Risk: gpt-5-nano may not exist in every upstream catalog yet, so availability depends on template/discovery presence.
    • Mitigation: the forward-compat path prefers gpt-5-nano but falls back to gpt-5-mini for bundled catalog derivation, and keeps the direct OpenAI transport normalized.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: openai size: M maintainer Maintainer-authored PR labels Mar 17, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review March 17, 2026 23:21
@vincentkoc
vincentkoc merged commit 0e4c072 into main Mar 17, 2026
22 of 40 checks passed
@vincentkoc
vincentkoc deleted the vincentkoc-code/openai-gpt-5-4-mini-nano branch March 17, 2026 23:21
@greptile-apps

greptile-apps Bot commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds native forward-compat support for openai/gpt-5.4-mini and openai/gpt-5.4-nano by following the same template-cloning pattern already used for gpt-5.4 and gpt-5.4-pro. Changes span the provider resolution hook (openai-provider.ts), the bundled catalog augmentation (provider-catalog-metadata.ts), xhigh/modern model ID lists, and a new test file.

Key findings:

  • maxTokens fallback uses the wrong constant — when no template model is available for mini/nano, normalizeModelCompat is called with maxTokens: patch.maxTokens ?? DEFAULT_CONTEXT_TOKENS. Since the mini/nano patches omit maxTokens, both fall back to DEFAULT_CONTEXT_TOKENS = 200_000. DEFAULT_CONTEXT_TOKENS is a context-window fallback, not an output-token limit. Setting maxTokens = 200_000 for a "mini" or "nano" model could trigger API rejections if downstream code honours the advertised value. gpt-5.4 and gpt-5.4-pro explicitly set maxTokens: OPENAI_GPT_54_MAX_TOKENS (128_000) and are unaffected.
  • Redundant entries in OPENAI_XHIGH_MODEL_IDS / OPENAI_MODERN_MODEL_IDS — matchesExactOrPrefix matches models whose ID starts with any listed value, so gpt-5.4-mini and gpt-5.4-nano were already implicitly covered by the "gpt-5.4" prefix. The new explicit entries are harmless but could confuse future maintainers about the semantics of the list.
  • Nano catalog falls back to mini template — when gpt-5-nano is absent from the upstream catalog, both gpt-5.4-nano and gpt-5.4-mini are derived from gpt-5-mini, giving them identical metadata. This is intentional per the PR risk section, but users will see two identically-specced catalog entries until gpt-5-nano becomes available.
  • The PR author confirms that a full Vitest run could not be completed locally due to test-runner hangs. CI coverage should be verified before merge.

Confidence Score: 3/5

  • Mostly safe to merge; the no-template fallback path for mini/nano should be corrected before the models go live to avoid advertising an incorrect maxTokens budget.
  • The overall structure is sound and consistent with existing gpt-5.4/gpt-5.4-pro patterns. The critical path (template-based resolution) is well-tested. However, the no-template fallback incorrectly uses DEFAULT_CONTEXT_TOKENS for maxTokens, which could cause API errors if exercised. The redundant xhigh/modern ID entries and the nano-fallback-to-mini behavior are acknowledged risks. Score is 3 (rather than 2) because the fallback path is unlikely to be hit frequently in practice, but the potential for silent API failures warrants attention before merging.
  • extensions/openai/openai-provider.ts lines 94–129 — specifically the absence of contextWindow/maxTokens in the mini/nano patches and the resulting DEFAULT_CONTEXT_TOKENS fallback for maxTokens.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/openai/openai-provider.ts
Line: 128-129

Comment:
**`maxTokens` incorrectly falls back to a context-window constant**

For `gpt-5.4-mini` and `gpt-5.4-nano`, neither `patch.contextWindow` nor `patch.maxTokens` is defined (see lines 94–110). This means the no-template fallback path sets both to `DEFAULT_CONTEXT_TOKENS = 200_000`. `DEFAULT_CONTEXT_TOKENS` is explicitly documented as a "conservative fallback used when model metadata is unavailable" for *context window* sizing — not max output tokens. Setting `maxTokens = 200_000` is semantically incorrect: `maxTokens` represents the model's maximum *output* token limit, which is almost always a fraction of the context window (e.g. `gpt-5.4` uses `128_000` for `maxTokens` against a `1_050_000` context window). If this no-template path is exercised, the runtime would advertise a `200_000`-token output budget that the API would likely reject, causing hard errors.

Consider defining explicit fallback values for mini/nano — even rough estimates — rather than reusing the context-window constant:

```typescript
contextWindow: patch.contextWindow ?? DEFAULT_CONTEXT_TOKENS,
maxTokens: patch.maxTokens ?? OPENAI_GPT_54_MAX_TOKENS,
```

Or, alternatively, add `contextWindow` and `maxTokens` directly to the mini/nano `patch` objects (similar to how `gpt-5.4` and `gpt-5.4-pro` are handled) so the fallback path never needs to guess.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: extensions/openai/openai-provider.ts
Line: 32-46

Comment:
**Redundant entries in xhigh/modern model ID lists**

`matchesExactOrPrefix` (used on lines 172–173) checks whether `modelId` exactly equals or *starts with* any value in the list. Because `"gpt-5.4-mini"` and `"gpt-5.4-nano"` both start with `"gpt-5.4"`, they are already implicitly matched by the existing `"gpt-5.4"` entry. The explicit additions here are technically redundant for `supportsXHighThinking` and `isModernModelRef`.

This is not a bug — being explicit aids readability — but it is worth documenting the intent with a comment so future maintainers don't remove the entries thinking they are duplicates, or conversely, add further sub-model entries assuming they won't be caught by the prefix rule.

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: "Tests: cover OpenAI ..."

Comment on lines +128 to +129
contextWindow: patch.contextWindow ?? DEFAULT_CONTEXT_TOKENS,
maxTokens: patch.maxTokens ?? DEFAULT_CONTEXT_TOKENS,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 maxTokens incorrectly falls back to a context-window constant

For gpt-5.4-mini and gpt-5.4-nano, neither patch.contextWindow nor patch.maxTokens is defined (see lines 94–110). This means the no-template fallback path sets both to DEFAULT_CONTEXT_TOKENS = 200_000. DEFAULT_CONTEXT_TOKENS is explicitly documented as a "conservative fallback used when model metadata is unavailable" for context window sizing — not max output tokens. Setting maxTokens = 200_000 is semantically incorrect: maxTokens represents the model's maximum output token limit, which is almost always a fraction of the context window (e.g. gpt-5.4 uses 128_000 for maxTokens against a 1_050_000 context window). If this no-template path is exercised, the runtime would advertise a 200_000-token output budget that the API would likely reject, causing hard errors.

Consider defining explicit fallback values for mini/nano — even rough estimates — rather than reusing the context-window constant:

contextWindow: patch.contextWindow ?? DEFAULT_CONTEXT_TOKENS,
maxTokens: patch.maxTokens ?? OPENAI_GPT_54_MAX_TOKENS,

Or, alternatively, add contextWindow and maxTokens directly to the mini/nano patch objects (similar to how gpt-5.4 and gpt-5.4-pro are handled) so the fallback path never needs to guess.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/openai/openai-provider.ts
Line: 128-129

Comment:
**`maxTokens` incorrectly falls back to a context-window constant**

For `gpt-5.4-mini` and `gpt-5.4-nano`, neither `patch.contextWindow` nor `patch.maxTokens` is defined (see lines 94–110). This means the no-template fallback path sets both to `DEFAULT_CONTEXT_TOKENS = 200_000`. `DEFAULT_CONTEXT_TOKENS` is explicitly documented as a "conservative fallback used when model metadata is unavailable" for *context window* sizing — not max output tokens. Setting `maxTokens = 200_000` is semantically incorrect: `maxTokens` represents the model's maximum *output* token limit, which is almost always a fraction of the context window (e.g. `gpt-5.4` uses `128_000` for `maxTokens` against a `1_050_000` context window). If this no-template path is exercised, the runtime would advertise a `200_000`-token output budget that the API would likely reject, causing hard errors.

Consider defining explicit fallback values for mini/nano — even rough estimates — rather than reusing the context-window constant:

```typescript
contextWindow: patch.contextWindow ?? DEFAULT_CONTEXT_TOKENS,
maxTokens: patch.maxTokens ?? OPENAI_GPT_54_MAX_TOKENS,
```

Or, alternatively, add `contextWindow` and `maxTokens` directly to the mini/nano `patch` objects (similar to how `gpt-5.4` and `gpt-5.4-pro` are handled) so the fallback path never needs to guess.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +32 to +46
const OPENAI_XHIGH_MODEL_IDS = [
"gpt-5.4",
"gpt-5.4-pro",
"gpt-5.4-mini",
"gpt-5.4-nano",
"gpt-5.2",
] as const;
const OPENAI_MODERN_MODEL_IDS = [
"gpt-5.4",
"gpt-5.4-pro",
"gpt-5.4-mini",
"gpt-5.4-nano",
"gpt-5.2",
"gpt-5.0",
] as const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Redundant entries in xhigh/modern model ID lists

matchesExactOrPrefix (used on lines 172–173) checks whether modelId exactly equals or starts with any value in the list. Because "gpt-5.4-mini" and "gpt-5.4-nano" both start with "gpt-5.4", they are already implicitly matched by the existing "gpt-5.4" entry. The explicit additions here are technically redundant for supportsXHighThinking and isModernModelRef.

This is not a bug — being explicit aids readability — but it is worth documenting the intent with a comment so future maintainers don't remove the entries thinking they are duplicates, or conversely, add further sub-model entries assuming they won't be caught by the prefix rule.

Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/openai/openai-provider.ts
Line: 32-46

Comment:
**Redundant entries in xhigh/modern model ID lists**

`matchesExactOrPrefix` (used on lines 172–173) checks whether `modelId` exactly equals or *starts with* any value in the list. Because `"gpt-5.4-mini"` and `"gpt-5.4-nano"` both start with `"gpt-5.4"`, they are already implicitly matched by the existing `"gpt-5.4"` entry. The explicit additions here are technically redundant for `supportsXHighThinking` and `isModernModelRef`.

This is not a bug — being explicit aids readability — but it is worth documenting the intent with a comment so future maintainers don't remove the entries thinking they are duplicates, or conversely, add further sub-model entries assuming they won't be caught by the prefix rule.

How can I resolve this? If you propose a fix, please make it concise.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

nikolaisid pushed a commit to nikolaisid/openclaw that referenced this pull request Mar 18, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
LittleMeHere added a commit to LittleMeHere/openclaw that referenced this pull request Mar 18, 2026
Add forward-compat resolution, catalog augmentation, xhigh thinking,
and modern model filtering for gpt-5.4-mini in the openai-codex
provider.

GPT-5.4 mini launched March 17, 2026 and is available in Codex, but
the openai-codex OAuth provider did not resolve it. The openai
(API key) provider was updated in openclaw#49289; this completes the coverage
for openai-codex OAuth users.

Note: gpt-5.4-nano is API-only per OpenAI and is NOT available via
Codex OAuth, so it is intentionally excluded from this change.

Changes:
- extensions/openai/openai-codex-provider.ts: add mini to
  forward-compat resolution, xhigh model ids, modern model ids,
  and catalog augmentation
- src/plugins/provider-catalog-metadata.ts: add bundled catalog
  entry for openai-codex mini
- Tests: runtime contract, provider-runtime, model-compat,
  pi-embedded-runner, model-catalog, directive behavior, and
  test-support/harness updates

Closes openclaw#37623 (for openai-codex mini gap)
var-gg pushed a commit to var-gg/openclaw that referenced this pull request Mar 20, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
fuller-stack-dev pushed a commit to fuller-stack-dev/openclaw that referenced this pull request Mar 20, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
fuller-stack-dev pushed a commit to fuller-stack-dev/openclaw that referenced this pull request Mar 20, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
* Models: add GPT-5.4 mini and nano support

* Tests: cover OpenAI GPT-5.4 mini and nano extension support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: openai maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant