API Setup Guide

The Automatic Plugin for WordPress requires several API keys to function optimally. This guide will walk you through obtaining and configuring each API key for maximum performance and cost-effectiveness.

API Setup Overview

Required APIs

  • OpenAI (Content Generation)
  • Pexels (Free Images)
  • Unsplash (Premium Images)

Optional APIs

  • Pixabay (Additional Images)
  • Google Translate
  • Custom RSS APIs

Cost Estimate

  • OpenAI: $2-5/1000 articles
  • Pexels: Free forever
  • Unsplash: Free forever

OpenAI API Setup

Why OpenAI is Essential

OpenAI powers the AI content generation, content rewriting, and enhancement features. Without it, you'll only have basic RSS importing without AI improvements.

Step 1: Create OpenAI Account

  1. Visit platform.openai.com/signup
  2. Sign up with your email address
  3. Verify your email address
  4. Complete phone number verification
  5. Complete your account setup and verify access to the dashboard

Pro Tip: After account creation, verify billing and usage settings before connecting the API key.

Step 2: Generate API Key

  1. Log into platform.openai.com
  2. Navigate to API Keys section
  3. Click "Create new secret key"
  4. Give it a name like "WordPress Plugin"
  5. Copy the API key immediately (you won't see it again)

Important: Copy the API key immediately! OpenAI only shows it once for security reasons.

Your API key will look like this:

sk-proj-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef

Step 3: Configure in Plugin

  1. Go to Auto News Importer → OpenAI Settings
  2. Paste your API key in the "OpenAI API Key" field
  3. Set Model to GPT-4.1 (recommended)
  4. Set Max Tokens to 2048
  5. Set Temperature to 0.7
  6. Click "Test Connection" to verify
  7. Save settings

Cost Management

Setting Usage Limits

  • Set monthly spending limit in OpenAI dashboard
  • Start with $20/month for testing
  • Monitor usage daily initially
  • Scale up based on results

Cost Optimization

  • Use GPT-4.1 (10x cheaper than Claude 3 Opus)
  • Enable plugin caching (reduces API calls by 80%)
  • Optimize prompt length
  • Monitor token usage

Pexels API Setup

Why Pexels API

Pexels provides high-quality, royalty-free images for your articles. It's completely free with generous rate limits (200 requests/hour, 20,000/month).

Quick Setup Steps

  1. Visit pexels.com/api
  2. Click "Get Started" and create account
  3. Go to "Your API Key" section
  4. Copy your API key
  5. In plugin: Auto News Importer → Image Settings → Pexels API Key
  6. Paste the key and save

Pexels API key format:

1234567890abcdef1234567890abcdef12345678

Pexels Rate Limits

Per Hour: 200 requests
Per Month: 20,000 requests
Cost: Completely free

Unsplash API Setup

Why Unsplash API

Unsplash offers premium, high-resolution images from professional photographers. Free tier provides 50 requests/hour, perfect for smaller sites.

Setup Process

  1. Go to unsplash.com/developers
  2. Register/login and click "New Application"
  3. Fill out application details (describe your website)
  4. Accept terms and create application
  5. Copy the "Access Key" (not Secret Key)
  6. In plugin: Auto News Importer → Image Settings → Unsplash Access Key
  7. Paste key and save

Unsplash Access Key format:

px-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef

Unsplash Rate Limits

Demo: 50/hour
Production: 5,000/hour
Cost: Free tier available

Optional API Configurations

Pixabay API

Additional image source with different style options.

  1. Visit pixabay.com/api/docs
  2. Create account and get API key
  3. Add to plugin image settings

Rate Limit: 5,000 requests/hour (free)

Google Translate API

For advanced translation features beyond built-in support.

  1. Enable in Google Cloud Console
  2. Create service account
  3. Download JSON credentials
  4. Upload to plugin settings

Cost: $20 per 1M characters

Testing Your API Setup

Built-in Test Tools

The plugin includes built-in testing tools to verify each API connection:

  • OpenAI Test: Generates sample content to verify AI functionality
  • Image API Test: Searches for test images from each service
  • Connection Status: Real-time status indicators in admin panel

OpenAI Working

  • Green status indicator
  • Sample content generated
  • No API errors in logs

Images Working

  • Test images downloaded
  • Multiple sources active
  • Proper attribution added

All Systems Go

  • Dashboard shows green
  • Content generation active
  • Ready for production

Common API Issues & Solutions

OpenAI "Invalid API Key" Error

Causes:

  • Typo in API key (missing characters, extra spaces)
  • Using old API key format
  • API key not activated or expired

Solutions:

  • Double-check API key copy/paste
  • Generate new API key
  • Verify OpenAI account is active

Rate Limit Exceeded

What this means: You've hit the API usage limits

Solutions:

  • Wait for rate limit reset (usually 1 hour)
  • Reduce content generation frequency
  • Enable caching to reduce API calls
  • Upgrade to higher tier if needed

Images Not Loading

Check these items:

  • Image API keys are correct
  • WordPress uploads directory is writable
  • Server has cURL enabled
  • No firewall blocking image downloads

API Security Best Practices

Protecting Your API Keys

  • Never share API keys publicly or in support requests
  • Regenerate keys if you suspect they're compromised
  • Use different keys for testing and production
  • Monitor usage regularly for unusual activity

Cost Control Measures

  • $Set spending limits in API provider dashboards
  • $Enable email notifications for usage alerts
  • $Start with low limits and scale up gradually
  • $Monitor daily usage through plugin dashboard