Skip to main content

Command Palette

Search for a command to run...

I Built an LLM-Agnostic AI SEO Tool for Next.js

Updated
5 min read
I Built an LLM-Agnostic AI SEO Tool for Next.js
M
I build websites and apps using Javascript. I love making things work fast and look great. Let's create something cool

If you're a Next.js developer working with AI tools for SEO, you've probably hit the same wall I did:

Every AI SEO solution today is locked to a specific LLM provider.

That means if you build your SEO pipeline with OpenAI, switching to Claude, Gemini, or a local model later forces you to rewrite your entire system.

This is a major problem for teams building programmatic SEO systems in 2026.

So I built a different approach: an LLM-agnostic AI SEO tool that works with any model without changing your codebase.

The Problem With AI SEO Tools in 2026

Most AI SEO tools today have three major issues:

1. Vendor Lock-In

They are tightly coupled to one model:

  • OpenAI only

  • Claude only

  • Gemini only

Switching providers equals rewriting logic.

2. No Separation of SEO Logic

Prompt engineering is buried inside SDKs or dashboards.

You cannot reuse SEO logic independently.

3. Poor Scalability for Programmatic SEO

When generating:

  • 100 pages is manageable

  • 10,000 pages breaks down

Because SEO logic is not modular.

The Key Insight

The breakthrough came from a simple realization:

SEO logic does NOT depend on the LLM. Only execution does.

SEO tasks are always the same:

  • Meta descriptions

  • Title tags

  • Content optimization

  • Schema validation

  • SERP feature prediction

So why tie them to a specific AI provider?

The Solution: LLM-Agnostic SEO Architecture

I built a system using @power-seo/ai, a lightweight SEO logic layer that:

✔ Generates SEO prompts ✔ Parses LLM responses into structured data ✔ Works with ANY LLM provider ✔ Adds deterministic SEO validation

It does NOT:

  • Call APIs

  • Manage keys

  • Lock you into a model

  • Add runtime dependencies

Installation

npm install @power-seo/ai

Works in:

  • Next.js App Router

  • Node.js servers

  • Edge runtimes (Vercel / Cloudflare Workers)

  • Deno

How AI SEO Works (Core Workflow)

The system follows a simple 3-step pattern:

Step 1: Generate SEO Prompt

Step 2: Send to any LLM

Step 3: Parse structured SEO output

1. Generate Meta Descriptions for SEO

Meta descriptions directly affect CTR in search results.

Instead of writing prompts manually, generate them programmatically:

import { buildMetaDescriptionPrompt, parseMetaDescriptionResponse } from '@power-seo/ai';

const prompt = buildMetaDescriptionPrompt({
  title: 'Best Coffee Shops in NYC (2026 Guide)',
  content: 'A complete guide to top cafés in New York City...',
  focusKeyphrase: 'coffee shops nyc',
});

// Send to any LLM (OpenAI, Claude, Gemini)
const response = await llm.chat(prompt.system, prompt.user);

const result = parseMetaDescriptionResponse(response);

console.log(result.description);
console.log(result.charCount, result.isValid);

SEO Benefits

  • Optimized for 120 to 158 character range

  • Includes focus keyword naturally

  • Validates readability and length

  • Works across all AI models

2. Generate SEO Titles (Multiple Variants)

Instead of one title, generate multiple SEO options:

import { buildTitlePrompt, parseTitleResponse } from '@power-seo/ai';

const prompt = buildTitlePrompt({
  content: 'Guide to keyword research tools in 2026...',
  focusKeyphrase: 'keyword research tools',
  tone: 'informative',
});

const raw = await llm.chat(prompt.system, prompt.user);

const titles = parseTitleResponse(raw);

titles.forEach(t => {
  console.log(t.title, t.charCount);
});

Why this matters for SEO

Google CTR improves when you:

  • test multiple titles

  • choose keyword-optimized variations

  • avoid truncation using character and pixel width checks

3. LLM Flexibility (OpenAI, Claude, Gemini, Local Models)

The biggest advantage is provider independence.

The same prompt works everywhere:

const prompt = buildMetaDescriptionPrompt({
  title: 'SEO Guide for Developers',
  content: '...',
  focusKeyphrase: 'developer seo',
});

You can use:

  • OpenAI GPT models

  • Anthropic Claude

  • Google Gemini

  • Local LLMs (Ollama, etc.)

Only the API call changes, not your SEO logic.

This enables:

  • A/B testing LLMs for SEO performance

  • cost optimization per request

  • full vendor independence

4. Deterministic SEO Validation (No AI Required)

Not everything should use AI.

Some SEO checks must be deterministic.

import { analyzeSerpEligibility } from '@power-seo/ai';

const result = analyzeSerpEligibility({
  title: 'How to Install Node.js on Ubuntu',
  content: '<h2>Step 1</h2><p>Install Node.js...</p>',
  schema: ['HowTo'],
});

console.log(result);

What it checks

  • FAQ schema validity

  • HowTo structure correctness

  • Product schema completeness

  • Article markup integrity

Why this is powerful

You can run this in CI/CD to:

  • prevent broken schema deployments

  • protect rich results in Google

  • enforce SEO structure rules automatically

Real-World Use Cases (Next.js SEO)

1. Programmatic SEO at Scale

Generate SEO content for thousands of pages:

  • location pages

  • product pages

  • category pages

Without manual writing.

2. CMS SEO Automation

Before publishing:

  • auto-generate meta description

  • generate 5 SEO titles

  • let editors pick best version

3. CI/CD SEO Testing

On every deploy:

  • validate schema markup

  • check structured data

  • prevent SEO regressions

Why This Architecture Works

Traditional AI SEO tools fail because they:

❌ Lock you into one model ❌ Hide prompt logic ❌ Mix AI with infrastructure

This approach fixes that:

✔ SEO logic is reusable ✔ LLM is interchangeable ✔ Output is structured and testable ✔ CI/CD friendly

Key Takeaway

SEO in 2026 is no longer manual optimization.

It is engineering-driven SEO infrastructure powered by AI and structured systems.

The real shift is not:

Using AI to write content

It is:

Building systems where AI improves SEO at scale without breaking your stack.

Final Thoughts

@power-seo/ai represents a new approach to AI SEO:

  • Lightweight

  • LLM-agnostic

  • Type-safe

  • CI/CD ready

  • Built for Next.js developers

It doesn’t replace your SEO workflow. It turns it into a scalable system.

More from this blog

P

Power SEO Free Tool

30 posts