Groq Install & Auth Troubleshooting
Full error matrix for install and authentication failures. Match the error text you see to the row, then apply the solution.
| Error | Cause | Solution |
|---|---|---|
401 Invalid API Key |
Key missing, revoked, or mistyped | Verify key at console.groq.com/keys |
MODULE_NOT_FOUND groq-sdk |
SDK not installed | Run npm install groq-sdk |
ModuleNotFoundError: No module named 'groq' |
Python SDK missing | Run pip install groq |
ENOTFOUND api.groq.com |
Network/DNS issue | Check internet connectivity and firewall |
Diagnostic checklist
- Confirm the variable is actually exported in the current shell:
echo "${GROQ_API_KEY:0:4}"should printgsk_(never echo the full key). - Confirm the key starts with
gsk_and has no surrounding quotes or trailing whitespace from a copy/paste. - If the key is stored in
.env, confirm your process actually loads it — Node needsdotenv(or--env-file=.envon Node 20+); Python needspython-dotenvor the variable exported in the shell. - If
models.list()returns 401 but the key looks right, regenerate the key in the console — a rotated or revoked key returns 401 with a valid-looking value.