Skip to main content

Quick Checklist

Before diving deeper, check these common causes:
1

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].
2

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.
3

Credits available

A 402 error means your credits are exhausted — this is NOT an invalid key error. See Credits & Budget for resolution.
4

Key not regenerated

If someone (including you) regenerated the key, your old key is now permanently invalid. Copy the new key from the dashboard.

”Invalid API key” in Roo Code

”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:
The base URL must be 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:

“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:
Expected results:
  • 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:
  1. The exact error message you’re seeing (screenshot preferred)
  2. Which tool you’re using (Claude Code, Roo Code, Cursor, etc.)
  3. Your email address associated with your Unbound account