Skip to content

Commit 0f263bf

Browse files
author
Frank
committed
Hide experimental models
1 parent 34a33df commit 0f263bf

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/opencode/src/flag/flag.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export namespace Flag {
77
export const OPENCODE_PERMISSION = process.env["OPENCODE_PERMISSION"]
88
export const OPENCODE_DISABLE_DEFAULT_PLUGINS = truthy("OPENCODE_DISABLE_DEFAULT_PLUGINS")
99
export const OPENCODE_DISABLE_LSP_DOWNLOAD = truthy("OPENCODE_DISABLE_LSP_DOWNLOAD")
10+
export const OPENCODE_ENABLE_EXPERIMENTAL_MODELS = truthy("OPENCODE_ENABLE_EXPERIMENTAL_MODELS")
1011

1112
function truthy(key: string) {
1213
const value = process.env[key]?.toLowerCase()

packages/opencode/src/provider/models.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export namespace ModelsDev {
2828
context: z.number(),
2929
output: z.number(),
3030
}),
31+
experimental: z.boolean().optional(),
3132
options: z.record(z.any()),
3233
})
3334
.openapi({

packages/opencode/src/provider/provider.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { NamedError } from "../util/error"
1111
import { Auth } from "../auth"
1212
import { Instance } from "../project/instance"
1313
import { Global } from "../global"
14+
import { Flag } from "../flag/flag"
1415

1516
export namespace Provider {
1617
const log = Log.create({ service: "provider" })
@@ -286,14 +287,18 @@ export namespace Provider {
286287
for (const [providerID, provider] of configProviders) {
287288
mergeProvider(providerID, provider.options ?? {}, "config")
288289
}
290+
console.log("!@#!@#", Flag.OPENCODE_ENABLE_EXPERIMENTAL_MODELS)
289291

290292
for (const [providerID, provider] of Object.entries(providers)) {
291-
// Filter out blacklisted models
292293
const filteredModels = Object.fromEntries(
293-
Object.entries(provider.info.models).filter(
294-
([modelID]) =>
295-
modelID !== "gpt-5-chat-latest" && !(providerID === "openrouter" && modelID === "openai/gpt-5-chat"),
296-
),
294+
Object.entries(provider.info.models)
295+
// Filter out blacklisted models
296+
.filter(
297+
([modelID]) =>
298+
modelID !== "gpt-5-chat-latest" && !(providerID === "openrouter" && modelID === "openai/gpt-5-chat"),
299+
)
300+
// Filter out experimental models
301+
.filter(([, model]) => !model.experimental || Flag.OPENCODE_ENABLE_EXPERIMENTAL_MODELS),
297302
)
298303
provider.info.models = filteredModels
299304

0 commit comments

Comments
 (0)