How to Create a AI SEO Tool Using the Gemini API


Creating a customAI SEO Tool can help you optimize your content and boost your website,s visibility. This guide will walk you through the steps to create your own AI-powered tool using the Gemini API in WordPress. You’ll also learn how to customize the API key, change prompts, and more.

What You’ll Need

  1. WordPress Website: Make sure you have a WordPress site where you can add custom code.
  2. Gemini API Key: Sign up for access to the Gemini API.
  3. Basic PHP and WordPress Knowledge: Familiarity with WordPress plugins and PHP is helpful.

Steps to Create the YouTube SEO Tool

Step 1: Get Your Gemini API Key

  1. Sign Up for the Gemini API:
    • Visit the Gemini API page and sign up for an account.
    • Follow the instructions to create a project and enable the Gemini API.
  2. Generate the API Key:
    • In the Google Cloud Console, navigate to APIs & Services > Credentials.
    • Click Create Credentials and select API Key.
    • Copy the generated API key for later use.

Step 2: Prepare Your WordPress Site

  1. Install WPCode Lite:
    • Go to your WordPress dashboard.
    • Navigate to Plugins > Add New and search for WPCode Lite.
    • Install and activate the plugin.

Step 3: Create the PHP Code for the Tool

  1. Create a New Snippet:
    • Go to WPCode > Add New Snippet.
    • Select Custom PHP Snippet.
  2. Add the PHP Code:
    • Copy and paste the following code, which includes the API call and form setup:
  1. Update Your API Key:
    • Replace 'YOUR_GEMINI_API_KEY' with the API key you generated earlier.
  2. Change the Prompt (Optional):
    • Customize the $prompt variable to fit your needs. Here are some examples:
      • For Hashtags:cssCopy codeGenerate relevant YouTube hashtags for the following video topic:
      • For Video Tags:kotlinCopy codeCreate SEO-friendly tags for this YouTube video:
      • For Video Description:cssCopy codeWrite a catchy and SEO-optimized description for this YouTube video:

Step 4: Display the Tool on Your Site

  1. Add a Shortcode:
    • Wrap the youtube_description_form() function in a shortcode:phpCopy codeadd_shortcode('youtube_description_tool', 'youtube_description_form');
    • Use [youtube_description_tool] in any post or page where you want the form to appear.

Step 5: Share the Code with Friends

  • Share the full code with your friends. They only need to change the API key and the prompt as needed.

Tips for Creating Effective Prompts

  • Be Specific: Clearly state what you want the AI to generate.
  • Use Keywords: Include relevant keywords to help the AI generate content that aligns with your goals.
  • Experiment: Try different prompts to see what works best for your content.

Example Prompts:

  1. For Descriptions:
    • “Generate a short and engaging YouTube video description for this topic, focusing on SEO.”
  2. For Hashtags:
    • “Create a list of popular and relevant YouTube hashtags for this video topic.”
  3. For Tags:
    • “Suggest SEO-friendly tags for this YouTube video about the following topic.”


By following these steps, you can create your own AI-powered YouTube SEO tool using the Gemini API in WordPress. Customize the API key and prompts to suit your needs, and share the tool with friends to help them enhance their YouTube SEO efforts too!

About  Teckshop
Teckshop Hello Visitor, Laba here. A professional Web Developer and WordPress expert with 3+ years of experience. I have built 200+ websites in WordPress. Read More
For Feedback -