let me piggyback on this thread because maybe there’s a kind soul here who knows the answer. I set up some simple cron jobs in Claude Code that run every few hours. I am on the Pro plan and unfortunately, I cant fully solve this one problem: I keep getting the error:
Invalid API key · Please run /login
I know there are a lot of github issues about this but most of them dont seem to directly apply. The weird thing is: when I run the exact same command manually in my terminal, it works fine. When run via cron, it fails. I suspect it has something to do with how Claude CLI stores the session token or environment variables, since cron doesn’t run as a full login shell. I already tried wrapping the command in bash -l -c "..." which helps in some cases, but not consistently. Has anyone here figured out a clean, reliable way to run Claude CLI from cron without having to manually relogin every 5 hours or so? Or is it only restricted for paid anthropic API Key?