From df97ff97b92c2165f101c3970b72a57d22104662 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Wed, 17 Dec 2025 09:11:56 -0800 Subject: [PATCH] Fix: Add better API error handling and logging --- scripts/run-benchmark.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/run-benchmark.js b/scripts/run-benchmark.js index a0c64a7..02adcb1 100644 --- a/scripts/run-benchmark.js +++ b/scripts/run-benchmark.js @@ -28,6 +28,10 @@ const apiCall = async (prompt, model, temp, effort) => { }, { headers: { Authorization: `Bearer ${process.env.OPENROUTER_KEY}` } } ); + if (!res.data.choices || !res.data.choices[0]) { + console.error('API Response:', JSON.stringify(res.data, null, 2)); + throw new Error('Invalid API response structure'); + } return res.data.choices[0].message.content; };