mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
init
This commit is contained in:
22
scripts/get_groq_models.js
Normal file
22
scripts/get_groq_models.js
Normal file
@@ -0,0 +1,22 @@
|
||||
(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);
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user