Change anthropic model

This commit is contained in:
2026-04-23 13:09:53 -05:00
parent eef8b70fd9
commit 8a2074914c
4 changed files with 18 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
# ── Provider API keys ───────────────────────────────────────────────────────
# Only keys for models you intend to use are required.
# Anthropic — for claude-sonnet-4-6-20250929
# Anthropic — for claude-sonnet-4-6
# Get key: https://console.anthropic.com/settings/keys
ANTHROPIC_API_KEY=your-anthropic-key

View File

@@ -47,7 +47,7 @@ export const Job = sequelize.define('Job', {
model: {
type: DataTypes.STRING(128),
allowNull: false,
defaultValue: 'anthropic/claude-sonnet-4.6',
defaultValue: 'claude-sonnet-4-6',
},
inputTokens: { type: DataTypes.INTEGER, allowNull: true },
outputTokens: { type: DataTypes.INTEGER, allowNull: true },

View File

@@ -6,7 +6,7 @@ import { createGoogleGenerativeAI } from '@ai-sdk/google';
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { Job } from '../db/models.js';
import { broadcast } from '../ws/broadcast.js';
import { findModel, DEFAULT_MODEL_ID } from '../models.js';
import { findModel, DEFAULT_MODEL_ID, normalizeModelId } from '../models.js';
// ---------------------------------------------------------------------------
// Provider instances
@@ -43,7 +43,8 @@ const PROVIDERS = {
};
function resolveModel(modelId) {
const meta = findModel(modelId) ?? findModel(DEFAULT_MODEL_ID);
const normalized = normalizeModelId(modelId);
const meta = findModel(normalized) ?? findModel(DEFAULT_MODEL_ID);
return PROVIDERS[meta.provider](meta.id);
}

View File

@@ -9,7 +9,7 @@
export const MODELS = [
{
id: 'claude-sonnet-4-6-20250929',
id: 'claude-sonnet-4-6',
label: 'Claude Sonnet 4.6',
provider: 'anthropic',
creator: 'Anthropic',
@@ -45,8 +45,19 @@ export const MODELS = [
},
];
export const DEFAULT_MODEL_ID = 'claude-sonnet-4-6-20250929';
export const DEFAULT_MODEL_ID = 'claude-sonnet-4-6';
export function findModel(id) {
return MODELS.find(m => m.id === id);
}
export function normalizeModelId(raw) {
if (!raw) return raw;
// Allow legacy "provider/model" storage (e.g. "anthropic/claude-sonnet-4.6")
const noProvider = String(raw).includes('/') ? String(raw).split('/').pop() : String(raw);
// Allow legacy dotted Claude naming used in early versions of this repo.
if (noProvider === 'claude-sonnet-4.6') return 'claude-sonnet-4-6';
return noProvider;
}