[BUG] Interactive mode ignores ANTHROPIC_API_KEY environment variable

Status Fixed / completed
Reported on v2.1.229
Maintainer reply None cached
Activity 1 comment · opened Aug 13, 2026 · closed Aug 25, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Version: 2.1.229 (latest)
claude auth status shows the key is configured

{
  "loggedIn": true,
  "authMethod": "api_key",
  "apiProvider": "firstParty",
  "apiKeySource": "ANTHROPIC_API_KEY"
}

claude -p works without prompting
Interactive claude prompts for login anyway
env | grep ANTHROPIC_API_KEY confirms the variable is set
Platform: macOS 26.5.2 (25F84)

What Should Happen?

ClaudeCode should not prompt for login like this

 claude
Welcome to Claude Code v2.1.229
..........................................................

     *                                       █████▓▓░
                                 *         ███▓░     ░░
            ░░░░░░                        ███▓░
    ░░░   ░░░░░░░░░░                      ███▓░
   ░░░░░░░░░░░░░░░░░░░    *                ██▓░░      ▓
                                             ░▓▓███▓▓░
 *                                 ░░░░
                                 ░░░░░░░░
                               ░░░░░░░░░░░░░░░░
                                                      *
      ▗ ▗     ▖ ▖                       *
                      *
.......         ..........................................

 Claude Code can be used with your Claude subscription or billed based on API usage through your Console account.

 Select login method:
 
 ❯ 1. Claude account with subscription · Pro, Max, Team, or Enterprise
   2. Anthropic Console account · API usage billing
   3. 3rd-party platform · Amazon Bedrock, Microsoft Foundry, or Vertex AI

Error Messages/Logs

Steps to Reproduce

  1. export ANTHROPIC_API_KEY="sk..."
  2. Run claude

Claude Model

_No response_

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.229 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