Skip to content
AI Dev Toolkit.
Esc
  • AI Token CounterCount tokens for GPT, Claude, Gemini, DeepSeek, Qwen and more.Tool
  • LLM API Cost CalculatorEstimate per-request, daily and monthly API costs.Tool
  • AI Model ComparisonCompare prices, context windows and features across models.Tool
  • AI Model Pricing PagesSpecs, real costs and cheaper alternatives for popular models.Tool
  • Context Window CheckerSee whether your text fits each model's context window.Tool
  • Subscription vs API CalculatorFind out whether a chat plan or the API is cheaper for you.Tool
  • GPU / VRAM CalculatorCheck how much VRAM a local model needs and which GPUs fit.Tool
  • Claude Code Error DatabaseExact Claude Code error messages with tested fixes.Tool

Claude Code · Sign-in

API Error: 401 Invalid authentication credentials

The API recognised your credential’s format but rejected the account or organisation behind it.

Message

The exact error

Claude Code
Please run /login · API Error: 401 Invalid authentication credentials

Meaning

What it means

This isn’t an expired token. Anthropic returns it when a credential was recently revoked, when your organisation was disabled or removed you, or when the account was deactivated. The credential may be your saved login or an ANTHROPIC_API_KEY, and the fix depends on which, so start by checking.

Causes

Common causes

  • A revoked API key or login
  • Your organisation disabled or removed your access
  • A deactivated account
  • A gateway set in ANTHROPIC_BASE_URL rejecting its own credential

Fix

How to fix it

  1. See which credential is active

    Run /status. An approved ANTHROPIC_API_KEY takes priority over your login, so /login won’t replace it.

  2. If it’s an API key

    Rotate the key in the Console, or fall back to your subscription by removing it.

    macOS / Linux
    unset ANTHROPIC_API_KEY
    Windows PowerShell
    Remove-Item Env:ANTHROPIC_API_KEY
  3. If it’s your login

    Run /login once. If the same error returns for the same account, ask your organisation’s admin to restore access.

  4. If you use a gateway

    With ANTHROPIC_BASE_URL set, the text after 401 is your gateway’s, and /login won’t change it; fix the credential the gateway expects.

Related

Search all Claude Code errors