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 to understand the codebase and find the relevant files.
Assistant
Let me look at the shared types and the relevant tests, plus the catalog/db structure.
Assistant
This is the key endpoint. The issue is about
GET /v1/models. Let me find the route for/v1/models— it seems proxyRouter is mounted at/v1. Let me check app.ts.Assistant
The relevant endpoint is
GET /v1/modelsin proxy.ts. Let me look at the imports and the AUTO_MODEL_ID.Assistant
Now let me look at the existing tests for the
/v1/modelsendpoint to understand expectations.Assistant
Now let me look at the DB schema for models and api_keys.
Assistant
Now I understand the structure. Let me look at the exact
/v1/modelsendpoint lines and theModelListRowtype usage.Assistant
Let me check if
ModelListRowis used elsewhere in proxy.ts.Assistant
Now let me replace the endpoint. First, let me update the import on line 5 to remove the now-unused
ModelListRow.Assistant
Now let me replace the endpoint. Let me open the file at the relevant lines:
Assistant
Now let me replace the old endpoint (lines 119-172) with the new content using the edit command:
Assistant
Now let me run the TypeScript build to check for errors:
Assistant
Build passes. Now let me run the existing tests related to this endpoint:
Assistant
Existing tests pass. Now let me write a reproduction/test script to verify the new behavior (full catalog, annotations, filter, dedup). Let me create a temporary test:
Assistant
I need to place this test in the tests directory so vitest picks it up. Let me copy it there, run it, then remove.
Assistant
The first failure is a test-assumption bug — the seed has some disabled catalog rows, so "disabled" reason is correct behavior. The second is calling
mintDashboardTokentwice. Let me fix my test:Assistant
All my verification tests pass. Now let me run the broader route test suite to make sure I didn't break anything:
Assistant
All 22 route test files pass (168 tests). Let me also run the integration and services tests to be safe:
Assistant
All pass. Let me also check whether the full-flow test inspects
/v1/modelsto make sure my change doesn't conflict:Assistant
Let me verify the client doesn't consume
/v1/models(it uses/api/modelsfor the dashboard):Assistant
Let me review the final diff:
Assistant
The
ModelListRowtype is no longer imported but still defined in shared. Let me verify it's not orphaned/breaking anything and that the build is clean (already confirmed). Let me double-check it's not referenced elsewhere:Assistant
Let me run the complete server test suite to be thorough:
Assistant
All 456 tests across 46 files pass. Let me clean up the temp file and verify final git status:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.