CityIsBetter / Prompt2Shorts

Prompt2Shorts is an innovative application that generates short-form content by transforming prompts into full scripts, voice-over audio, and relevant videos. Designed for creators who want to quickly produce engaging content, Prompt2Shorts integrates advanced AI and APIs to automate the creation process.
https://prompt2shorts.vercel.app
MIT License
3 stars 2 forks source link

When generating a video from a prompt, Error: 401 Missing Authentication header or invalid API key #1

Open Rantanplan010 opened 1 week ago

Rantanplan010 commented 1 week ago

After updating the Env file and providing a valid OpenAI Key, and setting up OpenRouter to use Nous:Hermes3 with the Base_Url in the env file, I still get this error, it seems the openai module can't access my API key in the .env. I thought /api/GenerateScript/Route.ts was missing the import "OPENAI_API_KEY", but when adding it to the file, it still displays this error.

Here is the snippet :

⨯ Error: 401 Missing Authentication header or invalid API key at APIError.generate (webpack-internal:///(rsc)/./node_modules/openai/error.mjs:63:20) at OpenAI.makeStatusError (webpack-internal:///(rsc)/./node_modules/openai/core.mjs:305:65) at OpenAI.makeRequest (webpack-internal:///(rsc)/./node_modules/openai/core.mjs:348:30) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async POST (webpack-internal:///(rsc)/./src/app/api/generateScript/route.ts:17:22) at async eval (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:228:37) at async AppRouteRouteModule.execute (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:157:26) at async AppRouteRouteModule.handle (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:290:30) at async EdgeRouteModuleWrapper.handler (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/web/edge-route-module-wrapper.js:92:21) at async adapter (webpack-internal:///(rsc)/./node_modules/next/dist/esm/server/web/adapter.js:179:16) ✓ Compiled /_error in 275ms (783 modules) POST /api/generateScript 500 in 810ms

CityIsBetter commented 5 days ago

you dont need to provide "openai" key, u just 3 api keys NEXT_PUBLIC_OPENROUTER_API_TOKEN - for script NEXT_PUBLIC_PEXELS_API_KEY - for videos NEXT_PUBLIC_RAPIDAPI_KEY - for audio

i used NEXTPUBLIC before the variable names so you need to check that.