summaryrefslogtreecommitdiffhomepage
path: root/packages/plugin/src/index.ts
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-04-01 18:04:14 -0500
committerGitHub <[email protected]>2026-04-01 23:04:14 +0000
commit1fcfb69bf772f085289dd22f6898ac5d926226e9 (patch)
tree01b0e0c1ec7785f2d10dbda59930babdaae29522 /packages/plugin/src/index.ts
parentfa96cb9c6e7d0cafad065066c00c2119b94b68d9 (diff)
downloadopencode-1fcfb69bf772f085289dd22f6898ac5d926226e9.tar.gz
opencode-1fcfb69bf772f085289dd22f6898ac5d926226e9.zip
feat: add new provider plugin hook for resolving models and sync models from github models endpoint (falls back to models.dev) (#20533)
Diffstat (limited to 'packages/plugin/src/index.ts')
-rw-r--r--packages/plugin/src/index.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index a264cf5aa..473cac8a9 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -11,6 +11,7 @@ import type {
Auth,
Config as SDKConfig,
} from "@opencode-ai/sdk"
+import type { Provider as ProviderV2, Model as ModelV2 } from "@opencode-ai/sdk/v2"
import type { BunShell } from "./shell.js"
import { type ToolDefinition } from "./tool.js"
@@ -173,6 +174,15 @@ export type AuthOAuthResult = { url: string; instructions: string } & (
}
)
+export type ProviderHookContext = {
+ auth?: Auth
+}
+
+export type ProviderHook = {
+ id: string
+ models?: (provider: ProviderV2, ctx: ProviderHookContext) => Promise<Record<string, ModelV2>>
+}
+
/** @deprecated Use AuthOAuthResult instead. */
export type AuthOuathResult = AuthOAuthResult
@@ -183,6 +193,7 @@ export interface Hooks {
[key: string]: ToolDefinition
}
auth?: AuthHook
+ provider?: ProviderHook
/**
* Called when a new message is received
*/