Skip to content
TheChatArchiveThe Chat Archive
fable-5· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

/v1/models: return the full catalog with per-model availability + opt-in filter Split…

  1. 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.

  2. Assistant

    Now let me check the README mention and the models table schema:

  3. Assistant

    Now implementing. First the shared type:

  4. Assistant

    Now the endpoint:

  5. Assistant

    Now add tests. Let me view the rest of the existing test file to insert appropriately:

  6. Assistant

    All 9 pass. Now typecheck and run the full server suite:

  7. Assistant

    Client also imports from shared — verify it still typechecks:

  8. Assistant

    The client tsc error is pre-existing (tsconfig baseUrl deprecation, unrelated). Let me check if docs describe the endpoint's behavior in more detail:

  9. Assistant

    README only mentions the endpoint briefly; I'll add a short note about the new annotations there:

  10. Assistant

    Done. Summary of changes:

    server/src/routes/proxy.ts — GET /v1/models now:

    • Queries the whole catalog instead of filtering to enabled+keyed rows. Availability is computed per row (enabled = 1 AND a matching enabled key exists, honoring the custom-provider key_id binding), and unavailable_reason is derived as null / 'no_key' (enabled, no key) / 'disabled'.
    • Dedup by model_id orders by available DESC, enabled DESC, intelligence_rank ASC, id ASC, so an available instance wins over a keyless one, which wins over a disabled one.
    • ?available=true or ?connected=true (also accepts 1) restores the old connected-only behavior via AND available = 1.
    • The auto virtual entry is always available: true, unavailable_reason: null.

    shared/types.ts — ModelListRow gained available: 0 | 1 and unavailable_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_key for keyless platforms), disabled reason for a disabled row, the ?available=true / ?connected=true filters, 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 --noEmit is clean; the client tsc baseUrl deprecation error is pre-existing on the base commit.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.