Files
open-gsio/scripts/get_groq_models.js
geoffsee 33679583af init
2025-05-22 23:14:01 -04:00

23 lines
563 B
JavaScript

(async () => {
// Run the script with bun so it automatically picks up the env
const apiKey = process.env.GROQ_API_KEY;
try {
const response = await fetch("https://api.groq.com/openai/v1/models", {
method: "GET",
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const data = await response.json();
console.log(JSON.stringify(data));
} catch (error) {
console.error("Error fetching data:", error);
}
})();