Docs · Platforms

Payload

payload-vibe-editor is a Payload 3 plugin plus a small browser overlay. The plugin adds a few authenticated endpoints that read and write through Payload's Local API with your access control; the overlay is the switch and the edit panel on your front end.

Install

npm install payload-vibe-editor
# peer dependency: payload ^3

Create a developer key on your account page (Developer keys) and put it in your server's environment. It is read on the server only and never sent to the browser:

# .env
VIBE_API_KEY=vibe_...

1. Register the plugin

// payload.config.ts
import { buildConfig } from 'payload'
import { vibeEditor } from 'payload-vibe-editor'

export default buildConfig({
  // ...collections, db, etc.
  plugins: [
    vibeEditor({
      // What may be edited. Without it every field is writable, so list them in production.
      allow: [
        { collection: 'pages', field: 'hero.title' },
        { collection: 'pages', field: 'hero.body' },        // Lexical rich text
        { collection: 'pages', field: 'hero.image' },       // upload field (and its alt text)
        { collection: 'pages', field: 'meta.title' },       // plugin-seo title
        { collection: 'pages', field: 'meta.description' }, // plugin-seo description
      ],
      uploadsCollection: 'media', // default
      altField: 'alt',            // default
      basePath: '/vibe',          // endpoints at /api/vibe/*
      // Optional: revalidate your front end after a save
      onSaved: async ({ collection, id }) => {},
    }),
  ],
})

This adds POST /api/vibe/suggest, /save, /swap-image, /generate-image and GET /api/vibe/status.

2. Mark editable content

Add data-vibe-* attributes. collection and id can sit on the element or any ancestor:

<article data-vibe-collection="pages" data-vibe-id="123">
  <h1 data-vibe-field="hero.title">Welcome</h1>
  <div data-vibe-field="hero.body">Some rich text…</div>
  <img data-vibe-field="hero.image" src="/media/hero.jpg" alt="" />
</article>

3. Load the overlay for admins

The overlay is plain JavaScript and CSS, no build step. Render it only for signed-in admins, however your app decides who that is:

<link rel="stylesheet" href="/path/to/payload-vibe-editor/client/overlay.css" />
<script>
  window.VibeEditor = {
    apiBase: '/api/vibe',   // must match basePath
    mediaBase: '/api/media' // your uploads collection's REST route
  }
</script>
<script src="/path/to/payload-vibe-editor/client/overlay.js" defer></script>

In Next.js you can import the files from the package or copy them into public/.

Who can edit

Editing

Page title and description

The magnifier button edits the page's title and meta description, by default in the fields @payloadcms/plugin-seo adds (meta.title, meta.description; change with seo: { title, description }). Add both paths to allow and mark the element that carries the page's document with data-vibe-page:

<article data-vibe-collection="pages" data-vibe-id={page.id} data-vibe-page>

Credits

AI calls are paid from the Vibe Editor account the developer key belongs to. Every new account starts with 20 free credits; plans and top-ups are on the pricing section.

ActionCredits
AI text suggestion1
AI picture5
AI suggestion for a page title or meta description1 each
Saving text you typed, a picture from the library or by URL, alt text, a title or descriptionFree

When the credits run out, the editor says so and links to where you can buy more. If the AI fails, the credits are given back.

When the AI is refused

StatusWhy
402Out of credits. The editor links to where you buy more.
429Too many calls in a minute.
503AI paused, VIBE_API_KEY missing, or the key was revoked.
502The AI failed. The credits were given back.

The editor's buttons are in Norwegian today. The ones you'll meet most: Endre tekst (edit text), Skriv selv (type it yourself), Endre bilde (change picture), Flere valg (more options), Alt-tekst (alt text), Side i søkemotorer (page in search engines), Foreslå med AI (suggest with AI), Lagre (save) and Koble til Vibe Editor (connect).

Read more on the blog