Documentation inconsistency: SDK Quick Start requires API key but Claude Code uses subscription auth

Status Fixed / completed
Maintainer reply ✓ Yes — catherinewu
Activity 4 comments · opened Aug 16, 2025 · closed Nov 29, 2025
💡 Likely answer: A maintainer (catherinewu, contributor) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: N/A - Documentation issue
  • Operating System: N/A - Documentation issue
  • Terminal: N/A - Documentation issue

Bug Description

The Claude Code SDK documentation at https://docs.anthropic.com/en/docs/claude-code/sdk#quick-start has a confusing inconsistency. The Quick Start section requires setting an ANTHROPIC_API_KEY environment variable in Step 2, but the example command in Step 3 doesn't actually use the API - it uses Claude Code's subscription-based authentication.

Steps to Reproduce

  1. Visit https://docs.anthropic.com/en/docs/claude-code/sdk#quick-start
  2. Follow the Quick Start guide
  3. Notice Step 2 requires setting: export ANTHROPIC_API_KEY="your-api-key-here"
  4. Notice Step 3's example doesn't use the API key: claude -p "Review this contract clause..."

Expected Behavior

The documentation should be consistent. Either:

  • Remove the API key setup step if Claude Code doesn't need it (since it uses subscription auth)
  • Explain why the API key is needed if there's a specific reason
  • Show an example that actually uses the API key

Actual Behavior

The documentation confusingly requires setting up an API key that appears unused in the example. Claude Code typically authenticates through the Claude Pro/Team subscription (browser login), not via API key.

Additional Context

This creates confusion for new users who may think they need an API key to use Claude Code, when in reality the CLI authenticates through their subscription. The example command shown (claude -p) is using the standard Claude Code CLI in non-interactive mode, not making API calls.

View original on GitHub ↗

4 Comments

PabloLION · 1 year ago

Not sure if this is the correct place, but Claude Opus guided me here (and wrote the description).

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/1932
  2. https://github.com/anthropics/claude-code/issues/3040
  3. https://github.com/anthropics/claude-code/issues/4076

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

catherinewu contributor · 10 months ago

The Claude Agent SDK (fka Claude Code SDK) is intended to be used with an API key. Claude Code can be used with an API key or with a subscription.

github-actions[bot] · 10 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.