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`.
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.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /freellmapi, current file: none) bash-$
- Assistant
I’ll inspect the repository to locate the
/v1/modelshandler, catalog/key availability logic, and relevant tests. Then I’ll implement the default full-catalog response and query filters while preserving compatibility, run focused tests (and broader tests if practical), and review the final diff. - Assistant
The repository is a TypeScript/Node application. The initial broad search was noisy because of dependencies, so I’ll narrow inspection to
server, identify route registration and data schema/query helpers, and check package scripts before editing. - Assistant
The relevant endpoint is
GET /v1/modelsinproxy.ts; it currently filters SQL to enabled rows with an enabled key and returns only OpenAI metadata. I’ll change that endpoint to load all catalog rows, compute availability using platform/key binding rules (including customkey_id), deduplicate by publicmodel_idwith available rows preferred, and applyavailable=trueorconnected=trueonly when requested. The virtualautoentry will always carryavailable: trueandunavailable_reason: null. - Assistant
The first edit command did not modify anything because this environment lacks
python3; the build still passes unchanged. I’ll apply the same targeted replacement using Node’s available runtime, then compile and inspect the diff. - Assistant
The endpoint is now changed and the server compiles successfully. I’ll run the server test suite, then perform a small runtime check against an in-memory app/database to verify default versus filtered catalog behavior and the annotation values, especially with no keys.
- Assistant
The test command itself failed before running tests because Vitest does not support the extra
--runInBand=falseoption I supplied. I’ll rerun using the repository’s exact test script without that option. - Assistant
All 46 server test files (456 tests) pass, and the server build and whitespace checks pass. The implementation also preserves authentication and the existing OpenAI response envelope while adding only fields. I’ll make one minor type accuracy cleanup (
availableis SQLite’s integer result), review status/diff, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- xiaomi/mimo-v2.5-proCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-lunaCompare side by side →