summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTommy D. Rossi <[email protected]>2026-02-05 07:08:08 +0100
committerGitHub <[email protected]>2026-02-05 00:08:08 -0600
commit9ef319f25fee3dbefae9fcbe27ef4c69ceca1293 (patch)
treef9e1467cc3d178af2e1208dfb1f2cea5c6a89c54
parent64e2bf8bf00eca1c6ad4486e29eb84f7907d1d35 (diff)
downloadopencode-9ef319f25fee3dbefae9fcbe27ef4c69ceca1293.tar.gz
opencode-9ef319f25fee3dbefae9fcbe27ef4c69ceca1293.zip
feat: add models.dev schema ref for model autocomplete in opencode.json (#12112)
-rw-r--r--packages/opencode/src/config/config.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/opencode/src/config/config.ts b/packages/opencode/src/config/config.ts
index dfb86dbe2..a4760239c 100644
--- a/packages/opencode/src/config/config.ts
+++ b/packages/opencode/src/config/config.ts
@@ -35,6 +35,8 @@ import { iife } from "@/util/iife"
export namespace Config {
const log = Log.create({ service: "config" })
+ const ModelRef = { $ref: "https://models.dev/model-schema.json#/$defs/Model" }
+
// Managed settings directory for enterprise deployments (highest priority, admin-controlled)
// These settings override all user and project settings
function getManagedConfigDir(): string {
@@ -660,7 +662,7 @@ export namespace Config {
template: z.string(),
description: z.string().optional(),
agent: z.string().optional(),
- model: z.string().optional(),
+ model: z.string().optional().meta(ModelRef),
subtask: z.boolean().optional(),
})
export type Command = z.infer<typeof Command>
@@ -672,7 +674,7 @@ export namespace Config {
export const Agent = z
.object({
- model: z.string().optional(),
+ model: z.string().optional().meta(ModelRef),
variant: z
.string()
.optional()
@@ -1043,11 +1045,16 @@ export namespace Config {
.array(z.string())
.optional()
.describe("When set, ONLY these providers will be enabled. All other providers will be ignored"),
- model: z.string().describe("Model to use in the format of provider/model, eg anthropic/claude-2").optional(),
+ model: z
+ .string()
+ .describe("Model to use in the format of provider/model, eg anthropic/claude-2")
+ .optional()
+ .meta(ModelRef),
small_model: z
.string()
.describe("Small model to use for tasks like title generation in the format of provider/model")
- .optional(),
+ .optional()
+ .meta(ModelRef),
default_agent: z
.string()
.optional()