diff --git a/.env.example b/.env.example index 6155a95..7a9e3af 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/db/models.js b/db/models.js index 9ffddd1..32d375b 100644 --- a/db/models.js +++ b/db/models.js @@ -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 }, diff --git a/jobs/queue.js b/jobs/queue.js index 809e40e..ee32aae 100644 --- a/jobs/queue.js +++ b/jobs/queue.js @@ -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); } diff --git a/src/models.js b/src/models.js index 185cc8a..b230d6e 100644 --- a/src/models.js +++ b/src/models.js @@ -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; +}