diff --git a/.env.example b/.env.example index b9aab986..e3620184 100644 --- a/.env.example +++ b/.env.example @@ -5,9 +5,15 @@ CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 # ============================================================================= -# OPTION 1: Direct Anthropic (default, no router) +# OPTION 1: Claude Code login (easiest — no API key needed) # ============================================================================= -ANTHROPIC_API_KEY=your-api-key-here +# Just run `claude login` on the host. Shannon mounts ~/.claude into Docker +# automatically. You only need this file with the line above. + +# ============================================================================= +# OPTION 2: Direct Anthropic API key +# ============================================================================= +# ANTHROPIC_API_KEY=your-api-key-here # OR use OAuth token instead # CLAUDE_CODE_OAUTH_TOKEN=your-oauth-token-here diff --git a/README.md b/README.md index 1ec4552c..49c424c2 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,8 @@ Shannon is available in two editions: - **Docker** - Container runtime ([Install Docker](https://docs.docker.com/get-docker/)) - **AI Provider Credentials** (choose one): - - **Anthropic API key** (recommended) - Get from [Anthropic Console](https://console.anthropic.com) + - **Claude Code login** (easiest) - Just run `claude login` on the host + - **Anthropic API key** - Get from [Anthropic Console](https://console.anthropic.com) - **Claude Code OAuth token** - **[EXPERIMENTAL - UNSUPPORTED] Alternative providers via Router Mode** - OpenAI or Google Gemini via OpenRouter (see [Router Mode](#experimental---unsupported-router-mode-alternative-providers)) @@ -117,11 +118,17 @@ cd shannon # 2. Configure credentials (choose one method) -# Option A: Export environment variables +# Option A: Use Claude Code login (easiest — no API key needed) +claude login +cat > .env << 'EOF' +CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 +EOF + +# Option B: Export environment variables export ANTHROPIC_API_KEY="your-api-key" # or CLAUDE_CODE_OAUTH_TOKEN export CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 # recommended -# Option B: Create a .env file +# Option C: Create a .env file with API key cat > .env << 'EOF' ANTHROPIC_API_KEY=your-api-key CLAUDE_CODE_MAX_OUTPUT_TOKENS=64000 diff --git a/docker-compose.yml b/docker-compose.yml index 26cbdfa9..2e345f30 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: - ${OUTPUT_DIR:-./audit-logs}:/app/output - ${TARGET_REPO:-.}:/target-repo - ${BENCHMARKS_BASE:-.}:/benchmarks + - ${HOME}/.claude:/tmp/.claude shm_size: 2gb ipc: host security_opt: diff --git a/shannon b/shannon index b1a7ffec..e0684fbe 100755 --- a/shannon +++ b/shannon @@ -128,9 +128,11 @@ cmd_start() { if [ "$ROUTER" = "true" ] && { [ -n "$OPENAI_API_KEY" ] || [ -n "$OPENROUTER_API_KEY" ]; }; then # Router mode with alternative provider - set a placeholder for SDK init export ANTHROPIC_API_KEY="router-mode" + elif [ -f "$HOME/.claude/.credentials.json" ]; then + echo "Using Claude Code login credentials..." else echo "ERROR: Set ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN in .env" - echo " (or use ROUTER=true with OPENAI_API_KEY or OPENROUTER_API_KEY)" + echo " Or log in with: claude login" exit 1 fi fi