/v1/models: return the full catalog with per-model availability + opt-in filter Split…
- User
/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.
- Assistant
Now let me check the README mention and the models table schema:
- Assistant
Now implementing. First the shared type:
- Assistant
Now the endpoint:
- Assistant
Now add tests. Let me view the rest of the existing test file to insert appropriately:
- Assistant
All 9 pass. Now typecheck and run the full server suite:
- Assistant
Client also imports from shared — verify it still typechecks:
- Assistant
The client tsc error is pre-existing (tsconfig
baseUrldeprecation, unrelated). Let me check if docs describe the endpoint's behavior in more detail: - Assistant
README only mentions the endpoint briefly; I'll add a short note about the new annotations there:
- Assistant
Done. Summary of changes:
server/src/routes/proxy.ts—GET /v1/modelsnow:- Queries the whole catalog instead of filtering to enabled+keyed rows. Availability is computed per row (
enabled = 1AND a matching enabled key exists, honoring the custom-providerkey_idbinding), andunavailable_reasonis derived asnull/'no_key'(enabled, no key) /'disabled'. - Dedup by
model_idorders byavailable DESC, enabled DESC, intelligence_rank ASC, id ASC, so an available instance wins over a keyless one, which wins over a disabled one. ?available=trueor?connected=true(also accepts1) restores the old connected-only behavior viaAND available = 1.- The
autovirtual entry is alwaysavailable: true, unavailable_reason: null.
shared/types.ts—ModelListRowgainedavailable: 0 | 1andunavailable_reason: 'no_key' | 'disabled' | null(only consumed by proxy.ts).server/src/__tests__/routes/proxy-auto-model.test.ts— 4 new tests: full catalog with annotations (no_keyfor keyless platforms),disabledreason for a disabled row, the?available=true/?connected=truefilters, and dedup preferring the available instance over a planted disabled duplicate.README.md— one-line note on the annotations and filter in the OpenAI-compatible feature bullet.Verified: full server suite passes (46 files, 460 tests) and
tsc --noEmitis clean; the client tscbaseUrldeprecation error is pre-existing on the base commit. - Queries the whole catalog instead of filtering to enabled+keyed rows. Availability is computed per row (
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
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare 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-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →