Merge pull request #738 from rowboatlabs/feat/settings-models-picker

feat: connect-only model settings with dynamic composer model picker
This commit is contained in:
PRAKHAR PANDEY 2026-07-14 13:27:46 +05:30 committed by GitHub
commit 1e8e36ebfb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 763 additions and 193 deletions

View file

@ -259,8 +259,20 @@ export async function listModelsForProvider(
url = `https://generativelanguage.googleapis.com/v1beta/models?key=${apiKey ?? ""}`;
break;
case "openrouter":
url = "https://openrouter.ai/api/v1/models";
if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`;
// /api/v1/models is a public catalog — it returns the full
// list even with an invalid/absent key, so listing it can't
// tell a bad key from a good one (a false "Connected"). When
// a key is given, hit the account-scoped /models/user behind
// Bearer auth instead: a bad key 401s here and the shared
// throw below surfaces it. Same OpenAI-shaped { data:[{id}] }
// response, so the parse path is unchanged. No key → keep the
// public catalog so an unconfigured provider can still preview.
if (apiKey) {
url = "https://openrouter.ai/api/v1/models/user";
headers["Authorization"] = `Bearer ${apiKey}`;
} else {
url = "https://openrouter.ai/api/v1/models";
}
break;
case "ollama":
url = `${(baseURL ?? "http://localhost:11434").replace(/\/$/, "")}/api/tags`;