🥷 feat: Add showInMenu Option to Model Specs - #14034
Conversation
Add an optional `showInMenu` flag to model specs. When set to false, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but remains resolvable server-side by name — a request that sends `spec: "<name>"` still works, since server-side resolution uses the full, unfiltered list. Unlike `showIconInMenu` (which only hides the icon), this hides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected. Adds an `excludeHiddenModelSpecs()` helper (applied before `sanitizeModelSpecs`) plus unit tests.
There was a problem hiding this comment.
Pull request overview
Adds a new optional showInMenu flag to model specs so specific specs can be hidden from the client model selector and /api/config output while remaining resolvable server-side by name.
Changes:
- Extend
TModelSpec+ zod schema withshowInMenu?: boolean. - Add
excludeHiddenModelSpecs()helper to filtershowInMenu: falseentries from advertised config. - Apply the filter in
GET /api/configbeforesanitizeModelSpecs, and add unit tests for the helper.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/data-provider/src/models.ts | Adds showInMenu to the model spec type and schema for config parsing/typing. |
| packages/api/src/modelSpecs/index.ts | Introduces excludeHiddenModelSpecs() to filter hidden specs from client-advertised config. |
| packages/api/src/modelSpecs/excludeHiddenModelSpecs.test.ts | Unit tests covering filter behavior, backwards compatibility, and non-mutation. |
| api/server/routes/config.js | Wires excludeHiddenModelSpecs() into the /api/config payload before sanitization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
showInMenu option to model specs
showInMenu option to model specsshowInMenu Option to Model Specs
Add an optional `showInMenu` flag to model specs. When set to false, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but remains resolvable server-side by name — a request that sends `spec: "<name>"` still works, since server-side resolution uses the full, unfiltered list. Unlike `showIconInMenu` (which only hides the icon), this hides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected. Adds an `excludeHiddenModelSpecs()` helper (applied before `sanitizeModelSpecs`) plus unit tests. (cherry picked from commit ac759ef)
Add an optional `showInMenu` flag to model specs. When set to false, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but remains resolvable server-side by name — a request that sends `spec: "<name>"` still works, since server-side resolution uses the full, unfiltered list. Unlike `showIconInMenu` (which only hides the icon), this hides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected. Adds an `excludeHiddenModelSpecs()` helper (applied before `sanitizeModelSpecs`) plus unit tests.
Add an optional `showInMenu` flag to model specs. When set to false, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but remains resolvable server-side by name — a request that sends `spec: "<name>"` still works, since server-side resolution uses the full, unfiltered list. Unlike `showIconInMenu` (which only hides the icon), this hides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected. Adds an `excludeHiddenModelSpecs()` helper (applied before `sanitizeModelSpecs`) plus unit tests.
Add an optional `showInMenu` flag to model specs. When set to false, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but remains resolvable server-side by name — a request that sends `spec: "<name>"` still works, since server-side resolution uses the full, unfiltered list. Unlike `showIconInMenu` (which only hides the icon), this hides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected. Adds an `excludeHiddenModelSpecs()` helper (applied before `sanitizeModelSpecs`) plus unit tests.
Summary
Adds an optional
showInMenuflag to model specs. When set tofalse, the spec is dropped from the model selector menu and from the client startup config (GET /api/config), but it remains resolvable server-side by name — a request that sendsspec: "<name>"still works, because server-side resolution uses the full, unfiltered list.This is useful when an integration (or any external caller) needs to invoke a spec by name without exposing it to end users in the model picker.
Unlike
showIconInMenu(which only hides the icon),showInMenuhides the whole entry. The flag is optional and defaults to listed, so existing specs are unaffected.Implementation
excludeHiddenModelSpecs()helper inpackages/api/src/modelSpecsthat filters outshowInMenu: falsespecs. It is non-mutating, treats an omitted flag as listed (backwards compatible), and returns the config unchanged when there is nolist.GET /api/config(api/server/routes/config.js), applied beforesanitizeModelSpecs.showInMenufield onTModelSpecand its zod schema (packages/data-provider/src/models.ts).No new dependencies. A corresponding docs update for the
librechat.airepo can follow if this is accepted.Change Type
Testing
Unit tests — added
packages/api/src/modelSpecs/excludeHiddenModelSpecs.test.ts, covering:showInMenu: false, keepstrueand omitted-flag specs;list(includingundefined/null) are returned unchanged.Manual
showInMenu: falsetolibrechat.yaml, alongside at least one normal spec.modelSpecs.listof theGET /api/configresponse.spec: "<hidden spec name>"— confirm it resolves and runs with that spec's preset/prompt.showInMenu: trueor no flag still appear as before.Test Configuration:
librechat.yamlwith at least oneshowInMenu: falsespec and one normal spec.Checklist