Go Back to Parent Doc

Getting API Keys

AI Content Writer relies on several external APIs to generate content and images:

  • Google Gemini API – for AI content generation (free/freemium)
  • OpenAI / ChatGPT API – for AI content generation (paid)
  • Pexels API – for free stock images and thumbnails (free)

This guide walks you through how to obtain each API key and where to configure it inside your WordPress admin.

Always keep your API keys secret. Never share them publicly or commit them to version control.

Table of Contents

Where to Configure API Keys in WordPress

All API keys are configured inside the AI Content Writer settings pages.

  1. Sign in to your WordPress admin
  2. Navigate to AI Content Writer → Settings
  3. Open the API Settings section/tab

From there, you’ll see fields for:

  • Google Gemini API key
  • OpenAI / ChatGPT API key
  • Pexels API key

Fill in the keys as described below and save your settings.

Google Gemini API (Free / Freemium)

The Google Gemini API is used for Gemini Campaigns and possibly for other AI-related features in the plugin.

Overview

  • Offers a free tier with daily or monthly limits
  • Suitable for most users to start with
  • Ideal if you want AI content generation without immediate costs

Step 1: Create or Log In to Your Google Account

  1. Go to Google Cloud Console
  2. Log in with your Google account

Step 2: Create a Google Cloud Project

  1. In the top navigation bar, click on the project selector
  2. Click New Project
  3. Enter a Project Name (e.g., ai-content-writer)
  4. Choose an organization (if required)
  5. Click Create

Wait for the project to be created, then ensure it is selected in the project dropdown.

Step 3: Enable the Gemini / Generative Language API

  1. In the left sidebar, go to APIs & Services → Library
  2. Search for “Gemini” or “Generative Language API”
  3. Click on the relevant API entry (e.g., Google Generative Language API)
  4. Click Enable

This enables the API for your project.

Step 4: Create an API Key

  1. Go to APIs & Services → Credentials
  2. Click + Create Credentials
  3. Select API key
  4. Google will generate a new API key
  5. Click Copy to copy the key to your clipboard

Optionally:

  • Click Edit API key
  • Restrict usage by IP, HTTP referrer, or API (advanced, recommended for production)

Step 5: Add Gemini API Key to AI Content Writer

  1. Return to your WordPress admin
  2. Go to AI Content Writer → Settings → API Settings
  3. Locate the Google Gemini API Key field
  4. Paste the API key you copied from Google Cloud Console
  5. Click Save Changes

Step 6: Test Gemini Campaigns

  1. Create a Gemini Campaign (see Configuring Gemini Campaigns)
  2. Set Posts per Run to 1 for testing
  3. Check Managing Logs for any Gemini-related messages

If everything is set up correctly, you should start seeing Gemini-powered content generated after the cron runs.

OpenAI / ChatGPT API (Paid)

The OpenAI / ChatGPT API is used for ChatGPT Campaigns and any other features that rely on OpenAI models.

Note: The ChatGPT API is a paid, usage-based service. You’ll be billed based on the number of tokens used.

Step 1: Create or Log In to Your OpenAI Account

  1. Visit OpenAI Platform
  2. Log in or sign up for a new account

Step 2: Set Up Billing (Required for API Usage)

  1. In the menu, go to Settings → Billing (or similar)
  2. Add a valid payment method
  3. Review pricing details at:

Some regions may offer a small free trial credit, but the API is not generally free.

Step 3: Create an API Key

  1. Go to View API keys in your OpenAI dashboard
  2. Click Create new secret key
  3. Give it a descriptive name (e.g., ai-content-writer)
  4. Click Create secret key
  5. Copy the key once and store it securely (you will not be able to view it again later)

Step 4: Add OpenAI API Key to AI Content Writer

  1. In your WordPress admin, go to AI Content Writer → Settings → API Settings
  2. Locate the OpenAI / ChatGPT API Key field
  3. Paste the OpenAI API key you copied
  4. Click Save Changes

Step 5: (Optional) Choose a Model

Depending on the plugin’s settings, you may be able to:

  • Select a default OpenAI model (e.g., gpt-4gpt-4ogpt-3.5-turbo)
  • Adjust this either globally or per campaign (if supported)

Consult the Settings or campaign configuration pages to see the available options.

