openai-text-completions
Advanced tools
Comparing version
14
index.js
@@ -30,7 +30,13 @@ #!/usr/bin/env node | ||
// Function for checking if the API key has been set | ||
function checkAPIKey() { | ||
if (apiKey === 'YOUR_API_KEY') { | ||
console.error('API key has not been set. Use the "key" command to set the API key.'); | ||
} else { | ||
async function checkAPIKey() { | ||
try { | ||
const response = await axios.get(`${baseURL}/v1/models`, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'Authorization': `Bearer ${apiKey}` | ||
} | ||
}); | ||
console.log('API key is set.'); | ||
} catch (error) { | ||
console.error('API key has not been set or is invalid. Use the "key" command to set the API key.'); | ||
} | ||
@@ -37,0 +43,0 @@ } |
{ | ||
"name": "openai-text-completions", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A global npm package for generating text completions using the OpenAI API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
2924
6.79%56
12%