Quick Checklist
Before diving deeper, check these common causes:No extra spaces
Ensure there are no leading or trailing spaces when you paste your API key. Copy it fresh from Connect → AI Coding Tools → [Your Tool].
Correct tool selected
Verify you’re using the key from the right tool. Different tools may show different keys in the Connect → AI Coding Tools section.
Credits available
A 402 error means your credits are exhausted — this is NOT an invalid key error. See Credits & Budget for resolution.
”Invalid API key” in Roo Code
| Check | Fix |
|---|---|
| Wrong API provider selected | Select “unbound” as the API provider (not “OpenAI” or “Anthropic”) |
| Wrong key pasted | Paste the key from Connect → AI Coding Tools → Roo Code — not an Anthropic or OpenAI key |
| Wrong Roo Code version | You must use the Unbound-modified version of Roo Code, not the standard VS Code marketplace version |
| Cached old key | Remove the key, save settings, re-enter the key, save again |
| Stale session | Restart VS Code completely after changing the key |
”Invalid API key” in Claude Code CLI
1. Wrong base URL (most common cause)
Your base URL must point to Unbound, not Anthropic. Verify your current settings:https://api.getunbound.ai. If it’s set to https://api.anthropic.com or is empty, that’s the problem.
2. Environment variables not loaded
After setting environment variables, you must restart your terminal. If using~/.bashrc or ~/.zshrc:
3. Config file conflict
If using a config file at~/.config/claude-code/config, verify both the API key and base URL are correct there too. The config file may override your environment variables.
”API Key Is Incorrect, But It’s Correct”
This frustrating error almost always means one of these:- Base URL is wrong — Your requests are going to Anthropic’s API (which doesn’t recognize Unbound keys) instead of Unbound’s API. Fix:
export ANTHROPIC_BASE_URL="https://api.getunbound.ai" - Key from wrong tool — Double-check which tool’s key you copied from Connect → AI Coding Tools
- Key was recently regenerated — Someone on your team may have regenerated the key. Check the current key in the dashboard
- Invisible characters — Some terminals or password managers add invisible characters. Try typing the key manually or pasting from a plain text editor
How to Verify Your API Key
Run this quick test in your terminal:- Valid key → Returns a JSON list of available models
- Invalid key → Returns an authentication error message
- No credits → Returns a 402 error (key is valid, but credits are exhausted)
Still Not Working?
Contact support with:- The exact error message you’re seeing (screenshot preferred)
- Which tool you’re using (Claude Code, Roo Code, Cursor, etc.)
- Your email address associated with your Unbound account

