Login with API token on server to execute tasks
Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 11 comments · opened Mar 11, 2025 · closed Mar 15, 2025
💡 Likely answer: A maintainer (bcherny, collaborator)
responded on this thread — see the highlighted reply below.
No description provided.
11 Comments
Hi! Could you share a bit more detail on what you would like to do?
@levpopov I am trying to create a GitHub bot with Claude Code. When I create a PR, I want to run it and perform some contextual tasks. The CLI tool doesn't seem designed for automation as it requires many approvals and a manual login process.
Can you enable the tool for advanced mode and simple API_KEY authentication?
+1 Think this would be an interesting use case for CI
Yes there are ways to implement but not easy and straightforward. Also allow root to run the tool. @levpopov
This is shipped in 0.2.44! You can now set the
ANTHROPIC_API_KEYenv var in-pmode. Docs coming in hot.No chance to run this CLI tool in ubuntu. Impossible in Alpine @bcherny @levpopov Can you help !?
<img width="691" alt="Image" src="https://github.com/user-attachments/assets/ee328ec2-5c58-4b1d-aee0-a088fa22dfa5" />
@bcherny Using the latest version (0.2.45) I still cannot make it work with
ANTHROPIC_API_KEY:even on 0.2.48 i am unable to make ANTHROPIC_API_KEY to work
I was having some issues with this as well.
This claude-code-action led me to believe that you need a config.json setup to not have to manually login.
config_template
Then when you finally run claude, make sure CLAUDE_CONFIG_DIR points to your json file
I was trying to run claude code in a docker container and came across this issue, but it wasn't super clear how to enable this.
This is how I was able to run claude in docker:
claude setup-tokento generate a long lived token (pro and max only)CLAUDE_CODE_OAUTH_TOKEN=sk-***.claude.jsonfile with the followingMy full
DockerfileisNOTE
.claude.jsonshould be in the same directory as theDockerfileThen build it and run remembering to pass in the token eg.
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.