diff --git a/chat/server.js b/chat/server.js index 8d7f9c6..6ad4ed3 100644 --- a/chat/server.js +++ b/chat/server.js @@ -7997,17 +7997,31 @@ async function fetchNvidiaModels() { // Fetch models from Chutes API when API key is configured async function fetchChutesModels() { - if (!CHUTES_API_KEY) return []; + if (!CHUTES_API_KEY) { + log('Chutes API key not configured'); + return []; + } try { + log('Fetching Chutes models', { + url: `${CHUTES_API_URL}/models`, + keyPrefix: CHUTES_API_KEY.substring(0, 8) + '...' + }); const res = await fetch(`${CHUTES_API_URL}/models`, { headers: { 'Authorization': `Bearer ${CHUTES_API_KEY}` } }); if (!res.ok) { - log('Chutes models fetch failed', { status: res.status }); + const errorText = await res.text().catch(() => ''); + log('Chutes models fetch failed', { + status: res.status, + statusText: res.statusText, + error: errorText.substring(0, 200), + keyPrefix: CHUTES_API_KEY.substring(0, 8) + '...' + }); return []; } const data = await res.json(); const models = Array.isArray(data?.data) ? data.data : []; + log('Chutes models fetched successfully', { count: models.length }); return models.map((m) => ({ name: m.id || m.name, label: `${m.id || m.name} (Chutes)`,