Skip to content

Claude Code

Claude Code is Anthropic’s CLI for AI-assisted coding. Use varlock to inject ANTHROPIC_API_KEY at runtime so the key never sits in a plain text .env or shell history.

For install, schema setup, and shared patterns, see the AI Tools overview.

Environment variable: ANTHROPIC_API_KEY (see supported env variables). Use the API key, not CLAUDE_CODE_OAUTH_TOKEN: that (from claude setup-token) only works for headless claude -p requests, not the interactive TUI.

Add to .env.schema:

# @sensitive @required
ANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)
Terminal window
varlock run -- claude

Personal schema at ~/.env.claude:

~/.env.claude
# @sensitive @required
ANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)
Terminal window
varlock run -p ~/.env.claude -- claude
Terminal window
alias vclaude='varlock run -p ~/.env.claude --no-redact-stdout -- claude'

--no-redact-stdout keeps Claude’s own terminal output unredacted while secrets stay out of your shell history.