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
Let me start by exploring the repository structure to understand the codebase and then work on implementing the changes described in the issue.
Assistant
That doesn't seem right. Let me look more broadly.
Assistant
This looks like a TypeScript/JavaScript project, not Python. Let me explore the server directory.
Assistant
It's a TypeScript project. Let me explore the server/src directory.
Assistant
Let me look at the relevant files. The issue is about
GET /v1/models.Assistant
The open command doesn't work. Let me use bash to read the file.
Assistant
Let me understand the database schema and the current behavior
Assistant
Let me look at the migrations to understand the schema:
Assistant
Let me look at the providers and the test files for models
Assistant
Now let's check the existing tests for models:
Assistant
Let me search for model-related test files and the app.ts to understand routing
Assistant
Let me look at the app.ts to see how the models router is mounted:
Assistant
Let me check the proxy router - the models endpoint for
/v1/modelsmight be there:Assistant
Let me check the shared types to understand the ModelListRow
Assistant
Now let me look at the router service to understand what information it provides about model availability:
Assistant
Let me first run the existing tests to establish a baseline:
Assistant
Let me try running the tests. But first, let me check the vitest config:
Assistant
All 456 tests pass. Now let me write a reproduce script to understand the current behavior:
Assistant
Let me write the test script inside the repo instead
Assistant
Good, I can see the current behavior clearly. Now let me implement the changes. Let me start by modifying the
/v1/modelsendpoint inproxy.ts:Assistant
Let me see the exact lines to replace. Let me read lines 121-192 of proxy.ts:
Assistant
Now let me modify the
/v1/modelshandler in proxy.ts. I'll use the edit command with a heredoc:Assistant
Let me verify the patch was applied correctly:
Assistant
Now let me check if
ModelListRowtype is still used elsewhere - since we no longer use it in proxyAssistant
Let me clean up the unused import and run the test:
Assistant
Now let me run the test to verify the changes:
Assistant
The changes are working correctly. Let me now run the full test suite:
Assistant
All 456 tests pass. Let me clean up the
Assistant
Let me check if keyless providers have sentinel keys in the database:
Assistant
Let me verify the import cleanup was successful
Assistant
Let me also write a quick test to simulate having keys and verify the available filtering works properly
Assistant
The implementation is working correctly. Let me clean up the test file and run the full test suite one final time:
Assistant
Let me verify the final state of my changes:
Assistant
Let me run the full test suite one final time to confirm everything
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 →