Cohere 401 Invalid API Token Error
Quick answer
A 401 means the key is missing, invalid or expired. Check that the key is sent, copied fully, and still active in the dashboard.
Most likely fix: Verify the key is sent
How to fix it
Try these in order — the most common fix is first.
1. Verify the key is sent
- Confirm CO_API_KEY is set in the running process (print its length, not the value)
- Pass it explicitly: cohere.ClientV2(api_key=...)
- Restart the server or notebook so new env vars load
Did this fix it?2. Create a fresh key
- Open dashboard.cohere.com > API Keys
- Create a new key and replace the old one
- Remove trailing spaces and quotes
Did this fix it?3. If the message says the key has expired
- Create a Production key in the dashboard as the error text suggests
- Update deployments and secrets managers
Did this fix it?
Symptoms
Responses return 401 with messages like 'no api key supplied', 'invalid api token', or 'Your API key has expired'.
Why it happens
- API key not set or environment variable not loaded
- Key copied with extra spaces or truncated
- Key deleted or expired in the dashboard
- Trial key expired and Production key not created
This guide also covers
- cohere invalid api token
- cohere 401 unauthorized
- cohere no api key supplied
Still not working?
If Cohere keeps failing, you're not alone. See every Cohere problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
Claude API 529 Overloaded Error (Anthropic Claude)
Other Cohere errors
- Cohere API 429 Too Many Requests Error
- Cohere Trial Key Limits and 'Not for Production' Error
- Cohere Model Not Found Error (Deprecated Models)
- Cohere Embed Input Too Long or Too Many Texts Error
- Cohere Rerank API Errors and Truncated Documents
- Cohere API 500 / 503 / 504 Server Errors
- Cohere 'Too Many Tokens' Context Length Error
- How to Cancel Cohere (Delete Account and Stop Billing)