summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStephen Collings <[email protected]>2025-12-01 23:01:10 +0000
committerGitHub <[email protected]>2025-12-01 17:01:10 -0600
commit1eaf5c31d3789f903fd9dec40278e3311973172f (patch)
tree9cd360f19f138c6be60ddc8f87d2b0ca3cd3cf58
parent677b19e22ebcc7897c65707b7c6f18b2b7ab714d (diff)
downloadopencode-1eaf5c31d3789f903fd9dec40278e3311973172f.tar.gz
opencode-1eaf5c31d3789f903fd9dec40278e3311973172f.zip
fix(auth): Respect disabled/enabled providers config in auth login (#4940)
Co-authored-by: GitHub Action <[email protected]> Co-authored-by: Aiden Cline <[email protected]>
-rw-r--r--packages/opencode/src/cli/cmd/auth.ts18
1 files changed, 17 insertions, 1 deletions
diff --git a/packages/opencode/src/cli/cmd/auth.ts b/packages/opencode/src/cli/cmd/auth.ts
index ae24fbef5..1f37ec805 100644
--- a/packages/opencode/src/cli/cmd/auth.ts
+++ b/packages/opencode/src/cli/cmd/auth.ts
@@ -6,6 +6,7 @@ import { ModelsDev } from "../../provider/models"
import { map, pipe, sortBy, values } from "remeda"
import path from "path"
import os from "os"
+import { Config } from "../../config/config"
import { Global } from "../../global"
import { Plugin } from "../../plugin"
import { Instance } from "../../project/instance"
@@ -103,7 +104,22 @@ export const AuthLoginCommand = cmd({
return
}
await ModelsDev.refresh().catch(() => {})
- const providers = await ModelsDev.get()
+
+ const config = await Config.get()
+
+ const disabled = new Set(config.disabled_providers ?? [])
+ const enabled = config.enabled_providers ? new Set(config.enabled_providers) : undefined
+
+ const providers = await ModelsDev.get().then((x) => {
+ const filtered: Record<string, (typeof x)[string]> = {}
+ for (const [key, value] of Object.entries(x)) {
+ if ((enabled ? enabled.has(key) : true) && !disabled.has(key)) {
+ filtered[key] = value
+ }
+ }
+ return filtered
+ })
+
const priority: Record<string, number> = {
opencode: 0,
anthropic: 1,