[BUG] print mode (-p) doesn't seem to be using my claude max subscription, instead pulling an API key from the environment
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- Claude CLI version: 1.0.43 (Claude Code)
- Operating System: macos 15.3.1
- Terminal: ghostty
Bug Description
Running a command like: claude -p --output-format stream-json --verbose "hello there" is deducting from my API key despite me being logged into my claude max subscription locally. This should instead authorize via my claude max subscription (which I'm already logged into), instead of pulling from the ambient ANTHROPIC_API_KEY variable.
I got that too on windows native claude code 1.0.65 node 24.4.1
for now the workaround i use the remove it from environment prior to use.
+1 I'm facing this too with Coder workspace.
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Still present in version 2.0.76
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.