Skip to main content

Cyberstrike is now open source! AI-powered penetration testing for security professionals. Star on GitHub

Anthropic (Claude)

Anthropic’s Claude models provide advanced reasoning capabilities for security analysis. This guide covers configuration and best practices.

πŸ“Έ SCREENSHOT: anthropic-model-select.png

Anthropic model selection dialog

Available Models

ModelContextBest For
claude-sonnet-4-20250514200KGeneral security testing
claude-opus-4-5-20251101200KComplex analysis, research
claude-3-5-haiku-20241022200KQuick scans, high volume

Authentication

API Key Setup

  1. Get your API key from console.anthropic.com
  2. Run the authentication command:
Terminal window
cyberstrike auth login
# Select: Anthropic
# Enter your API key

Environment Variable

Terminal window
export ANTHROPIC_API_KEY="sk-ant-api03-..."

Add to your shell profile for persistence:

Terminal window
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.zshrc

Configuration File

~/.cyberstrike/config.json
{
"provider": {
"anthropic": {
"options": {
"apiKey": "{env:ANTHROPIC_API_KEY}"
}
}
}
}

Model Configuration

Set Default Model

~/.cyberstrike/config.json
{
"model": "anthropic/claude-sonnet-4-20250514"
}

Command Line Override

Terminal window
cyberstrike --model anthropic/claude-opus-4-5-20251101

In-Session Switching

/model
# Select Claude model

Extended Thinking

Enable extended thinking for complex security analysis:

~/.cyberstrike/config.json
{
"provider": {
"anthropic": {
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 10000
}
}
}
}
}

When to Use Extended Thinking

  • Complex vulnerability chains
  • Multi-step attack planning
  • Code review with deep analysis
  • Architecture security review

Token Usage

Monitor Usage

/cost

Displays:

Session Token Usage
━━━━━━━━━━━━━━━━━━━
Input: 45,230 tokens
Output: 12,450 tokens
Cache: 32,100 tokens (read)
Total: $0.42

Prompt Caching

Anthropic supports prompt caching for repeated context:

{
"provider": {
"anthropic": {
"options": {
"cacheControl": true
}
}
}
}

Rate Limits

Anthropic applies rate limits based on your tier:

TierRequests/minTokens/min
Free520,000
Build5080,000
Scale1,000400,000

Handling Rate Limits

Cyberstrike automatically handles rate limits with exponential backoff:

{
"provider": {
"anthropic": {
"options": {
"maxRetries": 3,
"retryDelay": 1000
}
}
}
}

Best Practices

Model Selection

TaskRecommended Model
Quick reconclaude-3-5-haiku
Web app testingclaude-sonnet-4
Complex exploitsclaude-opus-4-5
Code reviewclaude-sonnet-4

Cost Optimization

  1. Use Haiku for repetitive tasks
  2. Enable prompt caching
  3. Use /compact for long sessions
  4. Limit context with focused prompts

Security

  1. Never commit API keys to repositories
  2. Use environment variables
  3. Rotate keys periodically
  4. Monitor usage on Anthropic dashboard

Troubleshooting

Invalid API Key

Error: Invalid API key

Verify your key:

  • Starts with sk-ant-api03-
  • No trailing whitespace
  • Key is active in console

Rate Limit Exceeded

Error: Rate limit exceeded

Solutions:

  • Wait and retry
  • Upgrade your tier
  • Use smaller context

Model Not Available

Error: Model not found

Check model ID is correct and available in your region.

Tip

Use Claude Sonnet for most security testing tasks. Reserve Opus for complex analysis requiring deeper reasoning.