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.
- 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.
Assistant
This appears to be a JavaScript/TypeScript project. Let me look at the structure more.
Assistant
Now let me look at the models route file and related services.
Assistant
Let me find the
/v1/modelsendpoint specifically.Assistant
Let me look at the proxy router and app.ts.
Assistant
Let me view the full
/modelsendpoint section in proxy.ts.Assistant
Let me open the proxy.ts file at the models endpoint to see the exactcode.
Assistant
Now let me understand the database schema better, particularly the
modelsandapi_keystables and thekey_idcolumn.Assistant
Let me look at the existing tests for the
/v1/modelsendpoint.Assistant
Let me check where
ModelListRowis used and look at thecatalog-syncservice to understand how keys/models relate.Assistant
Let me look at the router service to understand how "available"/connected models are determined there for consistency.
Assistant
Let me check the server package.json and test config to know how to run tests.
Assistant
Let me first run the existing relevant tests to confirm they pass before making changes.
Assistant
Let me look at the test seed to understand the catalog and key setup used in tests.
Assistant
Let me check the migrations around V4 to understand the moonshot/minimax disabling.
Assistant
Let me check the V4 migration that drops moonshot/minimax, to understand whether those seeded rows are disabled.
Assistant
Now I have a good understanding. Let me write a reproduction script to confirm the current behavior first, then implement the fix. Let me create a temporary test file.
Assistant
The current behavior returns only
autobecause my test's POST to/api/keysis gated and failed (no dashboard token). Let me look at the auth helper and fix my reproduction script.Assistant
The current behavior is confirmed: default returns only connected models (10 entries with a groq key). Now let me implement the fix. First, update the shared type
ModelListRow.Assistant
Now let me update the proxy.ts
/v1/modelshandler.Assistant
Now let me run my temporary test to verify the new behavior.
Assistant
The new behavior works as expected. Let me write a more thorough test to verify the dedup "prefer available" logic and edge cases.
Assistant
All my temporary tests pass, including the dedup preference. Now let me run the existing tests that touch
/v1/modelsand related routes to make sure I didn't break anything.Assistant
Now let me run the full server test suite to ensure nothing else breaks.
Assistant
All 456 tests pass. Let me verify the TypeScript compiles cleanly (including the shared types change).
Assistant
Let me check whether the client (dashboard) consumes
/v1/modelsorModelListRowin a way that might be affected.Assistant
Let me check docs and README for any
/v1/modelsreferences that should be keptconsistent.Assistant
Let me verify the
disabledannotation reflects actual DB state by querying directly.Assistant
The
disabledannotation correctly reflects actual DB state (110 rows → 106 unique model_ids + auto = 107 entries). Let me do a final review of the complete diff.Assistant
Let me confirm no temporary test files are left behind and the workspace is clean.
Assistant
The temporary test file is already removed (only the two source files are modified). Let me run the full server test suite one final time to confirm everything passes.
Assistant
All 456 tests pass. Let me do a final type-check on the server to be safe.
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
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →