add openai validation

This commit is contained in:
Danel Kungla
2025-09-26 16:18:50 +03:00
parent 0a61371271
commit c99beea46a
2 changed files with 24 additions and 11 deletions

View File

@@ -0,0 +1,13 @@
import OpenAI from 'openai';
export const isValidOpenAiEnv = async () => {
const client = new OpenAI();
try {
await client.models.list();
return true;
} catch (e) {
console.log('No openAI env');
return false;
}
};