ISSUE DESCRIPTION /v1/models: return the full catalog with per-model availability +…
- User
ISSUE DESCRIPTION
/v1/models: return the full catalog with per-model availability + opt-in filter Split out from #242.
Current: `GET /v1/models` returns only models that are connected right now (enabled AND an enabled key can serve them).
Wanted: by default return the whole catalog (one entry per model id), each annotated with whether it's usable, plus an opt-in filter to get just the connected ones.
Per-model annotation:
- `available`: boolean — enabled AND a matching enabled key exists.
- `unavailable_reason`: `null` | `"no_key"` (enabled, no key) | `"disabled"` (catalog row disabled).
Filter:
- `?available=true` (alias `?connected=true`) → only connected models (the previous default behavior).
Notes:
- The extra fields are additive — OpenAI-compatible clients ignore unknown fields.
- Dedup prefers an available instance of a model id over a disabled/keyless one.
- The `auto` virtual model is always `available: true`.
Interface
No new interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- Assistant
I'll start by exploring the repository structure and locating the current
/v1/modelsimplementation. - Assistant
Let me focus on the server code and find the models endpoint.
- Assistant
Found it -
server/src/routes/models.ts. Let me read that file and related tests. - Assistant
The admin route isn't the OpenAI
/v1/modelsendpoint. Searching for that specifically. - Assistant
Reading the
/v1/modelshandler and its tests. - Assistant
Checking git history and any related PR/docs for this feature.
- Assistant
Let me search for issue #242 and any related PR discussions. Also look at ModelListRow type and surrounding proxy code.
- Assistant
Let me look at git history or GitHub issues related to #242 more carefully. Also check if there's a PR branch with this feature partially done.
- Assistant
Inspecting the models table schema and how availability is determined via keys.
- Assistant
The grep for CREATE TABLE had no matches - maybe migrations are different. Let me check db schema more carefully.
- Assistant
Let me look at migrations.ts for model schema
- Assistant
Checking other call sites that use
/v1/modelsand reviewing how the key matching works in the router. - Assistant
Implementing the catalog listing with availability annotations and the opt-in filter.
- Assistant
I'll replace the models endpoint implementation and clean up the unused ModelListRow import if needed.
- Assistant
Checking whether the
ModelListRowimport is still used. - Assistant
Removing the unused import.
- Assistant
Need to open that line or use --file option
- Assistant
The replace tool requires the file to be open at that location. Let me goto line 5.
- Assistant
Now I can replace the import.
- Assistant
Writing a quick verification script and running the existing tests.
- Assistant
Existing tests pass. Writing a temporary script to verify the new availability annotations and filter.
- Assistant
Fixing the temp test setup to match the existing tests more carefully.
- Assistant
All temp tests passed. Cleaning up and checking keyless platform handling.
- Assistant
I'm already in server directory.
- Assistant
Keyless platforms need special handling — checking how the router treats them for availability.
- Assistant
Keyless platforms still use sentinel key rows — our availability check matches the router. Removing the temp test file.
- Assistant
All route tests passed. Verifying the final implementation one more time.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.