Watch: Fix "Incorrect API key provided" in my AI feature | Vovy
Watch Vovy do it on a Mac: "My app says invalid API key but I pasted it right. What's going on?". Track down why your AI provider rejects your key: wrong variable name, missing prod env var, stray spaces, or a revoked key.
"My app says invalid API key but I pasted it right. What's going on?"
Track down why your AI provider rejects your key: wrong variable name, missing prod env var, stray spaces, or a revoked key.
What happens in the video
- Find where the key is read: Vovy searches your code for the variable name, like OPENAI_API_KEY, and checks it matches what you set, letter for letter.
- Check local and production: Vovy checks your .env file and your host's environment variables. The classic case: it works locally because prod never got the key.
- Test the key directly: Vovy tests the key with a single curl request in Terminal. If that fails too, the key itself is wrong, revoked or from another project.
- Replace and redeploy: If needed, Vovy creates a fresh key, updates the variable with no spaces or quotes, and redeploys, since env changes only apply to new deploys.
- Confirm the fix: Vovy triggers the AI feature on your live site and shows a card with the cause it found and the working response.
Read the step-by-step guideLoading...