HTTP 401 means authentication failed. The 4AICode relay accepts only Authorization: Bearer sk-4ai-....
Checklist
- Header present and spelled correctly
Authorization: Bearer sk-4ai-xxxxxxxxxxxxxxxx
Query-string keys are not supported. Do not omit Bearer.
- Token is complete — shown once at creation; replace the whole
sk-4ai-<your-token>placeholder. - Token not revoked — revocation takes effect immediately (Token guide).
- Client reloaded — new terminals / full IDE restarts after env changes. Tokens work on both
.comand.net. - Claude Code extension variables — prefer
ANTHROPIC_AUTH_TOKEN(VS Code / Cursor guide).
Common cases
| Case | Action |
|---|---|
| Brand-new token still 401 | Trim whitespace; restart the client |
| Suddenly 401 | Check revocation or stale token after org switch |
| Only one tool fails | That tool may ignore shell env; check its own settings |
Still stuck?
Email support@4aicode.com with approximate time, tool name, and trace_id if present. Never send the full token.