Step 6: Test ChatGPT Campaigns

  1. Create a ChatGPT Campaign (see Configuring ChatGPT Campaigns)
  2. Use clear, descriptive keywords
  3. Set Posts per Run to 1 initially
  4. Monitor logs for any OpenAI errors or success messages

Keep an eye on your OpenAI usage dashboard to understand your usage and costs.

Pexels API (Free Images)

The Pexels API is used to fetch and assign featured images (thumbnails) to posts.

Step 1: Create a Pexels Account

  1. Go to Pexels
  2. Click Join or Sign Up
  3. Create an account or sign in with Google/Facebook/Apple

Step 2: Request API Access

  1. Once signed in, navigate to the API section:
  2. Click Get Started or Your API Key
  3. Fill in any required application details (e.g., project name, usage description)
  4. Pexels will generate an API key for you

Step 3: Add Pexels API Key to AI Content Writer

  1. Go to AI Content Writer → Settings → API Settings in your WordPress admin
  2. Find the Pexels API Key field
  3. Paste the key you got from Pexels
  4. Click Save Changes

Step 4: Test Thumbnail Generation

  1. Ensure at least one campaign is active (Articles, RSS, Gemini, or ChatGPT)
  2. Wait for the thumbnail cron (aicw_generate_thumbnail) to run
  3. Check:
    • New posts: do they have a featured image?
    • Logs: look for success or error messages related to thumbnails

If thumbnails are not appearing, see Troubleshooting and Managing Logs.

Verifying API Configuration

After entering your keys, it’s important to verify that everything works.

1. Check the Settings Screen

  • Ensure there are no error messages after saving
  • Confirm that the fields are populated with masked keys (if the UI masks them)

2. Use Test Campaigns

Create small, controlled campaigns to test each API:

  • Gemini Test Campaign: 1 post per run, simple keyword
  • ChatGPT Test Campaign: 1 post per run, specific topic
  • Any Campaign: confirm thumbnails via Pexels

3. Inspect Logs

Go to AI Content Writer → Logs and look for:

  • Success entries like:
    • Content generated successfully for post #ID
    • Thumbnail generated successfully for post #ID
  • Error entries like:
    • Gemini API error: ...
    • OpenAI API error: ...
    • Failed to download image from Pexels

Use these messages to fine-tune your configuration.

Security & Best Practices

Keep API Keys Secret

  • Never share your keys in screenshots or public forums
  • Do not commit keys to Git repositories
  • Restrict API keys in provider dashboards where possible (IP/domain restrictions)

Monitor Usage and Costs

  • Regularly check:
    • Google Cloud usage for Gemini
    • OpenAI usage for ChatGPT
    • Pexels usage or rate limits
  • Adjust Posts per Run and campaign frequency to stay within your budget and provider quotas

Rotate Keys if Needed

  • If you suspect a key has been exposed, regenerate it in the provider dashboard
  • Update the key in AI Content Writer → Settings → API Settings

Use Separate Keys Per Project (Optional)

  • For large or multi-site setups, consider using separate API keys per site or project
  • This helps you track and isolate usage

FAQ

Do I have to use both Gemini and ChatGPT?

No. You can use:

  • Only Gemini (free/freemium) campaigns
  • Only ChatGPT (paid) campaigns
  • Or a mix of both, depending on your needs and budget

If you don’t configure one of the APIs, just don’t create campaigns that depend on it.

Can I use AI Content Writer without any API keys?

You must configure at least one AI provider (Gemini or ChatGPT) to generate AI content, and Pexels to generate thumbnails. Without API keys, the plugin cannot generate new AI-powered content.

Are API keys stored securely?

  • AI Content Writer stores keys in your WordPress database using standard options
  • Access to these values is limited to users with appropriate capabilities (usually admins)
  • Always secure your WordPress admin and database with strong passwords and proper hosting security

Can I change API keys later?

Yes. You can update or replace keys at any time:

  1. Go to AI Content Writer → Settings → API Settings
  2. Replace the existing key with a new one
  3. Click Save Changes

Existing content remains on your site; only future API calls are affected.


Last Updated: November 27, 2025 | Plugin Version: 2.1.0

Shopping Cart
  • Your cart is empty.
Scroll to Top