Anthropic Setup

Anthropic Setup

Use Anthropic's Claude models for AI-powered SEO suggestions.

Get API Key

  1. Go to Anthropic Console
  2. Sign up or log in
  3. Navigate to API Keys
  4. Create new key
  5. Copy the key

Set Environment Variable

# Linux/macOS export ANTHROPIC_API_KEY=your_key_here # Windows (PowerShell) $env:ANTHROPIC_API_KEY = "your_key_here"

Permanent Setup

echo 'export ANTHROPIC_API_KEY=your_key_here' >> ~/.bashrc source ~/.bashrc

Usage

CLI

# Explicit provider capyseo analyze ./dist --ai --ai-provider anthropic # Specific model capyseo analyze ./dist --ai --ai-provider anthropic --ai-model claude-3-haiku-20240307

Config File

// capyseo.config.js export default { ai: { enabled: true, provider: 'anthropic', model: 'claude-3-haiku-20240307', cacheDir: '.capyseo-cache', cacheTTL: 86400000, }, };

Programmatic

import { SEOAnalyzer } from '@capyseo/core'; const analyzer = new SEOAnalyzer({ aiProvider: 'anthropic', aiApiKey: process.env.ANTHROPIC_API_KEY, aiModel: 'claude-3-haiku-20240307', });

Available Models

Model Speed Quality Cost
claude-3-haiku-20240307 Fast Good Low
claude-3-sonnet-20240229 Medium Better Medium
claude-3-opus-20240229 Slower Best High

Recommended: claude-3-haiku-20240307 for cost-effective analysis.

Features

All AI features work with Anthropic:

  • Meta description generation
  • Alt text generation
  • Title suggestions
  • Content analysis

CI/CD Integration

GitHub Actions

- name: SEO Analysis run: capyseo analyze ./dist --ai --ai-provider anthropic env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}

Pricing

Model Input Output
claude-3-haiku $0.25/1M tokens $1.25/1M tokens
claude-3-sonnet $3/1M tokens $15/1M tokens
claude-3-opus $15/1M tokens $75/1M tokens

Troubleshooting

"Invalid API key"

"Rate limit exceeded"

  • Wait and retry
  • Enable caching
  • Use haiku instead of opus

Comparison

Feature Anthropic Gemini OpenAI
Free tier No Yes Limited
Speed Medium Fast Medium
Quality Excellent Good Excellent
Cost Medium Low Medium

For most users, Gemini is recommended unless you specifically need Claude.