feat: switch anthropic onboarding defaults to sonnet

This commit is contained in:
Peter Steinberger
2026-02-18 04:37:50 +01:00
parent e8816c554f
commit f25bbbc37e
3 changed files with 22 additions and 2 deletions

View File

@@ -6,8 +6,11 @@ import {
} from "./auth-choice.api-key.js"; } from "./auth-choice.api-key.js";
import type { ApplyAuthChoiceParams, ApplyAuthChoiceResult } from "./auth-choice.apply.js"; import type { ApplyAuthChoiceParams, ApplyAuthChoiceResult } from "./auth-choice.apply.js";
import { buildTokenProfileId, validateAnthropicSetupToken } from "./auth-token.js"; import { buildTokenProfileId, validateAnthropicSetupToken } from "./auth-token.js";
import { applyAgentDefaultModelPrimary } from "./onboard-auth.config-shared.js";
import { applyAuthProfileConfig, setAnthropicApiKey } from "./onboard-auth.js"; import { applyAuthProfileConfig, setAnthropicApiKey } from "./onboard-auth.js";
const DEFAULT_ANTHROPIC_MODEL = "anthropic/claude-sonnet-4-6";
export async function applyAuthChoiceAnthropic( export async function applyAuthChoiceAnthropic(
params: ApplyAuthChoiceParams, params: ApplyAuthChoiceParams,
): Promise<ApplyAuthChoiceResult | null> { ): Promise<ApplyAuthChoiceResult | null> {
@@ -55,6 +58,9 @@ export async function applyAuthChoiceAnthropic(
provider, provider,
mode: "token", mode: "token",
}); });
if (params.setDefaultModel) {
nextConfig = applyAgentDefaultModelPrimary(nextConfig, DEFAULT_ANTHROPIC_MODEL);
}
return { config: nextConfig }; return { config: nextConfig };
} }
@@ -94,6 +100,9 @@ export async function applyAuthChoiceAnthropic(
provider: "anthropic", provider: "anthropic",
mode: "api_key", mode: "api_key",
}); });
if (params.setDefaultModel) {
nextConfig = applyAgentDefaultModelPrimary(nextConfig, DEFAULT_ANTHROPIC_MODEL);
}
return { config: nextConfig }; return { config: nextConfig };
} }

View File

@@ -29,8 +29,8 @@ function sanitizeTokenValue(value: string | undefined): string | undefined {
} }
const ANTHROPIC_OAUTH_MODEL_KEYS = [ const ANTHROPIC_OAUTH_MODEL_KEYS = [
"anthropic/claude-opus-4-6",
"anthropic/claude-sonnet-4-6", "anthropic/claude-sonnet-4-6",
"anthropic/claude-opus-4-6",
"anthropic/claude-opus-4-5", "anthropic/claude-opus-4-5",
"anthropic/claude-sonnet-4-5", "anthropic/claude-sonnet-4-5",
"anthropic/claude-haiku-4-5", "anthropic/claude-haiku-4-5",
@@ -121,7 +121,7 @@ export async function promptAuthConfig(
config: next, config: next,
prompter, prompter,
allowedKeys: anthropicOAuth ? ANTHROPIC_OAUTH_MODEL_KEYS : undefined, allowedKeys: anthropicOAuth ? ANTHROPIC_OAUTH_MODEL_KEYS : undefined,
initialSelections: anthropicOAuth ? ["anthropic/claude-opus-4-6"] : undefined, initialSelections: anthropicOAuth ? ["anthropic/claude-sonnet-4-6"] : undefined,
message: anthropicOAuth ? "Anthropic OAuth models" : undefined, message: anthropicOAuth ? "Anthropic OAuth models" : undefined,
}); });
if (allowlistSelection.models) { if (allowlistSelection.models) {

View File

@@ -151,6 +151,14 @@ function addModelSelectOption(params: {
params.seen.add(key); params.seen.add(key);
} }
function isAnthropicLegacyModel(entry: { provider: string; id: string }): boolean {
return (
entry.provider === "anthropic" &&
typeof entry.id === "string" &&
entry.id.toLowerCase().startsWith("claude-3")
);
}
async function promptManualModel(params: { async function promptManualModel(params: {
prompter: WizardPrompter; prompter: WizardPrompter;
allowBlank: boolean; allowBlank: boolean;
@@ -251,6 +259,9 @@ export async function promptDefaultModel(
if (hasPreferredProvider && preferredProvider) { if (hasPreferredProvider && preferredProvider) {
models = models.filter((entry) => entry.provider === preferredProvider); models = models.filter((entry) => entry.provider === preferredProvider);
if (preferredProvider === "anthropic") {
models = models.filter((entry) => !isAnthropicLegacyModel(entry));
}
} }
const agentDir = params.agentDir; const agentDir = params.agentDir;