⌨️ANTHROPIC_API_KEY
Also known as ANTHROPIC_API_KEY environment variable
It gives Claude Code an API key to sign in and pay with.
Think of it like
It is like a key card. If you carry it, the door uses it before your name.
Example
Jack's CI job sets ANTHROPIC_API_KEY from a secret. Each run then signs in with the team's key, with no browser and no login.
Why it matters
It is the plain way to run Claude Code in a script, and it decides who pays.
Definition
Example code
bash
export ANTHROPIC_API_KEY=sk-ant-your-key
claude -p "Explain this repo"Common mistake
Key takeaways
- 1X-Api-Key header. A Console key.
- 2Beats your plan. Even when logged in.
- 3Asked once. Always used with -p.