feat(onboard): add OpenCode Zen as model provider

This commit is contained in:
Magi Metal
2026-01-09 18:12:07 -05:00
committed by Peter Steinberger
parent 9b1f164447
commit a399fa36c8
11 changed files with 676 additions and 35 deletions

View File

@@ -71,9 +71,11 @@ import {
applyAuthProfileConfig,
applyMinimaxConfig,
applyMinimaxHostedConfig,
applyOpencodeZenConfig,
setAnthropicApiKey,
setGeminiApiKey,
setMinimaxApiKey,
setOpencodeZenApiKey,
writeOAuthCredentials,
} from "./onboard-auth.js";
import {
@@ -95,6 +97,7 @@ import {
applyOpenAICodexModelDefault,
OPENAI_CODEX_DEFAULT_MODEL,
} from "./openai-codex-model-default.js";
import { OPENCODE_ZEN_DEFAULT_MODEL } from "./opencode-zen-model-default.js";
import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
export const CONFIGURE_WIZARD_SECTIONS = [
@@ -366,6 +369,7 @@ async function promptAuthConfig(
| "apiKey"
| "minimax-cloud"
| "minimax"
| "opencode-zen"
| "skip";
let next = cfg;
@@ -783,6 +787,32 @@ async function promptAuthConfig(
next = applyMinimaxHostedConfig(next);
} else if (authChoice === "minimax") {
next = applyMinimaxConfig(next);
} else if (authChoice === "opencode-zen") {
note(
[
"OpenCode Zen provides access to Claude, GPT, Gemini, and more models.",
"Get your API key at: https://opencode.ai/auth",
].join("\n"),
"OpenCode Zen",
);
const key = guardCancel(
await text({
message: "Enter OpenCode Zen API key",
validate: (value) => (value?.trim() ? undefined : "Required"),
}),
runtime,
);
await setOpencodeZenApiKey(String(key).trim());
next = applyAuthProfileConfig(next, {
profileId: "opencode-zen:default",
provider: "opencode-zen",
mode: "api_key",
});
next = applyOpencodeZenConfig(next);
note(
`Default model set to ${OPENCODE_ZEN_DEFAULT_MODEL}`,
"Model configured",
);
}
const currentModel =