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

Not logged in · Please run /login

Claude Code has no valid credential for this session: no saved login and no API key it can use.

Message

The exact error

Claude Code
Not logged in · Please run /login

Also appears as:

In the Claude Desktop app (Code tab or Cowork)
Authentication required · Sign in again to continue

Meaning

What it means

Every request needs either your Claude login or an API key. This message means Claude Code found neither, for example on first run, after logging out, or when you expected an ANTHROPIC_API_KEY that isn’t actually exported in this shell.

Causes

Common causes

  • You haven’t signed in yet, or you logged out
  • An ANTHROPIC_API_KEY set in a different shell or profile than the one you launched claude from
  • Repeated prompts: a wrong system clock, or on macOS a Keychain that can’t be written

Fix

How to fix it

  1. Sign in

    Run /login and sign in with your Claude subscription or Console account.

  2. If you meant to use an API key, check it’s exported

    These print only the first characters, so the key doesn’t end up on screen or in your history.

    macOS / Linux
    echo "${ANTHROPIC_API_KEY:0:7}"   # should print sk-ant-
    Windows PowerShell
    $env:ANTHROPIC_API_KEY.Substring(0, 7)   # should print sk-ant-
  3. If it keeps asking you to log in

    Make sure your system clock is set automatically, since login tokens depend on correct time. On macOS, run claude doctor; a macOS Keychain is not writable warning means you should unlock the login keychain (security unlock-keychain ~/Library/Keychains/login.keychain-db), then /logout and /login.

  4. For CI and automation

    Where you can’t log in interactively, use an API key, a long-lived token from claude setup-token, or an apiKeyHelper script.

Related

Search all Claude Code errors