/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
I'll explore the codebase to find how
/v1/modelsis implemented and what needs to change for the full catalog with availability annotations. - Assistant
Implementing the full-catalog
/v1/modelsresponse with availability fields and the opt-in filter. - Assistant
Writing tests for the new catalog behavior:
- Assistant
GET /v1/modelsnow returns the full catalog with per-model availability, and the old connected-only behavior is opt-in.Behavior
Default — full catalog (one entry per
model_id), each with:available:truewhen the model is enabled and an enabled key can serve itunavailable_reason:null|"no_key"|"disabled"
Filter —
?available=trueor?connected=truereturns only connected models (previous default).Special cases:
autois alwaysavailable: true- Dedup prefers an available row for a
model_idover a keyless or disabled one
Changes
-
server/src/routes/proxy.ts— Replaced the connected-only SQL with a CTE that annotates every catalog row, deduplicates by , and applies the optional filter.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.