Troubleshooting

401 Unauthorized

LLMs Text

Fix 401 Unauthorized

HTTP 401 means authentication failed. The 4AICode relay accepts only Authorization: Bearer sk-4ai-....

Checklist

  1. Header present and spelled correctly
Authorization: Bearer sk-4ai-xxxxxxxxxxxxxxxx

Query-string keys are not supported. Do not omit Bearer.

  1. Token is complete — shown once at creation; replace the whole sk-4ai-<your-token> placeholder.
  2. Token not revoked — revocation takes effect immediately (Token guide).
  3. Client reloaded — new terminals / full IDE restarts after env changes. Tokens work on both .com and .net.
  4. Claude Code extension variables — prefer ANTHROPIC_AUTH_TOKEN (VS Code / Cursor guide).

Common cases

CaseAction
Brand-new token still 401Trim whitespace; restart the client
Suddenly 401Check revocation or stale token after org switch
Only one tool failsThat 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.