Repository navigation
fix(openai): show account chat models missing from the manifest for API-key users - #162563
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 5:12 AM ET / 09:12 UTC (Revision 2). ClawSweeper reviewWhat this changesThe OpenAI plugin adds conservative catalog entries for account-listed chat models missing from its manifest and moves API-key discovery tests into a dedicated suite. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still omits account-listed chat models absent from the manifest. The earlier test-cost request is satisfied, the supplied live evidence covers the repaired behavior, and no actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe OpenAI plugin combines account model discovery with bundled model metadata to populate OpenClaw’s model catalog. That catalog feeds model pickers and agent model resolution. flowchart TD
A[Selected API key] --> B[Account model discovery]
B --> C[Account model IDs]
D[Bundled model metadata] --> E[Catalog selection]
C --> E
E --> F[Known rows and conservative chat rows]
F --> G[Model picker and agent execution]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +49, Tests +120. Total +169 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep account discovery in the OpenAI plugin, preserve authored and manifest metadata, and supply conservative metadata only for otherwise undescribed account-visible chat models. Do we have a high-confidence way to reproduce the issue? Yes: current-main source deterministically excludes an account-listed chat ID absent from the manifest. The contributor also records a real before-and-after gpt-5.2 agent turn; this read-only review did not execute target code. Is this the best way to solve the issue? Yes: the patch repairs the existing provider-owned catalog path while preserving known metadata, account filtering, and fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3bbf4c8ebab3. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in c1f5fbe. Bug: with an OpenAI API key, chat models that the account's Fix: the account-intersected catalog (#114258) now also admits current GPT and o-series chat ids. Their rows are conservative and their cost is unknown, so it's omitted rather than shown as ``. Manifest rows still win. Non-chat ids stay hidden, as do the chat-latest/codex/cyber/preview families, which are listed but return 404 on Proof: the regression test fails on |
…PI-key users (openclaw#162563) ## What Problem This Solves Fixes: with an OpenAI API key, chat models that the account's `/v1/models` lists but the bundled manifest doesn't (for example `gpt-5.2`, `gpt-4.1`, `o3`) are missing from `/models`. Selecting one fails with `Unknown model: openai/gpt-5.2`. ## User Impact API-key users can pick and run current GPT and o-series chat models that their account exposes, including future ids that ship before a manifest update. Manifest models keep their existing rows and prices. Admitted models report cost as unknown: the cost is omitted, not shown as `$0`. Media, realtime, search, embedding, legacy, dated-snapshot, fine-tune and experiment ids stay hidden. ## Why This Change Was Made openclaw#114258 intersects the manifest with the account's live catalog so OpenClaw advertises only models the account can use, and manifest metadata wins. This change keeps that intersection. It also admits live ids that match current chat families (`gpt-4o`, `gpt-4.1`, `gpt-5`+, `o1`+) and are neither known route ids nor manifest rows. Admitted rows are deliberately conservative: Responses API, text-only input, 128k context, 16,384 max output tokens, and reasoning only for GPT-5+ and o-series. Their cost uses the existing zero placeholder. Shared usage reporting already treats zero catalog rates as unknown pricing, so it omits the cost instead of reporting `$0`. Some families appear in `/v1/models` but return 404 on `/v1/responses` for the same key: every `*-chat-latest` and `*-cyber` id, and all `*-codex` ids except `gpt-5.3-codex`. They are excluded, along with `preview`, `alpha` and `beta` variants. The admission rules now live in a new `account-models.ts`, and the API-key catalog tests moved to `openai-api-key-catalog.test.ts`. The provider module and its test file stay within their line-count caps. ## Evidence - Regression test `admits account chat models missing from the manifest with conservative metadata` fails on `main` (`expected [ 'gpt-5.5' ]`) and passes on this branch. It covers admitted rows (`gpt-4.1-mini`, a future `gpt-6.2`, `o3`), conservative metadata, the zero cost placeholder, manifest precedence, and 25 excluded ids (snapshot, chat-latest, codex, cyber, preview/alpha/beta, search, audio, realtime, image, embedding, moderation, fine-tune, experiment). - Live before/after with the same real API key against two isolated Gateways built from `main` (`dd8d9f0`) and this branch: - The account's `/v1/models` lists 169 ids. `models.list` showed 16 OpenAI rows on `main` and 34 on the branch. The 18 added ids are `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `gpt-5-pro`, `gpt-5.1`, `gpt-5.2`, `gpt-5.2-pro`, `o1`, `o1-pro`, `o3`, `o3-mini`, `o3-pro` and `o4-mini`. Each one returned 200 from a direct `/v1/responses` probe. The picker gained no non-chat ids. All 16 manifest rows, including `gpt-6.1-sol` from openclaw#161400, are identical on both builds. - Running a turn on `openai/gpt-5.2`: `main` fails with `Unknown model: openai/gpt-5.2`. The branch replies `ok`. The run reports usage (20k input / 5 output tokens) with no `costUsd`, and `/status` shows tokens but no Cost row. - `openai/gpt-6.1-sol` (manifest-owned) works the same on both builds, with priced cost (`$0.0028` on `main`, `$0.0025` on the branch). - `pnpm test extensions/openai/openai-provider.test.ts extensions/openai/openai-api-key-catalog.test.ts`: 70 passed. `pnpm check:changed` passed. - Test cost: the only new test is the regression; the other nine API-key catalog tests moved unchanged out of `openai-provider.test.ts`. Local `pnpm test <file> --maxWorkers=1` wall time is 25.0s for `openai-api-key-catalog.test.ts` (10 tests) and 23.8s for `openai-provider.test.ts` (60 tests), mostly transform. In CI run [36839484116](https://github.com/openclaw/openclaw/actions/runs/36839484116), test time sums to 2.07s and 12.8s; the new regression takes 3ms. - No overlap with Pash/Sarah changes: openclaw#127394 touches only the ChatGPT/Codex discovery path and shared test fixtures. Co-authored-by: Ayaan Zaidi <[email protected]>
## What Problem This Solves
Fixes: when you sign in to OpenAI with an API key, or to xAI or any provider that uses the shared live model listing, chat models the provider lists stay hidden from the model pickers until an OpenClaw release adds them.
## User Impact
User impact: signed-in users see every chat model their provider lists, including models released after their OpenClaw version. Catalog rows still supply names, prices and context limits for models OpenClaw already knows. Embedding, image, video, audio, realtime, speech, transcription, moderation, legacy-completions and retired models stay hidden.
On the OpenAI API-key listing, pre-GPT-5 families (GPT-3.5, GPT-4, GPT-4o, GPT-4.1, o1, o3, o4, and fine-tunes of them) are now hidden from `models list` and the pickers, including the 11 such rows `main` shows today. Ayaan chose this over changing the default runtime: these models fail on the default runtime, so listing them offers a choice that breaks on the first turn. GPT-5+ and IDs OpenClaw does not recognize keep appearing without a release.
Existing setups keep working: a pre-GPT-5 model named as the default model, an `agents.defaults.models` key, an allowlist entry or a session model override still resolves, with the same conservative metadata the listing used to give it. To use one, reference it and pin the OpenClaw runtime:
```json5
{
agents: {
defaults: {
model: { primary: "openai/gpt-4o" },
models: { "openai/gpt-4o": { agentRuntime: { id: "openclaw" } } },
},
},
}
```
## Why This Change Was Made
- **Shared listing.** `buildLiveModelProviderConfig` without `projectRows` used to keep only the static rows whose IDs were listed. It now runs listed rows through the existing shared chat classifier, the same one that `liveModelDiscovery` already uses. Static rows describe matching IDs, and other chat IDs get conservative rows. The plugin's `readModelId` selector still runs first (default: `id` on `object: "model"` rows, as on `main`): the ID it returns names the row, and a row it rejects stays out. Strict and advisory failure handling is unchanged: a failed listing keeps the fallback rows, and a successful empty listing stays empty. The direct consumer is the xAI API-key catalog. Third-party plugins that call this helper without `projectRows` get the same behavior; `docs/plugins/sdk-provider-plugins/model-catalogs.md` now describes this default and how `readModelId` restricts it.
- **Classifier.** The classifier also excludes realtime, audio, bare `image`/`video` IDs and legacy completions models (`babbage`, `davinci`, `gpt-3.5-turbo-instruct`), plus rows whose `shutdown_date` has passed. On the real OpenAI listing, all 25 rows with a past shutdown date fail on `/v1/responses` (22 × 404, 3 × 400). Exclusions also apply to IDs in the static catalog. `<modality>-text-to-text` kinds (Hugging Face vision/audio chat models) stay admitted.
- **OpenAI API key.** The catalog now uses the same shared builder. This removes the GPT-4o/4.1/5+/o family allowlist and the broad deny list from #162563. OpenClaw sends API-key turns through the Responses API, so narrow, named exclusions remain:
- Pre-GPT-5 families (`^(?:ft:)?(?:gpt-3\.5|gpt-4|o[134])`): on the default runtime the Codex harness rejects every one of them with `400 Invalid value: 'custom'`, and 13 of them (gpt-3.5, gpt-4, gpt-4-turbo, gpt-4.1-nano, o1, o3-mini and snapshots) also reject hosted web search on the OpenClaw runtime. The rule also applies to catalog rows; the OpenAI manifest has none of these families (on `main` they came only from #162563's allowlist). Hiding only affects browsing: the OpenAI provider's `resolveDynamicModel` hook, which core calls only for a specific selected ref, returns the same conservative row for these IDs, so config defaults, allowlist entries and session overrides still resolve.
- `search` models: Chat Completions only, per the [official model page](https://developers.openai.com/api/docs/models/gpt-4o-search-preview). On our key, `/v1/responses` returned 400 "not supported with the Responses API".
- `live`, `cyber`, experiment (`exp`) and `alpha` codename IDs: our key lists them, but `/v1/responses` returns 404 or a persistent 500 for them.
- Subscription-only route IDs (`gpt-5.3-codex-spark`) stay hidden, so the platform and ChatGPT routes stay separate.
OpenAI IDs without a catalog row keep the existing conservative metadata from #162563 (Responses, text input, 128k context, 16,384 max output, reasoning for GPT-5+ and o-series, unknown cost). The shared prefix template is not used for OpenAI: every OpenAI ID starts with `gpt-`, so an unknown ID would inherit GPT-5 reasoning settings from an unrelated row.
- **xAI.** Multi-agent models stay hidden: they reject the client-side tools that every OpenClaw turn sends (documented xAI limitation).
- Retained gates: Anthropic `acceptUnknownModel`, OpenAI OAuth visibility, xAI OAuth backend eligibility, Google, Bedrock, Copilot, routed providers, replace mode and allowlists are unchanged.
## Evidence
**Regression tests (each fails on `main`, passes here):**
- `src/plugin-sdk/provider-catalog-live-runtime.test.ts`: a listed unknown chat ID shows. Realtime, audio, image, video, legacy-completions and past-shutdown rows stay out, including a static ID with image-only output. A Hugging Face `image-text-to-text` row stays. A failed listing keeps the static rows. The existing strict test still covers authoritative empty and failure.
- `src/plugin-sdk/provider-catalog-live-runtime.test.ts` (selector): a strict plugin whose selector reads `slug` keeps static `model-a`, admits an unknown `fresh-chat` slug, drops a `fresh-embedding` slug, and keeps out an ordinary `{ id: "model-b", object: "model" }` row the selector rejects. On `ceaccc6` it fails (received only `model-b`); on this head it passes.
- `extensions/openai/openai-api-key-catalog.test.ts`: dated snapshots, `gpt-5.3-codex` and a future `gpt-6.2` show with conservative metadata. `gpt-4-0613`, `gpt-4.1-mini`, `o3` and an `ft:gpt-4.1-mini:...` fine-tune stay hidden, as do search, live, cyber, experiment, alpha, subscription-only, non-chat and retired IDs. Without the pre-GPT-5 rule the test fails (1 failed, 6 passed); with it, 7/7 pass. A listing with only non-chat IDs is authoritative-empty.
- `extensions/xai/index.test.ts`: an unknown `grok-5-preview` shows. Multi-agent and `grok-imagine-*` stay hidden.
- `extensions/openai/openai-dynamic-model.test.ts`: selected `gpt-4o`, `o3` and `ft:gpt-4.1-mini:...` refs resolve through `resolveDynamicModel` with the conservative listing row (reasoning only for `o3`). Without the hook change, all 3 fail; with it, the 3 OpenAI suites pass 84/84.
**Real OpenAI API key, isolated profiles** (`pnpm openclaw --profile <p> models list --provider openai --all --refresh --plain`; key read into process memory only):
- `/v1/models` listed 168 rows. `main` (`6070074`, this branch's base) shows **33**, this branch shows **36**. The 11 `main` rows that disappear are all pre-GPT-5: gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, o1, o1-pro, o3, o3-mini, o3-pro, o4-mini. The 14 new rows are dated GPT-5 snapshots and `gpt-5.3-codex`.
- Each listed ID got one direct `/v1/responses` call. Every row shown here returned 200, except `gpt-daybreak-red-latest` (a manifest row `main` also shows; 404 for this key).
- Rows hidden on this branch, by family: image 10, realtime 10, transcription 7, TTS 7, audio 6, embeddings 3, moderation 2, `gpt-3.5-turbo-instruct` 2, Sora 2, Whisper 1, Babbage 1, Davinci 1, past shutdown date 18 (the other 7 already fall under a family above), experiment 22, search 4, cyber 2, alpha 2, live 1, pre-GPT-5 31.
**Real turns through an isolated Gateway:**
- `main`: `openai/gpt-4o-2024-11-20` fails with `Unknown model`.
- Branch, default runtime: every shown row was run in the earlier matrix, including the `*-pro` rows (only `o1-pro`, now hidden, was skipped for cost). All 35 shown rows other than `gpt-daybreak-red-latest` reply on the default (Codex) runtime. `chat-latest` and `gpt-5.5-2026-04-23` were re-run on `897f27f` and reply `ROW_OK` with `agentHarnessId: "codex"`. `gpt-daybreak-red-latest` fails on both runtimes with "model not found" for this key; `main` shows it too.
- Before the pre-GPT-5 rule, 29 shown rows failed on the default runtime with `Invalid value: 'custom'`; all 29 are now hidden.
- Upgrade check, `main` (`6070074`) vs this branch, one turn each, isolated profiles:
1. `agents.defaults.model.primary: "openai/gpt-4o"` plus its `agentRuntime.id: "openclaw"`, nothing else: `main` replies `C1_OK`. Before the hook change, the branch failed with `Unknown model: openai/gpt-4o`; on this head it replies `C1_OK` (`agentHarnessId: "openclaw"`).
2. Existing session with a `gpt-4o` override set through `sessions.patch` (`modelOverride: "gpt-4o"`), then a turn in that session: `main` replies `C2_OK`. Before the hook change, the branch failed with `Unknown model`; on this head it replies `C2_OK` (`agentHarnessId: "openclaw"`).
- With a `models.providers.openai` row for `gpt-4o` as well, it replies `GPT4O_OK` on `897f27f`.
- `models list --provider openai --all --refresh --plain` on this head still shows 36 rows, none of them pre-GPT-5.
- Hosted web search on old models: a direct `/v1/responses` call to `o3-mini` with `tools: [{ type: "web_search" }]` returns 400 "Tool 'web_search_preview' is not supported with o3-mini."; the same call without the tool returns 200. `docs/providers/openai/models.md` now says these models need `tools.web.search.provider` set to a managed provider or `tools.web.search.enabled: false` (the two switches `resolveNativeWebSearch` in `extensions/openai/native-web-search-policy.ts` checks, documented in `docs/tools/web.md#native-openai-web-search`).
**Shared default listing through a third-party plugin and a fake OpenAI-compatible server** (the xAI API-key path uses the same builder; no xAI key was available):
- `main`: `models list --provider listing-fixture --all --refresh --plain` shows only `fixture-known`, and a turn on `fixture-chat-next` fails with `Unknown model`.
- Branch: the same command shows `fixture-known` and `fixture-chat-next`. Embedding, realtime, image and audio rows stay hidden. The turn replies `FIXTURE_OK from fixture-chat-next`.
**Checks:** On `f6e1266`, `node scripts/check-changed.mjs` passes every lane except the dead-export scan, which fails only on `src/talk/client-voice-session-store.ts: ClientVoiceToolEffect`, a file this PR does not touch (same as on `897f27f`). `pnpm exec oxlint --type-aware` on the changed SDK files is clean. Focused tests on `f6e1266`: SDK live-runtime + strict 25/25, OpenAI API-key catalog + dynamic-model 44/44, xAI 47/47.
**Known gaps:** `gpt-5.6` would show with conservative metadata if listed, because the manifest has no row for it. The hosted-search restriction for gpt-3.5, gpt-4, gpt-4-turbo, gpt-4.1-nano, o1 and o3-mini is now documented and was checked with a raw `o3-mini` API call; a full OpenClaw turn on one of these models with web search off was not run. A selected pre-GPT-5 ref now resolves even when the key does not list it (`main` reported `Unknown model` for unlisted IDs), so such a turn fails at OpenAI instead of before the request.
No overlap with Pash/Sarah changes: `git log origin/main [email protected] [email protected]` shows no commits to the touched files.
**Merge danger:** two-way door. There are no schema, config, stored-data or protocol changes, and a revert restores the old lists. Blast radius: model pickers and `models list` for signed-in OpenAI API-key users, xAI API-key users, and plugins that call `buildLiveModelProviderConfig` without `projectRows`. The shared classifier's new exclusions also apply to every `liveModelDiscovery` provider. Pre-GPT-5 OpenAI models drop out of the browse lists but still resolve when referenced; on the default runtime they fail as they do on `main`. Worst case otherwise, a listed model that OpenClaw cannot drive shows up and fails on its first turn instead of being hidden.
Co-authored-by: Ayaan Zaidi <[email protected]>
…aw#167462) ## What Problem This Solves Fixes: when you sign in to OpenAI with an API key, or to xAI or any provider that uses the shared live model listing, chat models the provider lists stay hidden from the model pickers until an OpenClaw release adds them. ## User Impact User impact: signed-in users see every chat model their provider lists, including models released after their OpenClaw version. Catalog rows still supply names, prices and context limits for models OpenClaw already knows. Embedding, image, video, audio, realtime, speech, transcription, moderation, legacy-completions and retired models stay hidden. On the OpenAI API-key listing, pre-GPT-5 families (GPT-3.5, GPT-4, GPT-4o, GPT-4.1, o1, o3, o4, and fine-tunes of them) are now hidden from `models list` and the pickers, including the 11 such rows `main` shows today. Ayaan chose this over changing the default runtime: these models fail on the default runtime, so listing them offers a choice that breaks on the first turn. GPT-5+ and IDs OpenClaw does not recognize keep appearing without a release. Existing setups keep working: a pre-GPT-5 model named as the default model, an `agents.defaults.models` key, an allowlist entry or a session model override still resolves, with the same conservative metadata the listing used to give it. To use one, reference it and pin the OpenClaw runtime: ```json5 { agents: { defaults: { model: { primary: "openai/gpt-4o" }, models: { "openai/gpt-4o": { agentRuntime: { id: "openclaw" } } }, }, }, } ``` ## Why This Change Was Made - **Shared listing.** `buildLiveModelProviderConfig` without `projectRows` used to keep only the static rows whose IDs were listed. It now runs listed rows through the existing shared chat classifier, the same one that `liveModelDiscovery` already uses. Static rows describe matching IDs, and other chat IDs get conservative rows. The plugin's `readModelId` selector still runs first (default: `id` on `object: "model"` rows, as on `main`): the ID it returns names the row, and a row it rejects stays out. Strict and advisory failure handling is unchanged: a failed listing keeps the fallback rows, and a successful empty listing stays empty. The direct consumer is the xAI API-key catalog. Third-party plugins that call this helper without `projectRows` get the same behavior; `docs/plugins/sdk-provider-plugins/model-catalogs.md` now describes this default and how `readModelId` restricts it. - **Classifier.** The classifier also excludes realtime, audio, bare `image`/`video` IDs and legacy completions models (`babbage`, `davinci`, `gpt-3.5-turbo-instruct`), plus rows whose `shutdown_date` has passed. On the real OpenAI listing, all 25 rows with a past shutdown date fail on `/v1/responses` (22 × 404, 3 × 400). Exclusions also apply to IDs in the static catalog. `<modality>-text-to-text` kinds (Hugging Face vision/audio chat models) stay admitted. - **OpenAI API key.** The catalog now uses the same shared builder. This removes the GPT-4o/4.1/5+/o family allowlist and the broad deny list from openclaw#162563. OpenClaw sends API-key turns through the Responses API, so narrow, named exclusions remain: - Pre-GPT-5 families (`^(?:ft:)?(?:gpt-3\.5|gpt-4|o[134])`): on the default runtime the Codex harness rejects every one of them with `400 Invalid value: 'custom'`, and 13 of them (gpt-3.5, gpt-4, gpt-4-turbo, gpt-4.1-nano, o1, o3-mini and snapshots) also reject hosted web search on the OpenClaw runtime. The rule also applies to catalog rows; the OpenAI manifest has none of these families (on `main` they came only from openclaw#162563's allowlist). Hiding only affects browsing: the OpenAI provider's `resolveDynamicModel` hook, which core calls only for a specific selected ref, returns the same conservative row for these IDs, so config defaults, allowlist entries and session overrides still resolve. - `search` models: Chat Completions only, per the [official model page](https://developers.openai.com/api/docs/models/gpt-4o-search-preview). On our key, `/v1/responses` returned 400 "not supported with the Responses API". - `live`, `cyber`, experiment (`exp`) and `alpha` codename IDs: our key lists them, but `/v1/responses` returns 404 or a persistent 500 for them. - Subscription-only route IDs (`gpt-5.3-codex-spark`) stay hidden, so the platform and ChatGPT routes stay separate. OpenAI IDs without a catalog row keep the existing conservative metadata from openclaw#162563 (Responses, text input, 128k context, 16,384 max output, reasoning for GPT-5+ and o-series, unknown cost). The shared prefix template is not used for OpenAI: every OpenAI ID starts with `gpt-`, so an unknown ID would inherit GPT-5 reasoning settings from an unrelated row. - **xAI.** Multi-agent models stay hidden: they reject the client-side tools that every OpenClaw turn sends (documented xAI limitation). - Retained gates: Anthropic `acceptUnknownModel`, OpenAI OAuth visibility, xAI OAuth backend eligibility, Google, Bedrock, Copilot, routed providers, replace mode and allowlists are unchanged. ## Evidence **Regression tests (each fails on `main`, passes here):** - `src/plugin-sdk/provider-catalog-live-runtime.test.ts`: a listed unknown chat ID shows. Realtime, audio, image, video, legacy-completions and past-shutdown rows stay out, including a static ID with image-only output. A Hugging Face `image-text-to-text` row stays. A failed listing keeps the static rows. The existing strict test still covers authoritative empty and failure. - `src/plugin-sdk/provider-catalog-live-runtime.test.ts` (selector): a strict plugin whose selector reads `slug` keeps static `model-a`, admits an unknown `fresh-chat` slug, drops a `fresh-embedding` slug, and keeps out an ordinary `{ id: "model-b", object: "model" }` row the selector rejects. On `ceaccc6` it fails (received only `model-b`); on this head it passes. - `extensions/openai/openai-api-key-catalog.test.ts`: dated snapshots, `gpt-5.3-codex` and a future `gpt-6.2` show with conservative metadata. `gpt-4-0613`, `gpt-4.1-mini`, `o3` and an `ft:gpt-4.1-mini:...` fine-tune stay hidden, as do search, live, cyber, experiment, alpha, subscription-only, non-chat and retired IDs. Without the pre-GPT-5 rule the test fails (1 failed, 6 passed); with it, 7/7 pass. A listing with only non-chat IDs is authoritative-empty. - `extensions/xai/index.test.ts`: an unknown `grok-5-preview` shows. Multi-agent and `grok-imagine-*` stay hidden. - `extensions/openai/openai-dynamic-model.test.ts`: selected `gpt-4o`, `o3` and `ft:gpt-4.1-mini:...` refs resolve through `resolveDynamicModel` with the conservative listing row (reasoning only for `o3`). Without the hook change, all 3 fail; with it, the 3 OpenAI suites pass 84/84. **Real OpenAI API key, isolated profiles** (`pnpm openclaw --profile <p> models list --provider openai --all --refresh --plain`; key read into process memory only): - `/v1/models` listed 168 rows. `main` (`618f4d2`, this branch's base) shows **33**, this branch shows **36**. The 11 `main` rows that disappear are all pre-GPT-5: gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, o1, o1-pro, o3, o3-mini, o3-pro, o4-mini. The 14 new rows are dated GPT-5 snapshots and `gpt-5.3-codex`. - Each listed ID got one direct `/v1/responses` call. Every row shown here returned 200, except `gpt-daybreak-red-latest` (a manifest row `main` also shows; 404 for this key). - Rows hidden on this branch, by family: image 10, realtime 10, transcription 7, TTS 7, audio 6, embeddings 3, moderation 2, `gpt-3.5-turbo-instruct` 2, Sora 2, Whisper 1, Babbage 1, Davinci 1, past shutdown date 18 (the other 7 already fall under a family above), experiment 22, search 4, cyber 2, alpha 2, live 1, pre-GPT-5 31. **Real turns through an isolated Gateway:** - `main`: `openai/gpt-4o-2024-11-20` fails with `Unknown model`. - Branch, default runtime: every shown row was run in the earlier matrix, including the `*-pro` rows (only `o1-pro`, now hidden, was skipped for cost). All 35 shown rows other than `gpt-daybreak-red-latest` reply on the default (Codex) runtime. `chat-latest` and `gpt-5.5-2026-04-23` were re-run on `897f27f` and reply `ROW_OK` with `agentHarnessId: "codex"`. `gpt-daybreak-red-latest` fails on both runtimes with "model not found" for this key; `main` shows it too. - Before the pre-GPT-5 rule, 29 shown rows failed on the default runtime with `Invalid value: 'custom'`; all 29 are now hidden. - Upgrade check, `main` (`618f4d2`) vs this branch, one turn each, isolated profiles: 1. `agents.defaults.model.primary: "openai/gpt-4o"` plus its `agentRuntime.id: "openclaw"`, nothing else: `main` replies `C1_OK`. Before the hook change, the branch failed with `Unknown model: openai/gpt-4o`; on this head it replies `C1_OK` (`agentHarnessId: "openclaw"`). 2. Existing session with a `gpt-4o` override set through `sessions.patch` (`modelOverride: "gpt-4o"`), then a turn in that session: `main` replies `C2_OK`. Before the hook change, the branch failed with `Unknown model`; on this head it replies `C2_OK` (`agentHarnessId: "openclaw"`). - With a `models.providers.openai` row for `gpt-4o` as well, it replies `GPT4O_OK` on `897f27f`. - `models list --provider openai --all --refresh --plain` on this head still shows 36 rows, none of them pre-GPT-5. - Hosted web search on old models: a direct `/v1/responses` call to `o3-mini` with `tools: [{ type: "web_search" }]` returns 400 "Tool 'web_search_preview' is not supported with o3-mini."; the same call without the tool returns 200. `docs/providers/openai/models.md` now says these models need `tools.web.search.provider` set to a managed provider or `tools.web.search.enabled: false` (the two switches `resolveNativeWebSearch` in `extensions/openai/native-web-search-policy.ts` checks, documented in `docs/tools/web.md#native-openai-web-search`). **Shared default listing through a third-party plugin and a fake OpenAI-compatible server** (the xAI API-key path uses the same builder; no xAI key was available): - `main`: `models list --provider listing-fixture --all --refresh --plain` shows only `fixture-known`, and a turn on `fixture-chat-next` fails with `Unknown model`. - Branch: the same command shows `fixture-known` and `fixture-chat-next`. Embedding, realtime, image and audio rows stay hidden. The turn replies `FIXTURE_OK from fixture-chat-next`. **Checks:** On `f6e1266`, `node scripts/check-changed.mjs` passes every lane except the dead-export scan, which fails only on `src/talk/client-voice-session-store.ts: ClientVoiceToolEffect`, a file this PR does not touch (same as on `897f27f`). `pnpm exec oxlint --type-aware` on the changed SDK files is clean. Focused tests on `f6e1266`: SDK live-runtime + strict 25/25, OpenAI API-key catalog + dynamic-model 44/44, xAI 47/47. **Known gaps:** `gpt-5.6` would show with conservative metadata if listed, because the manifest has no row for it. The hosted-search restriction for gpt-3.5, gpt-4, gpt-4-turbo, gpt-4.1-nano, o1 and o3-mini is now documented and was checked with a raw `o3-mini` API call; a full OpenClaw turn on one of these models with web search off was not run. A selected pre-GPT-5 ref now resolves even when the key does not list it (`main` reported `Unknown model` for unlisted IDs), so such a turn fails at OpenAI instead of before the request. No overlap with Pash/Sarah changes: `git log origin/main [email protected] [email protected]` shows no commits to the touched files. **Merge danger:** two-way door. There are no schema, config, stored-data or protocol changes, and a revert restores the old lists. Blast radius: model pickers and `models list` for signed-in OpenAI API-key users, xAI API-key users, and plugins that call `buildLiveModelProviderConfig` without `projectRows`. The shared classifier's new exclusions also apply to every `liveModelDiscovery` provider. Pre-GPT-5 OpenAI models drop out of the browse lists but still resolve when referenced; on the default runtime they fail as they do on `main`. Worst case otherwise, a listed model that OpenClaw cannot drive shows up and fails on its first turn instead of being hidden. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes: with an OpenAI API key, chat models that the account's
/v1/modelslists but the bundled manifest doesn't (for examplegpt-5.2,gpt-4.1,o3) are missing from/models. Selecting one fails withUnknown model: openai/gpt-5.2.User Impact
API-key users can pick and run current GPT and o-series chat models that their account exposes, including future ids that ship before a manifest update. Manifest models keep their existing rows and prices. Admitted models report cost as unknown: the cost is omitted, not shown as
$0. Media, realtime, search, embedding, legacy, dated-snapshot, fine-tune and experiment ids stay hidden.Why This Change Was Made
#114258 intersects the manifest with the account's live catalog so OpenClaw advertises only models the account can use, and manifest metadata wins. This change keeps that intersection. It also admits live ids that match current chat families (
gpt-4o,gpt-4.1,gpt-5+,o1+) and are neither known route ids nor manifest rows.Admitted rows are deliberately conservative: Responses API, text-only input, 128k context, 16,384 max output tokens, and reasoning only for GPT-5+ and o-series. Their cost uses the existing zero placeholder. Shared usage reporting already treats zero catalog rates as unknown pricing, so it omits the cost instead of reporting
$0.Some families appear in
/v1/modelsbut return 404 on/v1/responsesfor the same key: every*-chat-latestand*-cyberid, and all*-codexids exceptgpt-5.3-codex. They are excluded, along withpreview,alphaandbetavariants. The admission rules now live in a newaccount-models.ts, and the API-key catalog tests moved toopenai-api-key-catalog.test.ts. The provider module and its test file stay within their line-count caps.Evidence
admits account chat models missing from the manifest with conservative metadatafails onmain(expected [ 'gpt-5.5' ]) and passes on this branch. It covers admitted rows (gpt-4.1-mini, a futuregpt-6.2,o3), conservative metadata, the zero cost placeholder, manifest precedence, and 25 excluded ids (snapshot, chat-latest, codex, cyber, preview/alpha/beta, search, audio, realtime, image, embedding, moderation, fine-tune, experiment).main(d0f06ee) and this branch:/v1/modelslists 169 ids.models.listshowed 16 OpenAI rows onmainand 34 on the branch. The 18 added ids aregpt-4.1,gpt-4.1-mini,gpt-4.1-nano,gpt-4o,gpt-4o-mini,gpt-5,gpt-5-mini,gpt-5-nano,gpt-5-pro,gpt-5.1,gpt-5.2,gpt-5.2-pro,o1,o1-pro,o3,o3-mini,o3-proando4-mini. Each one returned 200 from a direct/v1/responsesprobe. The picker gained no non-chat ids. All 16 manifest rows, includinggpt-6.1-solfrom feat(openai): support GPT-6.1 Sol #161400, are identical on both builds.openai/gpt-5.2:mainfails withUnknown model: openai/gpt-5.2. The branch repliesok. The run reports usage (20k input / 5 output tokens) with nocostUsd, and/statusshows tokens but no Cost row.openai/gpt-6.1-sol(manifest-owned) works the same on both builds, with priced cost ($0.0028onmain,$0.0025on the branch).pnpm test extensions/openai/openai-provider.test.ts extensions/openai/openai-api-key-catalog.test.ts: 70 passed.pnpm check:changedpassed.openai-provider.test.ts. Localpnpm test <file> --maxWorkers=1wall time is 25.0s foropenai-api-key-catalog.test.ts(10 tests) and 23.8s foropenai-provider.test.ts(60 tests), mostly transform. In CI run 36839484116, test time sums to 2.07s and 12.8s; the new regression takes 3ms.