I can confirm that the priority is alwys given to credentials, as they themselves state in the documentation they updated yesterday: https://support.claude.com/en/articles/15036540-use-the-clau... Essentially, in the -p option, if an ANTHROPIC_API_KEY is present, it is always used instead of the login; see here https://code.claude.com/docs/en/authentication#authenticatio..., so I would suggest you check your environment variables
That was almost certainly my problem. If there was a warning about this I could have missed it.
Weirdly I know for sure there was an article behind that first link earlier today but now it's showing no body, just the update boxes. The second doc link is quite clear though.