Skip to main content
Claude by Anthropic offers powerful AI models known for their reasoning capabilities and detailed analysis, making them excellent for complex code review tasks.

Why Claude?

  • Deep reasoning - Excellent at understanding complex code patterns
  • Detailed analysis - Provides thorough explanations and context
  • Large context - Can analyze large codebases in a single request
  • Safety-focused - Built with responsible AI principles
Claude is a paid service. Youโ€™ll need to add credits to your Anthropic account to use their API.

Get an API key

1

Create an account

Visit console.anthropic.com and sign up.
2

Add billing

Navigate to Plans & Billing and add payment information.
3

Create an API key

Go to API Keys and generate a new key.
4

Copy your key

Your key will look like sk-ant-api03-.... Keep it secure.

Setup

Set the environment variable in your shell:
export ANTHROPIC_API_KEY="sk-ant-api03-..."
To make it permanent, add it to your shell profile:
# Add this line to your shell profile
export ANTHROPIC_API_KEY="sk-ant-api03-..."

Option 2: .env file

Create a .env file in your project directory:
.env
ANTHROPIC_API_KEY=sk-ant-api03-...
Add .env to your .gitignore to prevent committing your API key.

Option 3: Configuration file

Create a vibrant.config.js file:
vibrant.config.js
module.exports = {
  provider: 'claude',
  // API key will be read from environment variable
};

Usage

Run Vibrant with Claude:
# Auto-detect provider (if ANTHROPIC_API_KEY is set)
vibrant . --ai

# Explicitly specify Claude
vibrant . --ai --provider claude

Available models

Vibrant uses claude-3-haiku-20240307 by default for fast, cost-effective analysis.
  • Context: 200k tokens
  • Cost: ~0.25per1Minputtokens,ย 0.25 per 1M input tokens, ~1.25 per 1M output tokens
  • Speed: Very fast
  • Quality: Excellent for code analysis
  • Best for: Daily development, quick analysis
  • Context: 200k tokens
  • Cost: ~3.00per1Minputtokens,ย 3.00 per 1M input tokens, ~15.00 per 1M output tokens
  • Speed: Fast
  • Quality: Superior reasoning and analysis
  • Best for: Complex codebases, architectural review
  • Context: 200k tokens
  • Cost: ~15.00per1Minputtokens,ย 15.00 per 1M input tokens, ~75.00 per 1M output tokens
  • Speed: Medium
  • Quality: Best-in-class for complex tasks
  • Best for: Critical production code, security audits

Change the model

Set the CLAUDE_MODEL environment variable:
export CLAUDE_MODEL="claude-3-5-sonnet-20241022"
vibrant . --ai --provider claude
Or in your .env file:
.env
ANTHROPIC_API_KEY=sk-ant-api03-...
CLAUDE_MODEL=claude-3-5-sonnet-20241022

Pricing

Typical costs for analyzing a medium-sized project (100 files):
ModelInput CostOutput CostTypical Total
claude-3-haiku~$0.004~$0.010~$0.02 per analysis
claude-3-5-sonnet~$0.05~$0.12~$0.20 per analysis
claude-3-opus~$0.25~$0.60~$1.00 per analysis
Vibrantโ€™s Smart Summarizer reduces token usage by 50-60%, significantly lowering your costs.

Example output

vibrant . --ai --provider claude
๐Ÿ”ฎ Vibrant Analysis
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€

๐Ÿ“ก AI Analysis (claude:claude-3-haiku-20240307)

๐Ÿ“Š Token Optimization:
   Original: 52,000 tokens
   Summarized: 21,000 tokens
   Savings: 59.6%

โœ” Analysis complete

๐Ÿ“‹ Summary:
This codebase demonstrates generally sound architectural patterns,
but contains several critical security vulnerabilities that require
immediate attention. The error handling strategy is inconsistent
across modules, which could lead to silent failures in production.

๐Ÿ” Key Findings:
  โ€ข Hardcoded credentials in 3 files pose immediate security risk
  โ€ข Empty catch blocks in error-prone async operations
  โ€ข SQL query construction vulnerable to injection attacks
  โ€ข Inconsistent input validation across API endpoints

๐Ÿ’ก Recommendations:
  โ€ข Migrate all secrets to a secret management system (e.g., AWS Secrets Manager)
  โ€ข Implement structured error logging with proper context
  โ€ข Use parameterized queries or an ORM for database operations
  โ€ข Add input validation middleware at the API layer
  โ€ข Consider implementing request rate limiting

โœ• 4 errors ยท โš  12 warnings ยท 100 files ยท 10s

Troubleshooting

Error: API key not found

Claude API error: invalid x-api-key
Solution: Set the ANTHROPIC_API_KEY environment variable:
export ANTHROPIC_API_KEY="sk-ant-api03-..."

Error: Insufficient credits

Claude API error: Your credit balance is too low
Solution: Add credits to your Anthropic account at Billing.

Error: Rate limit exceeded

Claude API error: rate_limit_error
Solution: Vibrant automatically retries with exponential backoff. If the issue persists:
  • Wait a few minutes before retrying
  • Contact Anthropic support to increase your rate limits
  • Use a different provider temporarily: vibrant . --ai --provider gemini

Best practices

1

Use Haiku for daily development

Claude Haiku provides excellent quality at a reasonable cost, perfect for frequent analyses.
2

Use Sonnet for complex reviews

When reviewing large refactors or architectural changes, Claude Sonnet offers superior reasoning.
3

Reserve Opus for critical code

Use Claude Opus for security audits, production deployments, or complex debugging tasks.
4

Monitor your usage

Check your usage dashboard to track costs.

CI/CD integration

For GitHub Actions:
.github/workflows/code-quality.yml
name: Code Quality

on: [pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'
      
      - name: Run Vibrant with Claude
        run: npx vibrant-cli . --ai --provider claude
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
          CLAUDE_MODEL: claude-3-5-sonnet-20241022  # Use Sonnet for PR reviews
Add ANTHROPIC_API_KEY as a secret in your repository settings.

When to use Claude

Claude excels at:
  • Complex reasoning - Understanding intricate code patterns and dependencies
  • Security analysis - Identifying subtle security vulnerabilities
  • Architectural review - Evaluating system design and suggesting improvements
  • Detailed explanations - Providing thorough context for issues
  • Large codebases - 200k token context window handles big projects

Next steps

AI providers overview

Compare all available providers

OpenAI setup

Try GPT-4o for comparison

Build docs developers (and LLMs) love