Repository navigation
Models: add native GPT-5.4 mini and nano support - #49289
Conversation
Greptile SummaryThis PR adds native forward-compat support for Key findings:
Confidence Score: 3/5
Prompt To Fix All With AIThis 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 ..." |
| contextWindow: patch.contextWindow ?? DEFAULT_CONTEXT_TOKENS, | ||
| maxTokens: patch.maxTokens ?? DEFAULT_CONTEXT_TOKENS, |
There was a problem hiding this 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:
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.| 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; |
There was a problem hiding this 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.
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!
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
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)
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
* Models: add GPT-5.4 mini and nano support * Tests: cover OpenAI GPT-5.4 mini and nano extension support
Summary
gpt-5.4, but it did not natively surface the newly announcedgpt-5.4-miniandgpt-5.4-nanoids./thinking xhighcapability messaging would lag the model launch.openai/gpt-5.4-miniandopenai/gpt-5.4-nano, plus an unreleased changelog entry.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Users can now select
openai/gpt-5.4-miniandopenai/gpt-5.4-nanothrough the native OpenAI provider path, andxhighthinking support messaging now includes both ids.Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
openai/gpt-5.4-miniandopenai/gpt-5.4-nanoresolve through the native OpenAI provider path.gpt-5-mini/gpt-5-nanotemplates exist./thinking xhighsupport messaging includes both ids.Actual
git diff --checkpasses.oxlint --type-aware --fixsuccessfully.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
gpt-5.4-miniandgpt-5.4-nanoinherit native OpenAI transport and appear inxhighcapability gating.RUN v4.1.0and timed out locally.Review Conversations
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoFailure Recovery (if this breaks)
5e15fd3f6a.xhighcapability text, or resolving with the wrong provider transport.Risks and Mitigations
gpt-5-nanomay not exist in every upstream catalog yet, so availability depends on template/discovery presence.gpt-5-nanobut falls back togpt-5-minifor bundled catalog derivation, and keeps the direct OpenAI transport normalized.