AI Providers Overview

AI Providers Overview

Capyseo supports multiple AI providers for generating SEO suggestions.

Supported Providers

Provider API Key Features
Gemini GEMINI_API_KEY Recommended, fast
OpenAI OPENAI_API_KEY GPT models
Anthropic ANTHROPIC_API_KEY Claude models
Ollama None (local) Privacy, offline

AI Features

When AI is enabled, Capyseo can:

  • Generate meta descriptions - Optimal length, keyword-rich
  • Generate alt text - Image analysis for descriptions
  • Suggest titles - Improved page titles
  • Analyze content - Keywords, readability, gaps

Quick Start

1. Set API Key

# Gemini (recommended) export GEMINI_API_KEY=your_key_here # OpenAI export OPENAI_API_KEY=your_key_here # Anthropic export ANTHROPIC_API_KEY=your_key_here # Ollama (no key needed) ollama serve

2. Enable AI

# CLI capyseo analyze ./dist --ai # With specific provider capyseo analyze ./dist --ai --ai-provider gemini

3. See Suggestions

[x] [meta-description] Missing meta description Add <meta name="description" content="..."> AI Suggestion: "Learn React from scratch with comprehensive examples covering hooks, state, and best practices for modern development."

Provider Auto-Detection

Capyseo detects providers from environment variables:

  1. CAPYSEO_AI_PROVIDER - Explicit choice
  2. GEMINI_API_KEY or GOOGLE_API_KEY → Gemini
  3. OPENAI_API_KEY → OpenAI
  4. ANTHROPIC_API_KEY → Anthropic
  5. Ollama (checks if running)

Configuration

CLI

capyseo analyze ./dist --ai --ai-provider gemini --ai-model gemini-2.5-flash

Config File

// capyseo.config.js export default { ai: { enabled: true, provider: 'gemini', model: 'gemini-2.5-flash', cacheDir: '.capyseo-cache', cacheTTL: 86400000, // 24 hours }, };

Programmatic

import { SEOAnalyzer } from '@capyseo/core'; const analyzer = new SEOAnalyzer({ aiProvider: 'gemini', aiApiKey: process.env.GEMINI_API_KEY, aiModel: 'gemini-2.5-flash', });

Caching

AI responses are cached to reduce API calls:

ai: { cacheDir: '.capyseo-cache', // Cache location cacheTTL: 86400000, // 24 hours }

Add to .gitignore:

.capyseo-cache/

Choosing a Provider

Gemini (Recommended)

  • Fast responses
  • Good quality
  • Free tier available
  • Best for most users

OpenAI

  • GPT-4 quality
  • Widely used
  • Higher cost

Anthropic

  • Claude models
  • Good for long content
  • Higher cost

Ollama

  • Local/offline
  • Privacy-focused
  • Requires local setup
  • Variable quality

Cost Considerations

Provider Free Tier Cost
Gemini Yes Low
OpenAI Limited Medium
Anthropic No Medium
Ollama Unlimited Free (local)

Next Steps