Skip to content
TheChatArchiveThe Chat Archive
gpt-5.6-luna· openaiHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION /v1/models: return the full catalog with per-model availability +…

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

    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 using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to 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-$

  2. Assistant

    I’ll trace the /v1/models route, its model/catalog and key-availability logic, then update the implementation while preserving compatibility. I’ll inspect the repository and relevant tests first, reproduce the current behavior where practical, run targeted tests, and review the final diff before submission.

  3. Assistant

    The repository is a TypeScript monorepo. I’m narrowing the search to the server route and model-related services, including existing tests and schema types, so the response shape and filtering semantics match the project’s conventions.

  4. Assistant

    The /v1/models implementation is in routes/proxy.ts and currently filters SQL rows to enabled models with a matching enabled key before deduplicating. I’ll replace that query with a catalog query that computes availability per row, ranks available duplicates first, deduplicates by model_id, and applies available=true or connected=true after deduplication. The virtual auto entry will carry the same additive fields and remain first.

  5. Assistant

    The first edit attempt did not modify files because this environment lacks python3; the build that followed only confirmed the unchanged baseline compiles. I’ll apply the same targeted replacement using Node, then compile and run the relevant route tests.

  6. Assistant

    The implementation now compiles. The first targeted test command used a repository-root path while Vitest runs from server/, so it found no tests rather than testing the code. I’ll rerun with the server-relative path, then exercise the route with a temporary script using an in-memory database to verify default/full, filtered/alias, disabled, keyless, and dedup behavior without changing repository tests.

  7. Assistant

    All 46 existing server test files pass (456 tests), and the targeted /v1/models tests pass. The route now:

    • returns one deduplicated entry per catalog model_id by default;
    • reports boolean available and unavailable_reason (no_key, disabled, or null);
    • prefers an available duplicate;
    • supports both available=true and connected=true;
    • keeps auto available and included in the filtered result.

    I’ll do one final diff/status check, then submit.

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