Migrated to vercel
This commit is contained in:
15
server/utils/openai-client.ts
Normal file
15
server/utils/openai-client.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { tryit } from "radash";
|
||||
|
||||
export const useOpenAI = () => {
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
const client = $fetch.create({
|
||||
baseURL: "https://api.openai.com/v1",
|
||||
headers: {
|
||||
Authorization: `Bearer ${config.openaiApiKey}`,
|
||||
},
|
||||
method: "post",
|
||||
});
|
||||
|
||||
return tryit(client);
|
||||
};
|
||||
Reference in New Issue
Block a user